summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-08-06 17:08:00 -0700
committerWinson Chung <winsonc@google.com>2014-08-07 17:57:25 +0000
commitec396d6399c5c31d697d81e94aff459e9771b0c6 (patch)
tree64dcf5b50fb9071079a2c7880a83863a370ba582 /packages
parent256e1a62673472d685232d88ad4d067eb82deeac (diff)
downloadframeworks_base-ec396d6399c5c31d697d81e94aff459e9771b0c6.zip
frameworks_base-ec396d6399c5c31d697d81e94aff459e9771b0c6.tar.gz
frameworks_base-ec396d6399c5c31d697d81e94aff459e9771b0c6.tar.bz2
Initial changes to add task affiliation styling. (Bug 16656169)
- Fixing issue with launch-in-background animation
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/res/layout/recents_task_view.xml6
-rw-r--r--packages/SystemUI/res/values/dimens.xml3
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java15
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/Task.java12
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskViewFooter.java (renamed from packages/SystemUI/src/com/android/systemui/recents/views/TaskFooterView.java)10
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java (renamed from packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java)11
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java (renamed from packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java)10
11 files changed, 77 insertions, 42 deletions
diff --git a/packages/SystemUI/res/layout/recents_task_view.xml b/packages/SystemUI/res/layout/recents_task_view.xml
index f8dfd65..4a5fffe 100644
--- a/packages/SystemUI/res/layout/recents_task_view.xml
+++ b/packages/SystemUI/res/layout/recents_task_view.xml
@@ -18,11 +18,11 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true">
- <com.android.systemui.recents.views.TaskThumbnailView
+ <com.android.systemui.recents.views.TaskViewThumbnail
android:id="@+id/task_view_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent" />
- <com.android.systemui.recents.views.TaskBarView
+ <com.android.systemui.recents.views.TaskViewHeader
android:id="@+id/task_view_bar"
android:layout_width="match_parent"
android:layout_height="@dimen/recents_task_bar_height"
@@ -61,7 +61,7 @@
android:background="@drawable/recents_button_bg"
android:visibility="invisible"
android:src="@drawable/recents_dismiss_light" />
- </com.android.systemui.recents.views.TaskBarView>
+ </com.android.systemui.recents.views.TaskViewHeader>
<FrameLayout
android:id="@+id/lock_to_app_fab"
android:layout_width="48dp"
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml
index 11a8063..4a4fa41 100644
--- a/packages/SystemUI/res/values/dimens.xml
+++ b/packages/SystemUI/res/values/dimens.xml
@@ -237,6 +237,9 @@
in dps over one second of time. -->
<dimen name="recents_animation_movement_in_dps_per_second">800dp</dimen>
+ <!-- The min alpha to apply to a task affiliation group color. -->
+ <item name="recents_task_affiliation_color_min_alpha_percentage" format="float" type="dimen">0.6</item>
+
<!-- Space reserved for the cards behind the top card in the top stack -->
<dimen name="top_stack_peek_amount">12dp</dimen>
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index cf0a1dc..980a4ae 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -86,6 +86,7 @@ public class RecentsConfiguration {
public int taskBarViewLightTextColor;
public int taskBarViewDarkTextColor;
public int taskBarViewHighlightColor;
+ public float taskBarViewAffiliationColorMinAlpha;
/** Task bar size & animations */
public int taskBarHeight;
@@ -221,6 +222,9 @@ public class RecentsConfiguration {
res.getColor(R.color.recents_task_bar_dark_text_color);
taskBarViewHighlightColor =
res.getColor(R.color.recents_task_bar_highlight_color);
+ TypedValue affMinAlphaPctValue = new TypedValue();
+ res.getValue(R.dimen.recents_task_affiliation_color_min_alpha_percentage, affMinAlphaPctValue, true);
+ taskBarViewAffiliationColorMinAlpha = affMinAlphaPctValue.getFloat();
// Task bar size & animations
taskBarHeight = res.getDimensionPixelSize(R.dimen.recents_task_bar_height);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
index f30e22a..8716184 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -339,8 +339,9 @@ public class RecentsTaskLoader {
// Create a new task
Task task = new Task(t.persistentId, (t.id > -1), t.baseIntent, t.affiliatedTaskId,
- activityLabel, activityIcon, activityColor, t.userId, t.firstActiveTime,
- t.lastActiveTime, (i == (taskCount - 1)), config.lockToAppEnabled);
+ t.affiliatedTaskColor, activityLabel, activityIcon, activityColor, t.userId,
+ t.firstActiveTime, t.lastActiveTime, (i == (taskCount - 1)),
+ config.lockToAppEnabled);
// Preload the specified number of apps
if (i >= (taskCount - preloadCount)) {
@@ -381,7 +382,7 @@ public class RecentsTaskLoader {
}
// Simulate the groupings that we describe
- stack.createAffiliatedGroupings();
+ stack.createAffiliatedGroupings(config);
// Start the task loader and add all the tasks we need to load
mLoader.start(context);
@@ -405,11 +406,11 @@ public class RecentsTaskLoader {
ActivityInfo info = ssp.getActivityInfo(t.baseIntent.getComponent(), t.userId);
if (info == null) continue;
- stack.addTask(new Task(t.persistentId, true, t.baseIntent, t.affiliatedTaskId, null,
- null, 0, 0, t.firstActiveTime, t.lastActiveTime, (i == (taskCount - 1)),
- config.lockToAppEnabled));
+ stack.addTask(new Task(t.persistentId, true, t.baseIntent, t.affiliatedTaskId,
+ t.affiliatedTaskColor, null, null, 0, 0, t.firstActiveTime, t.lastActiveTime,
+ (i == (taskCount - 1)), config.lockToAppEnabled));
}
- stack.createAffiliatedGroupings();
+ stack.createAffiliatedGroupings(config);
return stack;
}
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 41874fc..f6c3a7e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
@@ -77,6 +77,7 @@ public class Task {
public TaskKey key;
public TaskGrouping group;
public int taskAffiliation;
+ public int taskAffiliationColor;
public boolean isLaunchTarget;
public Drawable applicationIcon;
public Drawable activityIcon;
@@ -95,16 +96,19 @@ public class Task {
// Only used by RecentsService for task rect calculations.
}
- public Task(int id, boolean isActive, Intent intent, int taskAffiliation, String activityTitle,
- Drawable activityIcon, int colorPrimary, int userId,
+ public Task(int id, boolean isActive, Intent intent, int taskAffiliation, int taskAffiliationColor,
+ String activityTitle, Drawable activityIcon, int colorPrimary, int userId,
long firstActiveTime, long lastActiveTime, boolean lockToThisTask,
boolean lockToTaskEnabled) {
+ boolean isInAffiliationGroup = (taskAffiliation != id);
+ boolean hasAffiliationGroupColor = isInAffiliationGroup && (taskAffiliationColor != 0);
this.key = new TaskKey(id, intent, userId, firstActiveTime, lastActiveTime);
this.taskAffiliation = taskAffiliation;
+ this.taskAffiliationColor = taskAffiliationColor;
this.activityLabel = activityTitle;
this.activityIcon = activityIcon;
- this.colorPrimary = colorPrimary;
- this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(colorPrimary,
+ this.colorPrimary = hasAffiliationGroupColor ? taskAffiliationColor : colorPrimary;
+ this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(this.colorPrimary,
Color.WHITE) > 3f;
this.isActive = isActive;
this.lockToThisTask = lockToTaskEnabled && lockToThisTask;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
index fd6303f..435eb42 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -16,7 +16,9 @@
package com.android.systemui.recents.model;
+import android.graphics.Color;
import com.android.systemui.recents.Constants;
+import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.NamedCounter;
import java.util.ArrayList;
@@ -320,7 +322,7 @@ public class TaskStack {
/**
* Temporary: This method will simulate affiliation groups by
*/
- public void createAffiliatedGroupings() {
+ public void createAffiliatedGroupings(RecentsConfiguration config) {
if (Constants.DebugFlags.App.EnableSimulatedTaskGroups) {
HashMap<Task.TaskKey, Task> taskMap = new HashMap<Task.TaskKey, Task>();
// Sort all tasks by increasing firstActiveTime of the task
@@ -387,6 +389,7 @@ public class TaskStack {
mTaskList.set(tasks);
} else {
// Create the task groups
+ HashMap<Task.TaskKey, Task> tasksMap = new HashMap<Task.TaskKey, Task>();
ArrayList<Task> tasks = mTaskList.getTasks();
int taskCount = tasks.size();
for (int i = 0; i < taskCount; i++) {
@@ -401,6 +404,28 @@ public class TaskStack {
addGroup(group);
}
group.addTask(t);
+ tasksMap.put(t.key, t);
+ }
+ // Update the task colors for each of the groups
+ float minAlpha = config.taskBarViewAffiliationColorMinAlpha;
+ int taskGroupCount = mGroups.size();
+ for (int i = 0; i < taskGroupCount; i++) {
+ TaskGrouping group = mGroups.get(i);
+ taskCount = group.getTaskCount();
+ // Ignore the groups that only have one task
+ if (taskCount <= 1) continue;
+ // Calculate the group color distribution
+ int affiliationColor = tasksMap.get(group.mTaskKeys.get(0)).taskAffiliationColor;
+ float alphaStep = (1f - minAlpha) / taskCount;
+ float alpha = 1f;
+ for (int j = 0; j < taskCount; j++) {
+ Task t = tasksMap.get(group.mTaskKeys.get(j));
+ t.colorPrimary = Color.rgb(
+ (int) (alpha * Color.red(affiliationColor) + (1f - alpha) * 0xFF),
+ (int) (alpha * Color.green(affiliationColor) + (1f - alpha) * 0xFF),
+ (int) (alpha * Color.blue(affiliationColor) + (1f - alpha) * 0xFF));
+ alpha -= alphaStep;
+ }
}
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
index 57f1274..9e7dbf4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java
@@ -330,7 +330,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
// We can reuse the current task transforms to find the task rects
TaskViewTransform transform = mCurrentTaskTransforms.get(mStack.indexOfTask(tv.getTask()));
TaskViewTransform nextTransform = mCurrentTaskTransforms.get(mStack.indexOfTask(nextTv.getTask()));
- clipBottom = transform.rect.bottom - nextTransform.rect.top - 200;
+ clipBottom = transform.rect.bottom - nextTransform.rect.top;
}
}
tv.getViewBounds().setClipBottom(clipBottom);
@@ -430,9 +430,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
public void computeScroll() {
mStackScroller.computeScroll();
// Synchronize the views
- if (synchronizeStackViewsWithModel()) {
- clipTaskViews();
- }
+ synchronizeStackViewsWithModel();
+ clipTaskViews();
}
/** Computes the stack and task rects */
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 abf3c50..3b9bcc4 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -39,7 +39,7 @@ import com.android.systemui.recents.model.Task;
/* A task view */
public class TaskView extends FrameLayout implements Task.TaskCallbacks,
- TaskFooterView.TaskFooterViewCallbacks, View.OnClickListener, View.OnLongClickListener {
+ TaskViewFooter.TaskFooterViewCallbacks, View.OnClickListener, View.OnLongClickListener {
/** The TaskView callbacks */
interface TaskViewCallbacks {
public void onTaskViewAppIconClicked(TaskView tv);
@@ -67,9 +67,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
AnimateableViewBounds mViewBounds;
Paint mLayerPaint = new Paint();
- TaskThumbnailView mThumbnailView;
- TaskBarView mBarView;
- TaskFooterView mFooterView;
+ TaskViewThumbnail mThumbnailView;
+ TaskViewHeader mBarView;
+ TaskViewFooter mFooterView;
View mActionButtonView;
TaskViewCallbacks mCb;
@@ -124,8 +124,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
@Override
protected void onFinishInflate() {
// Bind the views
- mBarView = (TaskBarView) findViewById(R.id.task_view_bar);
- mThumbnailView = (TaskThumbnailView) findViewById(R.id.task_view_thumbnail);
+ mBarView = (TaskViewHeader) findViewById(R.id.task_view_bar);
+ mThumbnailView = (TaskViewThumbnail) findViewById(R.id.task_view_thumbnail);
mActionButtonView = findViewById(R.id.lock_to_app_fab);
if (mFooterView != null) {
mFooterView.setCallbacks(this);
@@ -712,7 +712,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks,
setOnClickListener(enabled ? this : null);
}
- /**** TaskFooterView.TaskFooterViewCallbacks ****/
+ /**** TaskViewFooter.TaskFooterViewCallbacks ****/
@Override
public void onTaskFooterHeightChanged(int height, int maxHeight) {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskFooterView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewFooter.java
index 881bbcf..324169e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskFooterView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewFooter.java
@@ -24,7 +24,7 @@ import com.android.systemui.recents.RecentsConfiguration;
/** The task footer view */
-public class TaskFooterView extends FrameLayout {
+public class TaskViewFooter extends FrameLayout {
interface TaskFooterViewCallbacks {
public void onTaskFooterHeightChanged(int height, int maxHeight);
@@ -37,19 +37,19 @@ public class TaskFooterView extends FrameLayout {
int mMaxFooterHeight;
ObjectAnimator mFooterAnimator;
- public TaskFooterView(Context context) {
+ public TaskViewFooter(Context context) {
this(context, null);
}
- public TaskFooterView(Context context, AttributeSet attrs) {
+ public TaskViewFooter(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskFooterView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskViewFooter(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
- public TaskFooterView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public TaskViewFooter(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mConfig = RecentsConfiguration.getInstance();
mMaxFooterHeight = mConfig.taskViewLockToAppButtonHeight;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
index 90bf12f..03fc16e 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java
@@ -28,7 +28,6 @@ import android.graphics.drawable.RippleDrawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
-import android.view.ViewPropertyAnimator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
@@ -39,7 +38,7 @@ import com.android.systemui.recents.model.Task;
/* The task bar view */
-class TaskBarView extends FrameLayout {
+class TaskViewHeader extends FrameLayout {
RecentsConfiguration mConfig;
@@ -54,19 +53,19 @@ class TaskBarView extends FrameLayout {
static Paint sHighlightPaint;
- public TaskBarView(Context context) {
+ public TaskViewHeader(Context context) {
this(context, null);
}
- public TaskBarView(Context context, AttributeSet attrs) {
+ public TaskViewHeader(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskBarView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskViewHeader(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
- public TaskBarView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public TaskViewHeader(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
mConfig = RecentsConfiguration.getInstance();
setWillNotDraw(false);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java
index 1116d51..f836aa3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskThumbnailView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskViewThumbnail.java
@@ -25,24 +25,24 @@ import com.android.systemui.recents.model.Task;
/** The task thumbnail view */
-public class TaskThumbnailView extends FixedSizeImageView {
+public class TaskViewThumbnail extends FixedSizeImageView {
// Task bar clipping
Rect mClipRect = new Rect();
- public TaskThumbnailView(Context context) {
+ public TaskViewThumbnail(Context context) {
this(context, null);
}
- public TaskThumbnailView(Context context, AttributeSet attrs) {
+ public TaskViewThumbnail(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
- public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr) {
+ public TaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
- public TaskThumbnailView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
+ public TaskViewThumbnail(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
setScaleType(ScaleType.FIT_XY);
}