Merge "Adding start delay to the task view transforms."
This commit is contained in:
@@ -46,9 +46,7 @@
|
||||
<color name="keyguard_overflow_content_color">#ff686868</color>
|
||||
|
||||
<!-- The default recents task bar background color. -->
|
||||
<color name="recents_task_bar_default_background_color">#e6444444</color>
|
||||
<!-- The default recents task bar text color. -->
|
||||
<color name="recents_task_bar_default_text_color">#ffeeeeee</color>
|
||||
<color name="recents_task_bar_default_background_color">#ffe6e6e6</color>
|
||||
<!-- The recents task bar light text color to be drawn on top of dark backgrounds. -->
|
||||
<color name="recents_task_bar_light_text_color">#ffeeeeee</color>
|
||||
<!-- The recents task bar dark text color to be drawn on top of light backgrounds. -->
|
||||
|
||||
@@ -81,7 +81,6 @@ public class RecentsConfiguration {
|
||||
|
||||
/** Task bar colors */
|
||||
public int taskBarViewDefaultBackgroundColor;
|
||||
public int taskBarViewDefaultTextColor;
|
||||
public int taskBarViewLightTextColor;
|
||||
public int taskBarViewDarkTextColor;
|
||||
public int taskBarViewHighlightColor;
|
||||
@@ -202,8 +201,6 @@ public class RecentsConfiguration {
|
||||
// Task bar colors
|
||||
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 =
|
||||
|
||||
@@ -151,16 +151,14 @@ class TaskBarView extends FrameLayout {
|
||||
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.getIdealColorForBackgroundColor(tint,
|
||||
mConfig.taskBarViewLightTextColor, mConfig.taskBarViewDarkTextColor));
|
||||
mDismissButton.setImageDrawable(Utilities.getIdealResourceForBackgroundColor(tint,
|
||||
mLightDismissDrawable, mDarkDismissDrawable));
|
||||
} else {
|
||||
setBackgroundColor(mConfig.taskBarViewDefaultBackgroundColor);
|
||||
mActivityDescription.setTextColor(mConfig.taskBarViewDefaultTextColor);
|
||||
if (!Constants.DebugFlags.App.EnableTaskBarThemeColors || tint == 0) {
|
||||
tint = mConfig.taskBarViewDefaultBackgroundColor;
|
||||
}
|
||||
setBackgroundColor(tint);
|
||||
mActivityDescription.setTextColor(Utilities.getIdealColorForBackgroundColor(tint,
|
||||
mConfig.taskBarViewLightTextColor, mConfig.taskBarViewDarkTextColor));
|
||||
mDismissButton.setImageDrawable(Utilities.getIdealResourceForBackgroundColor(tint,
|
||||
mLightDismissDrawable, mDarkDismissDrawable));
|
||||
}
|
||||
|
||||
/** Unbinds the bar view from the task */
|
||||
|
||||
@@ -973,7 +973,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
int getExitTransformsForFilterAnimation(ArrayList<Task> curTasks,
|
||||
ArrayList<TaskViewTransform> curTaskTransforms,
|
||||
ArrayList<Task> tasks, ArrayList<TaskViewTransform> taskTransforms,
|
||||
HashMap<TaskView, Pair<Integer, TaskViewTransform>> childViewTransformsOut,
|
||||
HashMap<TaskView, TaskViewTransform> childViewTransformsOut,
|
||||
ArrayList<TaskView> childrenToRemoveOut) {
|
||||
// Animate all of the existing views out of view (if they are not in the visible range in
|
||||
// the new stack) or to their final positions in the new stack
|
||||
@@ -1003,9 +1003,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
(int) tv.getTranslationY()));
|
||||
}
|
||||
|
||||
int startDelay = offset *
|
||||
Constants.Values.TaskStackView.FilterStartDelay;
|
||||
childViewTransformsOut.put(tv, new Pair(startDelay, toTransform));
|
||||
toTransform.startDelay = offset * Constants.Values.TaskStackView.FilterStartDelay;
|
||||
childViewTransformsOut.put(tv, toTransform);
|
||||
offset++;
|
||||
}
|
||||
return mConfig.filteringCurrentViewsAnimDuration;
|
||||
@@ -1017,7 +1016,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
*/
|
||||
int getEnterTransformsForFilterAnimation(ArrayList<Task> tasks,
|
||||
ArrayList<TaskViewTransform> taskTransforms,
|
||||
HashMap<TaskView, Pair<Integer, TaskViewTransform>> childViewTransformsOut) {
|
||||
HashMap<TaskView, TaskViewTransform> childViewTransformsOut) {
|
||||
int offset = 0;
|
||||
int movement = 0;
|
||||
int taskCount = tasks.size();
|
||||
@@ -1035,9 +1034,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
tv.prepareTaskTransformForFilterTaskHidden(fromTransform);
|
||||
tv.updateViewPropertiesToTaskTransform(fromTransform, 0);
|
||||
|
||||
int startDelay = offset *
|
||||
Constants.Values.TaskStackView.FilterStartDelay;
|
||||
childViewTransformsOut.put(tv, new Pair(startDelay, toTransform));
|
||||
toTransform.startDelay = offset * Constants.Values.TaskStackView.FilterStartDelay;
|
||||
childViewTransformsOut.put(tv, toTransform);
|
||||
|
||||
// Use the movement of the new views to calculate the duration of the animation
|
||||
movement = Math.max(movement,
|
||||
@@ -1057,8 +1055,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
// Calculate the transforms to animate out all the existing views if they are not in the
|
||||
// new visible range (or to their final positions in the stack if they are)
|
||||
final ArrayList<TaskView> childrenToRemove = new ArrayList<TaskView>();
|
||||
final HashMap<TaskView, Pair<Integer, TaskViewTransform>> childViewTransforms =
|
||||
new HashMap<TaskView, Pair<Integer, TaskViewTransform>>();
|
||||
final HashMap<TaskView, TaskViewTransform> childViewTransforms =
|
||||
new HashMap<TaskView, TaskViewTransform>();
|
||||
int duration = getExitTransformsForFilterAnimation(curTasks, curTaskTransforms, tasks,
|
||||
taskTransforms, childViewTransforms, childrenToRemove);
|
||||
|
||||
@@ -1073,10 +1071,9 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
|
||||
// Animate all the views to their final transforms
|
||||
for (final TaskView tv : childViewTransforms.keySet()) {
|
||||
Pair<Integer, TaskViewTransform> t = childViewTransforms.get(tv);
|
||||
TaskViewTransform t = childViewTransforms.get(tv);
|
||||
tv.animate().cancel();
|
||||
tv.animate()
|
||||
.setStartDelay(t.first)
|
||||
.withEndAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -1093,15 +1090,14 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
int duration = getEnterTransformsForFilterAnimation(tasks,
|
||||
taskTransforms, childViewTransforms);
|
||||
for (final TaskView tv : childViewTransforms.keySet()) {
|
||||
Pair<Integer, TaskViewTransform> t = childViewTransforms.get(tv);
|
||||
tv.animate().setStartDelay(t.first);
|
||||
tv.updateViewPropertiesToTaskTransform(t.second, duration);
|
||||
TaskViewTransform t = childViewTransforms.get(tv);
|
||||
tv.updateViewPropertiesToTaskTransform(t, duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
tv.updateViewPropertiesToTaskTransform(t.second, duration);
|
||||
tv.updateViewPropertiesToTaskTransform(t, duration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
|
||||
if (useLayers) {
|
||||
anim.withLayer();
|
||||
}
|
||||
anim.setStartDelay(0)
|
||||
anim.setStartDelay(toTransform.startDelay)
|
||||
.setDuration(duration)
|
||||
.setInterpolator(mConfig.fastOutSlowInInterpolator)
|
||||
.start();
|
||||
@@ -248,6 +248,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
|
||||
// Fade the view out and slide it away
|
||||
toTransform.alpha = 0f;
|
||||
toTransform.translationY += 200;
|
||||
toTransform.translationZ = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -585,19 +586,25 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v == mBarView.mApplicationIcon) {
|
||||
mCb.onTaskIconClicked(this);
|
||||
} else if (v == mBarView.mDismissButton) {
|
||||
// Animate out the view and call the callback
|
||||
final TaskView tv = this;
|
||||
startDeleteTaskAnimation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCb.onTaskDismissed(tv);
|
||||
public void onClick(final View v) {
|
||||
// We purposely post the handler delayed to allow for the touch feedback to draw
|
||||
final TaskView tv = this;
|
||||
postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (v == mBarView.mApplicationIcon) {
|
||||
mCb.onTaskIconClicked(tv);
|
||||
} else if (v == mBarView.mDismissButton) {
|
||||
// Animate out the view and call the callback
|
||||
startDeleteTaskAnimation(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCb.onTaskDismissed(tv);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}, 125);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ import android.graphics.Rect;
|
||||
|
||||
/* The transform state for a task view */
|
||||
public class TaskViewTransform {
|
||||
public int startDelay = 0;
|
||||
public int translationY = 0;
|
||||
public int translationZ = 0;
|
||||
public float scale = 1f;
|
||||
@@ -35,6 +36,7 @@ public class TaskViewTransform {
|
||||
}
|
||||
|
||||
public TaskViewTransform(TaskViewTransform o) {
|
||||
startDelay = o.startDelay;
|
||||
translationY = o.translationY;
|
||||
translationZ = o.translationZ;
|
||||
scale = o.scale;
|
||||
@@ -47,6 +49,7 @@ public class TaskViewTransform {
|
||||
|
||||
/** Resets the current transform */
|
||||
public void reset() {
|
||||
startDelay = 0;
|
||||
translationY = 0;
|
||||
translationZ = 0;
|
||||
scale = 1f;
|
||||
@@ -76,8 +79,8 @@ public class TaskViewTransform {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TaskViewTransform y: " + translationY + " z: " + translationZ + " scale: " + scale +
|
||||
" alpha: " + alpha + " visible: " + visible + " rect: " + rect +
|
||||
return "TaskViewTransform delay: " + startDelay + " y: " + translationY + " z: " + translationZ +
|
||||
" scale: " + scale + " alpha: " + alpha + " visible: " + visible + " rect: " + rect +
|
||||
" dismissAlpha: " + dismissAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user