diff options
author | Selim Cinek <cinek@google.com> | 2014-09-22 18:35:45 +0200 |
---|---|---|
committer | Selim Cinek <cinek@google.com> | 2014-09-24 22:05:59 +0000 |
commit | 104aae1dccbaa8102b67b2a2407d58d5ddfce5f9 (patch) | |
tree | d66d336b25442754cdd00300f5ed62bd01e4e008 /packages/SystemUI/src/com/android/systemui/recents | |
parent | c9a5227292ecc24f9735d4ba53cd1f9aaef3e6f4 (diff) | |
download | frameworks_base-104aae1dccbaa8102b67b2a2407d58d5ddfce5f9.zip frameworks_base-104aae1dccbaa8102b67b2a2407d58d5ddfce5f9.tar.gz frameworks_base-104aae1dccbaa8102b67b2a2407d58d5ddfce5f9.tar.bz2 |
Only show FAB for the frontmost task
Bug: 17522143
Change-Id: I882185f27a4e9da57007818f678451a7e6e1ef81
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recents')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java | 2 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java | 45 |
2 files changed, 32 insertions, 15 deletions
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 e1e4068..7c87037 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackView.java @@ -24,7 +24,6 @@ import android.graphics.Rect; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; -import android.view.ViewTreeObserver; import android.view.accessibility.AccessibilityEvent; import android.widget.FrameLayout; import com.android.systemui.R; @@ -810,6 +809,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal TaskView frontTv = getChildViewForTask(newFrontMostTask); if (frontTv != null) { frontTv.onTaskBound(newFrontMostTask); + frontTv.fadeInActionButton(false); } } 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 1750804..1bf29d4 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -21,11 +21,10 @@ import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.*; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.LayerDrawable; import android.util.AttributeSet; import android.view.View; import android.view.ViewOutlineProvider; +import android.view.ViewPropertyAnimator; import android.view.animation.AccelerateInterpolator; import android.widget.FrameLayout; import com.android.systemui.R; @@ -34,6 +33,7 @@ import com.android.systemui.recents.Constants; import com.android.systemui.recents.RecentsConfiguration; import com.android.systemui.recents.model.RecentsTaskLoader; import com.android.systemui.recents.model.Task; +import com.android.systemui.statusbar.phone.PhoneStatusBar; /* A task view */ public class TaskView extends FrameLayout implements Task.TaskCallbacks, @@ -265,8 +265,6 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, } else if (mConfig.launchedFromAppWithThumbnail) { if (isTaskViewLaunchTargetTask) { - // Hide the action button if it exists - mActionButtonView.setAlpha(0f); // Set the dim to 0 so we can animate it in initialDim = 0; } else if (occludesLaunchTarget) { @@ -383,14 +381,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, // Animate the footer into view animateFooterVisibility(true, mConfig.taskBarEnterAnimDuration); + fadeInActionButton(true); + - // Animate the action button in - mActionButtonView.animate().alpha(1f) - .setStartDelay(mConfig.taskBarEnterAnimDelay) - .setDuration(mConfig.taskBarEnterAnimDuration) - .setInterpolator(mConfig.fastOutLinearInInterpolator) - .withLayer() - .start(); } else { // Animate the task up if it was occluding the launch target if (ctx.currentTaskOccludesLaunchTarget) { @@ -463,6 +456,23 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, }, (startDelay / 2)); } + public void fadeInActionButton(boolean withDelay) { + // Hide the action button + mActionButtonView.setAlpha(0f); + + // Animate the action button in + ViewPropertyAnimator animator = mActionButtonView.animate().alpha(1f) + .setDuration(mConfig.taskBarEnterAnimDuration) + .setInterpolator(PhoneStatusBar.ALPHA_IN) + .withLayer(); + if (withDelay) { + animator.setStartDelay(mConfig.taskBarEnterAnimDelay); + } + animator.start(); + + + } + /** Animates this task view as it leaves recents by pressing home. */ void startExitToHomeAnimation(ViewAnimation.TaskViewExitContext ctx) { animate() @@ -783,9 +793,16 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, } else { animateFooterVisibility(t.lockToThisTask, mConfig.taskViewLockToAppLongAnimDuration); } - // Hide the action button if lock to app is disabled - if (!t.lockToTaskEnabled && mActionButtonView.getVisibility() != View.GONE) { - mActionButtonView.setVisibility(View.GONE); + updateLockButtonVisibility(t); + + } + + private void updateLockButtonVisibility(Task t) { + // Hide the action button if lock to app is disabled for this view + int lockButtonVisibility = (!t.lockToTaskEnabled || !t.lockToThisTask) ? GONE : VISIBLE; + if (mActionButtonView.getVisibility() != lockButtonVisibility) { + mActionButtonView.setVisibility(lockButtonVisibility); + requestLayout(); } } |