summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Hotseat.java
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-04-01 16:00:49 -0700
committerTony Wickham <twickham@google.com>2016-05-09 15:41:38 -0700
commit462b5cca7bb1d5e24fb8277b0cfe238cc2e1e980 (patch)
treeb3bca05af635632cc3966094cca670baf6ef295c /src/com/android/launcher3/Hotseat.java
parent34a2d31f3208c64f6ebf403f8a0cb6ea96461747 (diff)
downloadandroid_packages_apps_Trebuchet-462b5cca7bb1d5e24fb8277b0cfe238cc2e1e980.tar.gz
android_packages_apps_Trebuchet-462b5cca7bb1d5e24fb8277b0cfe238cc2e1e980.tar.bz2
android_packages_apps_Trebuchet-462b5cca7bb1d5e24fb8277b0cfe238cc2e1e980.zip
Extract color for the hotseat.
- Only considers the bottom fourth of the wallpaper - Is translucent black or white depending on how dark/light the wallpaper is - Hotseat extends behind the nav bar Bug: 27230217 Change-Id: Id4ea6ee91b4dd221b4c277d22d5041cab178801d
Diffstat (limited to 'src/com/android/launcher3/Hotseat.java')
-rw-r--r--src/com/android/launcher3/Hotseat.java59
1 files changed, 58 insertions, 1 deletions
diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java
index bb70be697..7e1ecf5af 100644
--- a/src/com/android/launcher3/Hotseat.java
+++ b/src/com/android/launcher3/Hotseat.java
@@ -16,8 +16,12 @@
package com.android.launcher3;
+import android.animation.ArgbEvaluator;
+import android.animation.ValueAnimator;
import android.content.Context;
+import android.graphics.Color;
import android.graphics.Rect;
+import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
@@ -27,12 +31,13 @@ import android.view.ViewDebug;
import android.widget.FrameLayout;
import android.widget.TextView;
+import com.android.launcher3.dynamicui.ExtractedColors;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
public class Hotseat extends FrameLayout
- implements UserEventDispatcher.LaunchSourceProvider{
+ implements UserEventDispatcher.LaunchSourceProvider, Insettable {
private CellLayout mContent;
@@ -44,6 +49,14 @@ public class Hotseat extends FrameLayout
@ViewDebug.ExportedProperty(category = "launcher")
private final boolean mHasVerticalHotseat;
+ @ViewDebug.ExportedProperty(category = "launcher")
+ private Rect mInsets = new Rect();
+
+ @ViewDebug.ExportedProperty(category = "launcher")
+ private int mBackgroundColor;
+ @ViewDebug.ExportedProperty(category = "launcher")
+ private ColorDrawable mBackground;
+
public Hotseat(Context context) {
this(context, null);
}
@@ -56,6 +69,8 @@ public class Hotseat extends FrameLayout
super(context, attrs, defStyle);
mLauncher = (Launcher) context;
mHasVerticalHotseat = mLauncher.getDeviceProfile().isVerticalBarLayout();
+ mBackground = new ColorDrawable();
+ setBackground(mBackground);
}
public CellLayout getLayout() {
@@ -166,4 +181,46 @@ public class Hotseat extends FrameLayout
target.gridY = info.cellY;
targetParent.containerType = LauncherLogProto.HOTSEAT;
}
+
+ //Overridden so that the background color extends behind the navigation buttons.
+ @Override
+ public void setInsets(Rect insets) {
+ int rightInset = insets.right - mInsets.right;
+ int bottomInset = insets.bottom - mInsets.bottom;
+ mInsets.set(insets);
+ LayoutParams lp = (LayoutParams) getLayoutParams();
+ if (mHasVerticalHotseat) {
+ setPadding(getPaddingLeft(), getPaddingTop(),
+ getPaddingRight() + rightInset, getPaddingBottom());
+ if (lp.width != LayoutParams.MATCH_PARENT && lp.width != LayoutParams.WRAP_CONTENT) {
+ lp.width += rightInset;
+ }
+ } else {
+ setPadding(getPaddingLeft(), getPaddingTop(), getPaddingRight(),
+ getPaddingBottom() + bottomInset);
+ if (lp.height != LayoutParams.MATCH_PARENT && lp.height != LayoutParams.WRAP_CONTENT) {
+ lp.height += bottomInset;
+ }
+ }
+ }
+
+ public void updateColor(ExtractedColors extractedColors, boolean animate) {
+ if (!mHasVerticalHotseat) {
+ int color = extractedColors.getColor(ExtractedColors.HOTSEAT_INDEX, Color.TRANSPARENT);
+ if (!animate) {
+ setBackgroundColor(color);
+ } else {
+ ValueAnimator animator = ValueAnimator.ofInt(mBackgroundColor, color);
+ animator.setEvaluator(new ArgbEvaluator());
+ animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ mBackground.setColor((Integer) animation.getAnimatedValue());
+ }
+ });
+ animator.start();
+ }
+ mBackgroundColor = color;
+ }
+ }
}