Loading packages/SystemUI/res/layout/recents_task_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ android:layout_gravity="bottom|right" android:layout_marginRight="15dp" android:layout_marginBottom="15dp" android:translationZ="3dp" android:contentDescription="@string/recents_lock_to_app_button_label" android:background="@drawable/recents_lock_to_task_button_bg"> <ImageView Loading packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +17 −2 Original line number Diff line number Diff line Loading @@ -21,12 +21,14 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Color; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; import android.view.animation.AccelerateInterpolator; import android.widget.FrameLayout; import com.android.systemui.R; Loading Loading @@ -129,6 +131,14 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, mHeaderView = (TaskViewHeader) findViewById(R.id.task_view_bar); mThumbnailView = (TaskViewThumbnail) findViewById(R.id.task_view_thumbnail); mActionButtonView = findViewById(R.id.lock_to_app_fab); mActionButtonView.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { // Set the outline to match the FAB background outline.setOval(0, 0, mActionButtonView.getWidth(), mActionButtonView.getHeight()); } }); if (mFooterView != null) { mFooterView.setCallbacks(this); } Loading Loading @@ -469,7 +479,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, boolean occludesLaunchTarget) { if (isLaunchingTask) { // Disable the thumbnail clip and animate the bar out for the window animation out mHeaderView.startLaunchTaskAnimation(mThumbnailView.disableTaskBarClipAsRunnable(), r); mHeaderView.startLaunchTaskAnimation(mThumbnailView.disableTaskBarClipAsRunnable(), r, mIsFocused); // Animate the thumbnail alpha back into full opacity for the window animation out mThumbnailView.startLaunchTaskAnimation(); Loading Loading @@ -624,7 +635,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, public void setDim(int dim) { mDim = dim; // Defer setting hardware layers if we have not yet measured, or there is no dim to draw if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0 && dim > 0) { if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0) { if (mDimAnimator != null) { mDimAnimator.removeAllListeners(); mDimAnimator.cancel(); Loading Loading @@ -828,6 +839,10 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, } else if (v == mHeaderView.mDismissButton) { dismissTask(); } else { if (v == mActionButtonView) { // Reset the translation of the action button before we animate it out mActionButtonView.setTranslationZ(0f); } mCb.onTaskViewClicked(tv, tv.getTask(), (v == mFooterView || v == mActionButtonView)); } Loading packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java +50 −22 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.systemui.recents.views; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.ColorStateList; Loading Loading @@ -59,7 +61,8 @@ class TaskViewHeader extends FrameLayout { ColorDrawable mBackgroundColor; Drawable mLightDismissDrawable; Drawable mDarkDismissDrawable; ValueAnimator mBackgroundColorAnimator; AnimatorSet mFocusAnimator; ValueAnimator backgroundColorAnimator; boolean mIsFullscreen; boolean mCurrentPrimaryColorIsDark; Loading Loading @@ -117,6 +120,14 @@ class TaskViewHeader extends FrameLayout { @Override protected void onFinishInflate() { // Set the outline provider setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setRect(0, 0, getMeasuredWidth(), getMeasuredHeight()); } }); // Initialize the icon and description views mApplicationIcon = (ImageView) findViewById(R.id.application_icon); mActivityDescription = (TextView) findViewById(R.id.activity_description); Loading Loading @@ -223,7 +234,12 @@ class TaskViewHeader extends FrameLayout { } /** Animates this task bar as it exits recents */ void startLaunchTaskAnimation(Runnable preAnimRunnable, final Runnable postAnimRunnable) { void startLaunchTaskAnimation(Runnable preAnimRunnable, final Runnable postAnimRunnable, boolean isFocused) { if (isFocused) { onTaskViewFocusChanged(false); } // Animate the task bar out of the first task view animate() .alpha(0f) Loading Loading @@ -280,10 +296,10 @@ class TaskViewHeader extends FrameLayout { /** Notifies the associated TaskView has been focused. */ void onTaskViewFocusChanged(boolean focused) { boolean isRunning = false; if (mBackgroundColorAnimator != null) { isRunning = mBackgroundColorAnimator.isRunning(); mBackgroundColorAnimator.removeAllUpdateListeners(); mBackgroundColorAnimator.cancel(); if (mFocusAnimator != null) { isRunning = mFocusAnimator.isRunning(); mFocusAnimator.removeAllListeners(); mFocusAnimator.cancel(); } if (focused) { int secondaryColor = getSecondaryColor(mCurrentPrimaryColor, mCurrentPrimaryColorIsDark); Loading @@ -304,42 +320,54 @@ class TaskViewHeader extends FrameLayout { // Pulse the background color int currentColor = mBackgroundColor.getColor(); int lightPrimaryColor = getSecondaryColor(mCurrentPrimaryColor, mCurrentPrimaryColorIsDark); mBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), lightPrimaryColor, currentColor); mBackgroundColorAnimator.addListener(new AnimatorListenerAdapter() { ValueAnimator backgroundColor = ValueAnimator.ofObject(new ArgbEvaluator(), lightPrimaryColor, currentColor); backgroundColor.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { mBackground.setState(new int[]{}); } }); mBackgroundColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { backgroundColor.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mBackgroundColor.setColor((Integer) animation.getAnimatedValue()); } }); mBackgroundColorAnimator.setRepeatCount(ValueAnimator.INFINITE); mBackgroundColorAnimator.setRepeatMode(ValueAnimator.REVERSE); mBackgroundColorAnimator.setStartDelay(750); mBackgroundColorAnimator.setDuration(750); mBackgroundColorAnimator.start(); backgroundColor.setRepeatCount(ValueAnimator.INFINITE); backgroundColor.setRepeatMode(ValueAnimator.REVERSE); // Pulse the translation ObjectAnimator translation = ObjectAnimator.ofFloat(this, "translationZ", 15f); translation.setRepeatCount(ValueAnimator.INFINITE); translation.setRepeatMode(ValueAnimator.REVERSE); mFocusAnimator = new AnimatorSet(); mFocusAnimator.playTogether(backgroundColor, translation); mFocusAnimator.setStartDelay(750); mFocusAnimator.setDuration(750); mFocusAnimator.start(); } else { if (isRunning) { // Restore the background color int currentColor = mBackgroundColor.getColor(); mBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), currentColor, mCurrentPrimaryColor); mBackgroundColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { ValueAnimator backgroundColor = ValueAnimator.ofObject(new ArgbEvaluator(), currentColor, mCurrentPrimaryColor); backgroundColor.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mBackgroundColor.setColor((Integer) animation.getAnimatedValue()); } }); mBackgroundColorAnimator.setRepeatCount(0); mBackgroundColorAnimator.setDuration(150); mBackgroundColorAnimator.start(); // Restore the translation ObjectAnimator translation = ObjectAnimator.ofFloat(this, "translationZ", 0f); mFocusAnimator = new AnimatorSet(); mFocusAnimator.playTogether(backgroundColor, translation); mFocusAnimator.setDuration(150); mFocusAnimator.start(); } else { mBackground.setState(new int[] {}); setTranslationZ(0f); } } } Loading Loading
packages/SystemUI/res/layout/recents_task_view.xml +1 −0 Original line number Diff line number Diff line Loading @@ -69,6 +69,7 @@ android:layout_gravity="bottom|right" android:layout_marginRight="15dp" android:layout_marginBottom="15dp" android:translationZ="3dp" android:contentDescription="@string/recents_lock_to_app_button_label" android:background="@drawable/recents_lock_to_task_button_bg"> <ImageView Loading
packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +17 −2 Original line number Diff line number Diff line Loading @@ -21,12 +21,14 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Color; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; import android.view.animation.AccelerateInterpolator; import android.widget.FrameLayout; import com.android.systemui.R; Loading Loading @@ -129,6 +131,14 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, mHeaderView = (TaskViewHeader) findViewById(R.id.task_view_bar); mThumbnailView = (TaskViewThumbnail) findViewById(R.id.task_view_thumbnail); mActionButtonView = findViewById(R.id.lock_to_app_fab); mActionButtonView.setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { // Set the outline to match the FAB background outline.setOval(0, 0, mActionButtonView.getWidth(), mActionButtonView.getHeight()); } }); if (mFooterView != null) { mFooterView.setCallbacks(this); } Loading Loading @@ -469,7 +479,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, boolean occludesLaunchTarget) { if (isLaunchingTask) { // Disable the thumbnail clip and animate the bar out for the window animation out mHeaderView.startLaunchTaskAnimation(mThumbnailView.disableTaskBarClipAsRunnable(), r); mHeaderView.startLaunchTaskAnimation(mThumbnailView.disableTaskBarClipAsRunnable(), r, mIsFocused); // Animate the thumbnail alpha back into full opacity for the window animation out mThumbnailView.startLaunchTaskAnimation(); Loading Loading @@ -624,7 +635,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, public void setDim(int dim) { mDim = dim; // Defer setting hardware layers if we have not yet measured, or there is no dim to draw if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0 && dim > 0) { if (getMeasuredWidth() > 0 && getMeasuredHeight() > 0) { if (mDimAnimator != null) { mDimAnimator.removeAllListeners(); mDimAnimator.cancel(); Loading Loading @@ -828,6 +839,10 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, } else if (v == mHeaderView.mDismissButton) { dismissTask(); } else { if (v == mActionButtonView) { // Reset the translation of the action button before we animate it out mActionButtonView.setTranslationZ(0f); } mCb.onTaskViewClicked(tv, tv.getTask(), (v == mFooterView || v == mActionButtonView)); } Loading
packages/SystemUI/src/com/android/systemui/recents/views/TaskViewHeader.java +50 −22 Original line number Diff line number Diff line Loading @@ -18,7 +18,9 @@ package com.android.systemui.recents.views; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.ArgbEvaluator; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.ColorStateList; Loading Loading @@ -59,7 +61,8 @@ class TaskViewHeader extends FrameLayout { ColorDrawable mBackgroundColor; Drawable mLightDismissDrawable; Drawable mDarkDismissDrawable; ValueAnimator mBackgroundColorAnimator; AnimatorSet mFocusAnimator; ValueAnimator backgroundColorAnimator; boolean mIsFullscreen; boolean mCurrentPrimaryColorIsDark; Loading Loading @@ -117,6 +120,14 @@ class TaskViewHeader extends FrameLayout { @Override protected void onFinishInflate() { // Set the outline provider setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setRect(0, 0, getMeasuredWidth(), getMeasuredHeight()); } }); // Initialize the icon and description views mApplicationIcon = (ImageView) findViewById(R.id.application_icon); mActivityDescription = (TextView) findViewById(R.id.activity_description); Loading Loading @@ -223,7 +234,12 @@ class TaskViewHeader extends FrameLayout { } /** Animates this task bar as it exits recents */ void startLaunchTaskAnimation(Runnable preAnimRunnable, final Runnable postAnimRunnable) { void startLaunchTaskAnimation(Runnable preAnimRunnable, final Runnable postAnimRunnable, boolean isFocused) { if (isFocused) { onTaskViewFocusChanged(false); } // Animate the task bar out of the first task view animate() .alpha(0f) Loading Loading @@ -280,10 +296,10 @@ class TaskViewHeader extends FrameLayout { /** Notifies the associated TaskView has been focused. */ void onTaskViewFocusChanged(boolean focused) { boolean isRunning = false; if (mBackgroundColorAnimator != null) { isRunning = mBackgroundColorAnimator.isRunning(); mBackgroundColorAnimator.removeAllUpdateListeners(); mBackgroundColorAnimator.cancel(); if (mFocusAnimator != null) { isRunning = mFocusAnimator.isRunning(); mFocusAnimator.removeAllListeners(); mFocusAnimator.cancel(); } if (focused) { int secondaryColor = getSecondaryColor(mCurrentPrimaryColor, mCurrentPrimaryColorIsDark); Loading @@ -304,42 +320,54 @@ class TaskViewHeader extends FrameLayout { // Pulse the background color int currentColor = mBackgroundColor.getColor(); int lightPrimaryColor = getSecondaryColor(mCurrentPrimaryColor, mCurrentPrimaryColorIsDark); mBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), lightPrimaryColor, currentColor); mBackgroundColorAnimator.addListener(new AnimatorListenerAdapter() { ValueAnimator backgroundColor = ValueAnimator.ofObject(new ArgbEvaluator(), lightPrimaryColor, currentColor); backgroundColor.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { mBackground.setState(new int[]{}); } }); mBackgroundColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { backgroundColor.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mBackgroundColor.setColor((Integer) animation.getAnimatedValue()); } }); mBackgroundColorAnimator.setRepeatCount(ValueAnimator.INFINITE); mBackgroundColorAnimator.setRepeatMode(ValueAnimator.REVERSE); mBackgroundColorAnimator.setStartDelay(750); mBackgroundColorAnimator.setDuration(750); mBackgroundColorAnimator.start(); backgroundColor.setRepeatCount(ValueAnimator.INFINITE); backgroundColor.setRepeatMode(ValueAnimator.REVERSE); // Pulse the translation ObjectAnimator translation = ObjectAnimator.ofFloat(this, "translationZ", 15f); translation.setRepeatCount(ValueAnimator.INFINITE); translation.setRepeatMode(ValueAnimator.REVERSE); mFocusAnimator = new AnimatorSet(); mFocusAnimator.playTogether(backgroundColor, translation); mFocusAnimator.setStartDelay(750); mFocusAnimator.setDuration(750); mFocusAnimator.start(); } else { if (isRunning) { // Restore the background color int currentColor = mBackgroundColor.getColor(); mBackgroundColorAnimator = ValueAnimator.ofObject(new ArgbEvaluator(), currentColor, mCurrentPrimaryColor); mBackgroundColorAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { ValueAnimator backgroundColor = ValueAnimator.ofObject(new ArgbEvaluator(), currentColor, mCurrentPrimaryColor); backgroundColor.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mBackgroundColor.setColor((Integer) animation.getAnimatedValue()); } }); mBackgroundColorAnimator.setRepeatCount(0); mBackgroundColorAnimator.setDuration(150); mBackgroundColorAnimator.start(); // Restore the translation ObjectAnimator translation = ObjectAnimator.ofFloat(this, "translationZ", 0f); mFocusAnimator = new AnimatorSet(); mFocusAnimator.playTogether(backgroundColor, translation); mFocusAnimator.setDuration(150); mFocusAnimator.start(); } else { mBackground.setState(new int[] {}); setTranslationZ(0f); } } } Loading