summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-05-03 01:46:01 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-03 01:46:01 +0000
commit56c4370eeef577d71747fde43f9db4f1914c2776 (patch)
tree73aa282da9ecd33abbecbdaab9941766457d71d2 /packages/SystemUI
parentb66ef989d6fcf9122ec98a5bc88930c398b54c2d (diff)
parent7e78b8d3dbacac82bbacffde065a5c0863f1b791 (diff)
downloadframeworks_base-56c4370eeef577d71747fde43f9db4f1914c2776.zip
frameworks_base-56c4370eeef577d71747fde43f9db4f1914c2776.tar.gz
frameworks_base-56c4370eeef577d71747fde43f9db4f1914c2776.tar.bz2
am ee9b42a9: Merge "Incorporating theme colors into task views."
* commit 'ee9b42a9a330b3225182761c542a095801835354': Incorporating theme colors into task views.
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/layout/recents_task_view.xml2
-rw-r--r--packages/SystemUI/res/values/config.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Constants.java1
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java17
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Utilities.java16
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/Task.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java13
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java17
11 files changed, 85 insertions, 29 deletions
diff --git a/packages/SystemUI/res/layout/recents_task_view.xml b/packages/SystemUI/res/layout/recents_task_view.xml
index ddc0dbf..f7df18eb 100644
--- a/packages/SystemUI/res/layout/recents_task_view.xml
+++ b/packages/SystemUI/res/layout/recents_task_view.xml
@@ -58,7 +58,7 @@
android:textSize="22sp"
android:textColor="#ffffffff"
android:text="@string/recents_empty_message"
- android:fontFamily="sans-serif-thin"
+ android:fontFamily="sans-serif-light"
android:singleLine="true"
android:maxLines="2"
android:ellipsize="marquee"
diff --git a/packages/SystemUI/res/values/config.xml b/packages/SystemUI/res/values/config.xml
index 722ca15..024f1eb 100644
--- a/packages/SystemUI/res/values/config.xml
+++ b/packages/SystemUI/res/values/config.xml
@@ -115,8 +115,10 @@
<integer name="recents_filter_animate_current_views_min_duration">175</integer>
<!-- The min animation duration for animating views that are newly visible. -->
<integer name="recents_filter_animate_new_views_min_duration">125</integer>
- <!-- The min animation duration for animating views that are newly visible. -->
+ <!-- The min animation duration for animating the task bar in. -->
<integer name="recents_animate_task_bar_enter_duration">200</integer>
+ <!-- The min animation duration for animating the task bar out. -->
+ <integer name="recents_animate_task_bar_exit_duration">150</integer>
<!-- The animation duration for animating in the info pane. -->
<integer name="recents_animate_task_view_info_pane_duration">150</integer>
<!-- The minimum alpha for the dim applied to cards that go deeper into the stack. -->
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Constants.java b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
index a996c1a..9b0150e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Constants.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Constants.java
@@ -28,6 +28,7 @@ public class Constants {
public static class App {
public static final boolean EnableTaskFiltering = false;
public static final boolean EnableTaskStackClipping = false;
+ public static final boolean EnableTaskBarThemeColors = true;
public static final boolean EnableInfoPane = true;
public static final boolean EnableSearchButton = false;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index d54df13..aac0bd5 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -40,6 +40,7 @@ public class RecentsConfiguration {
public int filteringCurrentViewsMinAnimDuration;
public int filteringNewViewsMinAnimDuration;
public int taskBarEnterAnimDuration;
+ public int taskBarExitAnimDuration;
public int taskStackScrollDismissInfoPaneDistance;
public int taskStackMaxDim;
public int taskViewInfoPaneAnimDuration;
@@ -47,6 +48,11 @@ public class RecentsConfiguration {
public int searchBarSpaceHeightPx;
public int searchBarSpaceEdgeMarginsPx;
+ public int taskBarViewDefaultBackgroundColor;
+ public int taskBarViewDefaultTextColor;
+ public int taskBarViewLightTextColor;
+ public int taskBarViewDarkTextColor;
+
public boolean launchedWithThumbnailAnimation;
/** Private constructor */
@@ -87,6 +93,8 @@ public class RecentsConfiguration {
res.getInteger(R.integer.recents_filter_animate_new_views_min_duration);
taskBarEnterAnimDuration =
res.getInteger(R.integer.recents_animate_task_bar_enter_duration);
+ taskBarExitAnimDuration =
+ res.getInteger(R.integer.recents_animate_task_bar_exit_duration);
taskStackScrollDismissInfoPaneDistance = res.getDimensionPixelSize(
R.dimen.recents_task_stack_scroll_dismiss_info_pane_distance);
taskStackMaxDim = res.getInteger(R.integer.recents_max_task_stack_view_dim);
@@ -97,6 +105,15 @@ public class RecentsConfiguration {
searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height);
searchBarSpaceEdgeMarginsPx =
res.getDimensionPixelSize(R.dimen.recents_search_bar_space_edge_margins);
+
+ taskBarViewDefaultBackgroundColor =
+ res.getColor(R.color.recents_task_bar_default_background_color);
+ taskBarViewDefaultTextColor =
+ res.getColor(R.color.recents_task_bar_default_text_color);
+ taskBarViewLightTextColor =
+ res.getColor(R.color.recents_task_bar_light_text_color);
+ taskBarViewDarkTextColor =
+ res.getColor(R.color.recents_task_bar_dark_text_color);
}
/** Updates the system insets */
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
index 52bba4a..4a19027 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
@@ -415,17 +415,23 @@ public class RecentsTaskLoader {
ActivityInfo info = ssp.getActivityInfo(t.baseIntent.getComponent(), t.userId);
if (info == null) continue;
- String activityLabel = (t.activityLabel == null ? ssp.getActivityLabel(info) :
- t.activityLabel.toString());
+ ActivityManager.RecentsActivityValues av = t.activityValues;
+ String activityLabel = null;
BitmapDrawable activityIcon = null;
- if (t.activityIcon != null) {
- activityIcon = new BitmapDrawable(res, t.activityIcon);
+ int activityColor = 0;
+ if (av != null) {
+ activityLabel = (av.label != null ? av.label.toString() :
+ ssp.getActivityLabel(info));
+ activityIcon = (av.icon != null) ? new BitmapDrawable(res, av.icon) : null;
+ activityColor = av.colorPrimary;
+ } else {
+ activityLabel = ssp.getActivityLabel(info);
}
boolean isForemostTask = (i == (taskCount - 1));
// Create a new task
Task task = new Task(t.persistentId, (t.id > -1), t.baseIntent, activityLabel,
- activityIcon, t.userId);
+ activityIcon, activityColor, t.userId);
// Preload the specified number of apps
if (i >= (taskCount - preloadCount)) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
index 33ac0a8..a8bf2fb 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
@@ -20,7 +20,6 @@ import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.AppGlobals;
import android.app.SearchManager;
-import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -35,8 +34,6 @@ import android.os.Bundle;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
-import android.text.TextUtils;
-import android.util.Log;
import java.util.ArrayList;
import java.util.List;
@@ -91,10 +88,13 @@ public class SystemServicesProxy {
rti.id = rti.persistentId = i;
rti.baseIntent = new Intent();
rti.baseIntent.setComponent(cn);
- rti.description = rti.activityLabel = "" + i + " - " +
+ rti.activityValues = new ActivityManager.RecentsActivityValues();
+ rti.description = "" + i + " - " +
Long.toString(Math.abs(new Random().nextLong()), 36);
if (i % 2 == 0) {
- rti.activityIcon = Bitmap.createBitmap(mDummyIcon);
+ rti.activityValues.label = rti.description;
+ rti.activityValues.icon = Bitmap.createBitmap(mDummyIcon);
+ rti.activityValues.colorPrimary = new Random().nextInt();
}
tasks.add(rti);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Utilities.java b/packages/SystemUI/src/com/android/systemui/recents/Utilities.java
index 4a1b3b2..b602f84 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Utilities.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Utilities.java
@@ -16,6 +16,7 @@
package com.android.systemui.recents;
+import android.graphics.Color;
import android.graphics.Rect;
/* Common code */
@@ -46,4 +47,19 @@ public class Utilities {
r.offset(cx, cy);
}
}
+
+ /** Calculates the luminance-preserved greyscale of a given color. */
+ private static int colorToGreyscale(int color) {
+ return Math.round(0.2126f * Color.red(color) + 0.7152f * Color.green(color) +
+ 0.0722f * Color.blue(color));
+ }
+
+ /** Returns the ideal text color to draw on top of a specified background color. */
+ public static int getIdealTextColorForBackgroundColor(int color) {
+ RecentsConfiguration configuration = RecentsConfiguration.getInstance();
+ int greyscale = colorToGreyscale(color);
+ return (greyscale < 128) ? configuration.taskBarViewLightTextColor :
+ configuration.taskBarViewDarkTextColor;
+
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
index 1566a49..47a506c 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
@@ -72,6 +72,7 @@ public class Task {
public Drawable applicationIcon;
public Drawable activityIcon;
public String activityLabel;
+ public int colorPrimary;
public Bitmap thumbnail;
public boolean isActive;
public int userId;
@@ -83,10 +84,11 @@ public class Task {
}
public Task(int id, boolean isActive, Intent intent, String activityTitle,
- BitmapDrawable activityIcon, int userId) {
+ BitmapDrawable activityIcon, int colorPrimary, int userId) {
this.key = new TaskKey(id, intent, userId);
this.activityLabel = activityTitle;
this.activityIcon = activityIcon;
+ this.colorPrimary = colorPrimary;
this.isActive = isActive;
this.userId = userId;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java
index 124f11e..c6cb812 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java
@@ -18,11 +18,13 @@ package com.android.systemui.recents.views;
import android.content.Context;
import android.util.AttributeSet;
-import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.systemui.R;
+import com.android.systemui.recents.Constants;
+import com.android.systemui.recents.RecentsConfiguration;
+import com.android.systemui.recents.Utilities;
import com.android.systemui.recents.model.Task;
@@ -58,6 +60,7 @@ class TaskBarView extends FrameLayout {
/** Binds the bar view to the task */
void rebindToTask(Task t, boolean animate) {
+ RecentsConfiguration configuration = RecentsConfiguration.getInstance();
mTask = t;
// If an activity icon is defined, then we use that as the primary icon to show in the bar,
// otherwise, we fall back to the application icon
@@ -67,6 +70,15 @@ class TaskBarView extends FrameLayout {
mApplicationIcon.setImageDrawable(t.applicationIcon);
}
mActivityDescription.setText(t.activityLabel);
+ // Try and apply the system ui tint
+ int tint = t.colorPrimary;
+ if (Constants.DebugFlags.App.EnableTaskBarThemeColors && tint != 0) {
+ setBackgroundColor(tint);
+ mActivityDescription.setTextColor(Utilities.getIdealTextColorForBackgroundColor(tint));
+ } else {
+ setBackgroundColor(configuration.taskBarViewDefaultBackgroundColor);
+ mActivityDescription.setTextColor(configuration.taskBarViewDefaultTextColor);
+ }
if (animate) {
// XXX: Investigate how expensive it will be to create a second bitmap and crossfade
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java
index a81d01c..983ad49 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskInfoView.java
@@ -29,7 +29,10 @@ import android.widget.Button;
import android.widget.FrameLayout;
import com.android.systemui.R;
import com.android.systemui.recents.BakedBezierInterpolator;
+import com.android.systemui.recents.Constants;
+import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.Utilities;
+import com.android.systemui.recents.model.Task;
/* The task info view */
@@ -143,6 +146,16 @@ class TaskInfoView extends FrameLayout {
.start();
}
+ /** Binds the info view to the task */
+ void rebindToTask(Task t, boolean animate) {
+ RecentsConfiguration configuration = RecentsConfiguration.getInstance();
+ if (Constants.DebugFlags.App.EnableTaskBarThemeColors && t.colorPrimary != 0) {
+ setBackgroundColor(t.colorPrimary);
+ } else {
+ setBackgroundColor(configuration.taskBarViewDefaultBackgroundColor);
+ }
+ }
+
@Override
public void draw(Canvas canvas) {
int saveCount = 0;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index d3b79d6..ecd0c45 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -197,18 +197,9 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
/** Animates this task view as it enters recents */
public void animateOnEnterRecents() {
RecentsConfiguration config = RecentsConfiguration.getInstance();
- int translate = config.pxFromDp(10);
- mBarView.setScaleX(1.25f);
- mBarView.setScaleY(1.25f);
mBarView.setAlpha(0f);
- mBarView.setTranslationX(translate / 2);
- mBarView.setTranslationY(-translate);
mBarView.animate()
.alpha(1f)
- .scaleX(1f)
- .scaleY(1f)
- .translationX(0)
- .translationY(0)
.setStartDelay(235)
.setInterpolator(BakedBezierInterpolator.INSTANCE)
.setDuration(config.taskBarEnterAnimDuration)
@@ -219,16 +210,11 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
/** Animates this task view as it exits recents */
public void animateOnLeavingRecents(final Runnable r) {
RecentsConfiguration config = RecentsConfiguration.getInstance();
- int translate = config.pxFromDp(10);
mBarView.animate()
.alpha(0f)
- .scaleX(1.1f)
- .scaleY(1.1f)
- .translationX(translate / 2)
- .translationY(-translate)
.setStartDelay(0)
.setInterpolator(BakedBezierInterpolator.INSTANCE)
- .setDuration(Utilities.calculateTranslationAnimationDuration(translate))
+ .setDuration(config.taskBarExitAnimDuration)
.withLayer()
.withEndAction(new Runnable() {
@Override
@@ -352,6 +338,7 @@ public class TaskView extends FrameLayout implements View.OnClickListener,
// Bind each of the views to the new task data
mThumbnailView.rebindToTask(mTask, reloadingTaskData);
mBarView.rebindToTask(mTask, reloadingTaskData);
+ mInfoView.rebindToTask(mTask, reloadingTaskData);
// Rebind any listeners
mBarView.mApplicationIcon.setOnClickListener(this);
mInfoView.mAppInfoButton.setOnClickListener(this);