Smartspace - Fade out secondary cards
Pass dozeAmount values to the smartspace library to allow the lib to make decisions regarding content on both AOD and Lockscreen Fixes: 185598979 Test: manual, multiple smartspace cards Change-Id: Ic7bc2ba238b22794a33e6db18c1aae0fa7c96e0b
This commit is contained in:
@@ -59,6 +59,14 @@ public interface BcSmartspaceDataPlugin extends Plugin {
|
||||
interface SmartspaceView {
|
||||
void registerDataProvider(BcSmartspaceDataPlugin plugin);
|
||||
|
||||
/**
|
||||
* Primary color for unprotected text
|
||||
*/
|
||||
void setPrimaryTextColor(int color);
|
||||
|
||||
/**
|
||||
* Range [0.0 - 1.0] when transitioning from Lockscreen to/from AOD
|
||||
*/
|
||||
void setDozeAmount(float amount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import android.app.smartspace.SmartspaceConfig;
|
||||
import android.app.smartspace.SmartspaceManager;
|
||||
import android.app.smartspace.SmartspaceSession;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
import android.text.TextUtils;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.View;
|
||||
@@ -33,7 +32,6 @@ import android.widget.RelativeLayout;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.colorextraction.ColorExtractor;
|
||||
import com.android.internal.graphics.ColorUtils;
|
||||
import com.android.keyguard.clock.ClockManager;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.systemui.R;
|
||||
@@ -87,9 +85,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
|
||||
private SmartspaceSession mSmartspaceSession;
|
||||
private SmartspaceSession.OnTargetsAvailableListener mSmartspaceCallback;
|
||||
private float mDozeAmount;
|
||||
private int mWallpaperTextColor;
|
||||
private int mDozeColor = Color.WHITE;
|
||||
private ConfigurationController mConfigurationController;
|
||||
|
||||
/**
|
||||
@@ -121,8 +117,9 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
new StatusBarStateController.StateListener() {
|
||||
@Override
|
||||
public void onDozeAmountChanged(float linear, float eased) {
|
||||
mDozeAmount = eased;
|
||||
updateSmartspaceColor();
|
||||
if (mSmartspaceView != null) {
|
||||
mSmartspaceView.setDozeAmount(eased);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -192,9 +189,6 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
mBatteryController);
|
||||
mLargeClockViewController.init();
|
||||
|
||||
mDozeAmount = mStatusBarStateController.getDozeAmount();
|
||||
updateWallpaperColor();
|
||||
|
||||
mStatusBarStateController.addCallback(mStatusBarStateListener);
|
||||
mConfigurationController.addCallback(mConfigurationListener);
|
||||
|
||||
@@ -206,7 +200,7 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
|
||||
mSmartspaceView = smartspaceDataPlugin.getView(mView);
|
||||
mSmartspaceView.registerDataProvider(smartspaceDataPlugin);
|
||||
updateSmartspaceColor();
|
||||
updateWallpaperColor();
|
||||
View asView = (View) mSmartspaceView;
|
||||
|
||||
// Place smartspace view below normal clock...
|
||||
@@ -237,17 +231,14 @@ public class KeyguardClockSwitchController extends ViewController<KeyguardClockS
|
||||
mSmartspaceSession.addOnTargetsAvailableListener(mUiExecutor, mSmartspaceCallback);
|
||||
mSmartspaceSession.requestSmartspaceUpdate();
|
||||
}
|
||||
|
||||
float dozeAmount = mStatusBarStateController.getDozeAmount();
|
||||
mStatusBarStateListener.onDozeAmountChanged(dozeAmount, dozeAmount);
|
||||
}
|
||||
|
||||
private void updateWallpaperColor() {
|
||||
mWallpaperTextColor = Utils.getColorAttrDefaultColor(getContext(),
|
||||
R.attr.wallpaperTextColor);
|
||||
updateSmartspaceColor();
|
||||
}
|
||||
|
||||
private void updateSmartspaceColor() {
|
||||
if (mSmartspaceView != null) {
|
||||
int color = ColorUtils.blendARGB(mWallpaperTextColor, mDozeColor, mDozeAmount);
|
||||
int color = Utils.getColorAttrDefaultColor(getContext(), R.attr.wallpaperTextColor);
|
||||
mSmartspaceView.setPrimaryTextColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,5 +262,7 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
|
||||
public void registerDataProvider(BcSmartspaceDataPlugin plugin) { }
|
||||
|
||||
public void setPrimaryTextColor(int color) { }
|
||||
|
||||
public void setDozeAmount(float amount) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user