Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a80f253 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Smartspace - Fade out secondary cards" into sc-dev

parents 0b4354de 7db0e2e3
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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);
    }
}
+8 −17
Original line number Diff line number Diff line
@@ -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();
        }
    }

    private void updateWallpaperColor() {
        mWallpaperTextColor = Utils.getColorAttrDefaultColor(getContext(),
                R.attr.wallpaperTextColor);
        updateSmartspaceColor();
        float dozeAmount = mStatusBarStateController.getDozeAmount();
        mStatusBarStateListener.onDozeAmountChanged(dozeAmount, dozeAmount);
    }

    private void updateSmartspaceColor() {
    private void updateWallpaperColor() {
        if (mSmartspaceView != null) {
            int color = ColorUtils.blendARGB(mWallpaperTextColor, mDozeColor, mDozeAmount);
            int color = Utils.getColorAttrDefaultColor(getContext(), R.attr.wallpaperTextColor);
            mSmartspaceView.setPrimaryTextColor(color);
        }
    }
+2 −0
Original line number Diff line number Diff line
@@ -262,5 +262,7 @@ public class KeyguardClockSwitchControllerTest extends SysuiTestCase {
        public void registerDataProvider(BcSmartspaceDataPlugin plugin) { }

        public void setPrimaryTextColor(int color) { }

        public void setDozeAmount(float amount) { }
    }
}