Coordinating empty view with the history view.
- Moving the empty view into the RecentsView so that we can coordinate its animation with the history button and the task stack (when history is visible, all of the other views are animated away, and vice versa) - Removing unnecessary launch state flag to keep track of recent task empty state just for deciding animations for system bar scrims. - Fixing issue with overview button not dismissing the history view while it is open - Fixing issue with swiping the last recent task away causing both Overview and the docked task to be dismissed to home Bug: 26044055 Change-Id: I731fb0f7efb3de7d5f826673479c602b606453e9
This commit is contained in:
@@ -33,12 +33,6 @@
|
||||
android:layout_height="match_parent">
|
||||
</com.android.systemui.recents.views.RecentsView>
|
||||
|
||||
<!-- Empty View -->
|
||||
<ViewStub android:id="@+id/empty_view_stub"
|
||||
android:layout="@layout/recents_empty"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- History View -->
|
||||
<ViewStub android:id="@+id/history_view_stub"
|
||||
android:layout="@layout/recents_history"
|
||||
|
||||
@@ -26,5 +26,4 @@
|
||||
android:shadowDx="0"
|
||||
android:shadowDy="2"
|
||||
android:shadowRadius="5"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:visibility="invisible" />
|
||||
android:fontFamily="sans-serif-medium" />
|
||||
@@ -97,8 +97,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
// Top level views
|
||||
private RecentsView mRecentsView;
|
||||
private SystemBarScrimViews mScrimViews;
|
||||
private ViewStub mEmptyViewStub;
|
||||
private View mEmptyView;
|
||||
private ViewStub mHistoryViewStub;
|
||||
private RecentsHistoryView mHistoryView;
|
||||
|
||||
@@ -197,7 +195,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
loader.loadTasks(this, plan, loadOpts);
|
||||
|
||||
TaskStack stack = plan.getTaskStack();
|
||||
launchState.launchedWithNoRecentTasks = !plan.hasTasks();
|
||||
mRecentsView.setTaskStack(stack);
|
||||
|
||||
// Mark the task that is the launch target
|
||||
@@ -215,30 +212,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
}
|
||||
}
|
||||
|
||||
// Update the top level view's visibilities
|
||||
if (launchState.launchedWithNoRecentTasks) {
|
||||
if (mEmptyView == null) {
|
||||
mEmptyView = mEmptyViewStub.inflate();
|
||||
}
|
||||
mEmptyView.setVisibility(View.VISIBLE);
|
||||
if (!RecentsDebugFlags.Static.DisableSearchBar) {
|
||||
mRecentsView.setSearchBarVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
if (mEmptyView != null) {
|
||||
mEmptyView.setVisibility(View.GONE);
|
||||
}
|
||||
if (!RecentsDebugFlags.Static.DisableSearchBar) {
|
||||
if (mRecentsView.hasValidSearchBar()) {
|
||||
mRecentsView.setSearchBarVisibility(View.VISIBLE);
|
||||
} else {
|
||||
refreshSearchWidgetView();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Animate the SystemUI scrims into view
|
||||
mScrimViews.prepareEnterRecentsAnimation();
|
||||
boolean hasStatusBarScrim = stack.getStackTaskCount() > 0;
|
||||
boolean animateStatusBarScrim = launchState.launchedFromHome;
|
||||
boolean hasNavBarScrim = (stack.getStackTaskCount() > 0) && !config.hasTransposedNavBar;
|
||||
boolean animateNavBarScrim = true;
|
||||
mScrimViews.prepareEnterRecentsAnimation(hasStatusBarScrim, animateStatusBarScrim, hasNavBarScrim,
|
||||
animateNavBarScrim);
|
||||
|
||||
// Keep track of whether we launched from the nav bar button or via alt-tab
|
||||
if (launchState.launchedWithAltTab) {
|
||||
@@ -265,7 +245,10 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
boolean dismissHistory() {
|
||||
// Try and hide the history view first
|
||||
if (mHistoryView != null && mHistoryView.isVisible()) {
|
||||
EventBus.getDefault().send(new HideHistoryEvent(true /* animate */));
|
||||
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
|
||||
t.increment();
|
||||
EventBus.getDefault().send(new HideHistoryEvent(true /* animate */, t));
|
||||
t.decrement();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -374,7 +357,6 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
mRecentsView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
|
||||
mEmptyViewStub = (ViewStub) findViewById(R.id.empty_view_stub);
|
||||
mHistoryViewStub = (ViewStub) findViewById(R.id.history_view_stub);
|
||||
mScrimViews = new SystemBarScrimViews(this);
|
||||
getWindow().getAttributes().privateFlags |=
|
||||
@@ -456,7 +438,10 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
// Reset some states
|
||||
mIgnoreAltTabRelease = false;
|
||||
if (mHistoryView != null) {
|
||||
EventBus.getDefault().send(new HideHistoryEvent(false /* animate */));
|
||||
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
|
||||
t.increment();
|
||||
EventBus.getDefault().send(new HideHistoryEvent(false /* animate */, t));
|
||||
t.decrement();
|
||||
}
|
||||
|
||||
// Notify that recents is now hidden
|
||||
@@ -603,16 +588,18 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
}
|
||||
|
||||
public final void onBusEvent(IterateRecentsEvent event) {
|
||||
// Focus the next task
|
||||
EventBus.getDefault().send(new FocusNextTaskViewEvent());
|
||||
if (!dismissHistory()) {
|
||||
// Focus the next task
|
||||
EventBus.getDefault().send(new FocusNextTaskViewEvent());
|
||||
|
||||
// Start dozing after the recents button is clicked
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
if (debugFlags.isFastToggleRecentsEnabled()) {
|
||||
if (!mIterateTrigger.isDozing()) {
|
||||
mIterateTrigger.startDozing();
|
||||
} else {
|
||||
mIterateTrigger.poke();
|
||||
// Start dozing after the recents button is clicked
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
if (debugFlags.isFastToggleRecentsEnabled()) {
|
||||
if (!mIterateTrigger.isDozing()) {
|
||||
mIterateTrigger.startDozing();
|
||||
} else {
|
||||
mIterateTrigger.poke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -630,7 +617,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
} else if (event.triggeredFromHomeKey) {
|
||||
// Otherwise, dismiss Recents to Home
|
||||
if (mHistoryView != null && mHistoryView.isVisible()) {
|
||||
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this, null, null, null);
|
||||
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
|
||||
t.increment();
|
||||
t.addLastDecrementRunnable(new Runnable() {
|
||||
@Override
|
||||
@@ -651,7 +638,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
|
||||
public final void onBusEvent(EnterRecentsWindowAnimationCompletedEvent event) {
|
||||
// Try and start the enter animation (or restart it on configuration changed)
|
||||
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this, null, null, null);
|
||||
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this);
|
||||
ViewAnimation.TaskViewEnterContext ctx = new ViewAnimation.TaskViewEnterContext(t);
|
||||
ctx.postAnimationTrigger.increment();
|
||||
if (mSearchWidgetInfo != null) {
|
||||
@@ -724,8 +711,13 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
}
|
||||
|
||||
public final void onBusEvent(AllTaskViewsDismissedEvent event) {
|
||||
// Just go straight home (no animation necessary because there are no more task views)
|
||||
dismissRecentsToHome(false /* animated */);
|
||||
SystemServicesProxy ssp = Recents.getSystemServices();
|
||||
if (ssp.hasDockedTask()) {
|
||||
mRecentsView.showEmptyView();
|
||||
} else {
|
||||
// Just go straight home (no animation necessary because there are no more task views)
|
||||
dismissRecentsToHome(false /* animated */);
|
||||
}
|
||||
|
||||
// Keep track of all-deletions
|
||||
MetricsLogger.count(this, "overview_task_all_dismissed", 1);
|
||||
@@ -769,13 +761,11 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
|
||||
// provided.
|
||||
mHistoryView.setSystemInsets(mRecentsView.getSystemInsets());
|
||||
}
|
||||
mHistoryView.show(mRecentsView.getTaskStack());
|
||||
mHistoryView.show(mRecentsView.getTaskStack(), event.postHideStackAnimationTrigger);
|
||||
}
|
||||
|
||||
public final void onBusEvent(HideHistoryEvent event) {
|
||||
if (mHistoryView != null) {
|
||||
mHistoryView.hide(event.animate, event.postAnimationTrigger);
|
||||
}
|
||||
mHistoryView.hide(event.animate, event.postHideHistoryAnimationTrigger);
|
||||
}
|
||||
|
||||
private void refreshSearchWidgetView() {
|
||||
|
||||
@@ -28,7 +28,6 @@ package com.android.systemui.recents;
|
||||
public class RecentsActivityLaunchState {
|
||||
|
||||
public boolean launchedWithAltTab;
|
||||
public boolean launchedWithNoRecentTasks;
|
||||
public boolean launchedFromAppWithThumbnail;
|
||||
public boolean launchedFromHome;
|
||||
public boolean launchedFromSearchHome;
|
||||
@@ -49,28 +48,6 @@ public class RecentsActivityLaunchState {
|
||||
launchedViaDragGesture = false;
|
||||
}
|
||||
|
||||
/** Returns whether the status bar scrim should be animated when shown for the first time. */
|
||||
public boolean shouldAnimateStatusBarScrim() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Returns whether the status bar scrim should be visible. */
|
||||
public boolean hasStatusBarScrim() {
|
||||
return !launchedWithNoRecentTasks;
|
||||
}
|
||||
|
||||
/** Returns whether the nav bar scrim should be animated when shown for the first time. */
|
||||
public boolean shouldAnimateNavBarScrim() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Returns whether the nav bar scrim should be visible. */
|
||||
public boolean hasNavBarScrim() {
|
||||
// Only show the scrim if we have recent tasks, and if the nav bar is not transposed
|
||||
RecentsConfiguration config = Recents.getConfiguration();
|
||||
return !launchedWithNoRecentTasks && !config.hasTransposedNavBar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the task to focus given the current launch state.
|
||||
*/
|
||||
@@ -103,13 +80,4 @@ public class RecentsActivityLaunchState {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RecentsActivityLaunchState altTab: " + launchedWithAltTab +
|
||||
", noTasks: " + launchedWithNoRecentTasks +
|
||||
", fromHome: " + launchedFromHome +
|
||||
", fromSearchHome: " + launchedFromSearchHome +
|
||||
", reuse: " + launchedReuseTaskStackViews;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,14 +25,14 @@ import com.android.systemui.recents.misc.ReferenceCountedTrigger;
|
||||
public class HideHistoryEvent extends EventBus.Event {
|
||||
|
||||
public final boolean animate;
|
||||
public final ReferenceCountedTrigger postAnimationTrigger;
|
||||
public final ReferenceCountedTrigger postHideHistoryAnimationTrigger;
|
||||
|
||||
public HideHistoryEvent(boolean animate) {
|
||||
this(animate, null);
|
||||
}
|
||||
|
||||
public HideHistoryEvent(boolean animate, ReferenceCountedTrigger postAnimationTrigger) {
|
||||
/**
|
||||
* @param postHideHistoryAnimationTrigger the trigger that gets called when all the history animations are finished
|
||||
* when transitioning from the history view
|
||||
*/
|
||||
public HideHistoryEvent(boolean animate, ReferenceCountedTrigger postHideHistoryAnimationTrigger) {
|
||||
this.animate = animate;
|
||||
this.postAnimationTrigger = postAnimationTrigger;
|
||||
this.postHideHistoryAnimationTrigger = postHideHistoryAnimationTrigger;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,20 @@
|
||||
package com.android.systemui.recents.events.activity;
|
||||
|
||||
import com.android.systemui.recents.events.EventBus;
|
||||
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
|
||||
|
||||
/**
|
||||
* This is sent when the history view button is clicked.
|
||||
*/
|
||||
public class ShowHistoryEvent extends EventBus.Event {
|
||||
// Simple event
|
||||
|
||||
public final ReferenceCountedTrigger postHideStackAnimationTrigger;
|
||||
|
||||
/**
|
||||
* @param postHideStackAnimationTrigger the trigger that gets called when all the task animations are finished when
|
||||
* transitioning to the history view
|
||||
*/
|
||||
public ShowHistoryEvent(ReferenceCountedTrigger postHideStackAnimationTrigger) {
|
||||
this.postHideStackAnimationTrigger = postHideStackAnimationTrigger;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,16 +77,20 @@ public class RecentsHistoryView extends LinearLayout {
|
||||
/**
|
||||
* Updates this history view with the recent tasks, and then shows it.
|
||||
*/
|
||||
public void show(TaskStack stack) {
|
||||
public void show(TaskStack stack, ReferenceCountedTrigger postHideAnimationTrigger) {
|
||||
setVisibility(View.VISIBLE);
|
||||
setAlpha(0f);
|
||||
animate()
|
||||
.alpha(1f)
|
||||
.setDuration(mHistoryTransitionDuration)
|
||||
.setInterpolator(mFastOutSlowInInterpolator)
|
||||
.withLayer()
|
||||
.start();
|
||||
|
||||
postHideAnimationTrigger.addLastDecrementRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
animate()
|
||||
.alpha(1f)
|
||||
.setDuration(mHistoryTransitionDuration)
|
||||
.setInterpolator(mFastOutSlowInInterpolator)
|
||||
.withLayer()
|
||||
.start();
|
||||
}
|
||||
});
|
||||
mAdapter.updateTasks(getContext(), stack.computeAllTasksList());
|
||||
mIsVisible = true;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,10 @@ public class ReferenceCountedTrigger {
|
||||
}
|
||||
};
|
||||
|
||||
public ReferenceCountedTrigger(Context context) {
|
||||
this(context, null, null, null);
|
||||
}
|
||||
|
||||
public ReferenceCountedTrigger(Context context, Runnable firstIncRunnable,
|
||||
Runnable lastDecRunnable, Runnable errorRunanable) {
|
||||
mContext = context;
|
||||
@@ -97,7 +101,7 @@ public class ReferenceCountedTrigger {
|
||||
if (mErrorRunnable != null) {
|
||||
mErrorRunnable.run();
|
||||
} else {
|
||||
Log.e(TAG, "Invalid ref count");
|
||||
throw new RuntimeException("Invalid ref count");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ import com.android.systemui.recents.events.ui.DraggingInRecentsEvent;
|
||||
import com.android.systemui.recents.events.ui.dragndrop.DragDropTargetChangedEvent;
|
||||
import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
|
||||
import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
|
||||
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
|
||||
import com.android.systemui.recents.misc.SystemServicesProxy;
|
||||
import com.android.systemui.recents.model.Task;
|
||||
import com.android.systemui.recents.model.TaskStack;
|
||||
@@ -75,31 +76,29 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
private static final String TAG = "RecentsView";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
Handler mHandler;
|
||||
private final Handler mHandler;
|
||||
|
||||
TaskStack mStack;
|
||||
TaskStackView mTaskStackView;
|
||||
RecentsAppWidgetHostView mSearchBar;
|
||||
View mHistoryButton;
|
||||
boolean mAwaitingFirstLayout = true;
|
||||
boolean mLastTaskLaunchedWasFreeform;
|
||||
private TaskStack mStack;
|
||||
private TaskStackView mTaskStackView;
|
||||
private RecentsAppWidgetHostView mSearchBar;
|
||||
private View mHistoryButton;
|
||||
private View mEmptyView;
|
||||
private boolean mAwaitingFirstLayout = true;
|
||||
private boolean mLastTaskLaunchedWasFreeform;
|
||||
private Rect mSystemInsets = new Rect();
|
||||
|
||||
RecentsTransitionHelper mTransitionHelper;
|
||||
RecentsViewTouchHandler mTouchHandler;
|
||||
TaskStack.DockState[] mVisibleDockStates = {
|
||||
private RecentsTransitionHelper mTransitionHelper;
|
||||
private RecentsViewTouchHandler mTouchHandler;
|
||||
private TaskStack.DockState[] mVisibleDockStates = {
|
||||
TaskStack.DockState.LEFT,
|
||||
TaskStack.DockState.TOP,
|
||||
TaskStack.DockState.RIGHT,
|
||||
TaskStack.DockState.BOTTOM,
|
||||
};
|
||||
|
||||
private Interpolator mFastOutSlowInInterpolator;
|
||||
private Interpolator mFastOutLinearInInterpolator;
|
||||
private int mHistoryTransitionDuration;
|
||||
|
||||
Rect mSystemInsets = new Rect();
|
||||
|
||||
final FlingAnimationUtils mFlingAnimationUtils;
|
||||
private final Interpolator mFastOutSlowInInterpolator;
|
||||
private final Interpolator mFastOutLinearInInterpolator;
|
||||
private final FlingAnimationUtils mFlingAnimationUtils;
|
||||
|
||||
public RecentsView(Context context) {
|
||||
this(context, null);
|
||||
@@ -123,7 +122,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
com.android.internal.R.interpolator.fast_out_slow_in);
|
||||
mFastOutLinearInInterpolator = AnimationUtils.loadInterpolator(context,
|
||||
com.android.internal.R.interpolator.fast_out_linear_in);
|
||||
mHistoryTransitionDuration = res.getInteger(R.integer.recents_history_transition_duration);
|
||||
mTouchHandler = new RecentsViewTouchHandler(this);
|
||||
mFlingAnimationUtils = new FlingAnimationUtils(context, 0.3f);
|
||||
|
||||
@@ -132,17 +130,24 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
mHistoryButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
EventBus.getDefault().send(new ShowHistoryEvent());
|
||||
ReferenceCountedTrigger postHideStackAnimationTrigger = new ReferenceCountedTrigger(v.getContext());
|
||||
postHideStackAnimationTrigger.increment();
|
||||
EventBus.getDefault().send(new ShowHistoryEvent(postHideStackAnimationTrigger));
|
||||
postHideStackAnimationTrigger.decrement();
|
||||
}
|
||||
});
|
||||
addView(mHistoryButton);
|
||||
mEmptyView = inflater.inflate(R.layout.recents_empty, this, false);
|
||||
addView(mEmptyView);
|
||||
}
|
||||
|
||||
/** Set/get the bsp root node */
|
||||
public void setTaskStack(TaskStack stack) {
|
||||
RecentsConfiguration config = Recents.getConfiguration();
|
||||
RecentsActivityLaunchState launchState = config.getLaunchState();
|
||||
mStack = stack;
|
||||
// Disable reusing task stack views until the visibility bug is fixed. b/25998134
|
||||
if (false && config.getLaunchState().launchedReuseTaskStackViews) {
|
||||
if (false && launchState.launchedReuseTaskStackViews) {
|
||||
if (mTaskStackView != null) {
|
||||
// If onRecentsHidden is not triggered, we need to the stack view again here
|
||||
mTaskStackView.reset();
|
||||
@@ -162,10 +167,12 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
mTaskStackView.setCallbacks(this);
|
||||
addView(mTaskStackView);
|
||||
}
|
||||
if (indexOfChild(mHistoryButton) == -1) {
|
||||
addView(mHistoryButton);
|
||||
|
||||
// Update the top level view's visibilities
|
||||
if (stack.getStackTaskCount() > 0) {
|
||||
hideEmptyView();
|
||||
} else {
|
||||
mHistoryButton.bringToFront();
|
||||
showEmptyView();
|
||||
}
|
||||
|
||||
// Trigger a new layout
|
||||
@@ -309,13 +316,33 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
return mSearchBar != null && !mSearchBar.isReinflateRequired();
|
||||
}
|
||||
|
||||
/** Sets the visibility of the search bar */
|
||||
public void setSearchBarVisibility(int visibility) {
|
||||
/**
|
||||
* Hides the task stack and shows the empty view.
|
||||
*/
|
||||
public void showEmptyView() {
|
||||
if (!RecentsDebugFlags.Static.DisableSearchBar && (mSearchBar != null)) {
|
||||
mSearchBar.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
mTaskStackView.setVisibility(View.INVISIBLE);
|
||||
mEmptyView.setVisibility(View.VISIBLE);
|
||||
mEmptyView.bringToFront();
|
||||
mHistoryButton.bringToFront();
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the task stack and hides the empty view.
|
||||
*/
|
||||
public void hideEmptyView() {
|
||||
mEmptyView.setVisibility(View.INVISIBLE);
|
||||
mTaskStackView.setVisibility(View.VISIBLE);
|
||||
if (!RecentsDebugFlags.Static.DisableSearchBar && (mSearchBar != null)) {
|
||||
mSearchBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mTaskStackView.bringToFront();
|
||||
if (mSearchBar != null) {
|
||||
mSearchBar.setVisibility(visibility);
|
||||
// Always bring the search bar to the top
|
||||
mSearchBar.bringToFront();
|
||||
}
|
||||
mHistoryButton.bringToFront();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,6 +393,10 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
mTaskStackView.measure(widthMeasureSpec, heightMeasureSpec);
|
||||
}
|
||||
|
||||
// Measure the empty view
|
||||
measureChild(mEmptyView, MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY));
|
||||
|
||||
// Measure the history button with the full space above the stack, but width-constrained
|
||||
// to the stack
|
||||
Rect historyButtonRect = mTaskStackView.mLayoutAlgorithm.mHistoryButtonRect;
|
||||
@@ -373,6 +404,7 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
MeasureSpec.makeMeasureSpec(historyButtonRect.width(), MeasureSpec.EXACTLY),
|
||||
MeasureSpec.makeMeasureSpec(historyButtonRect.height(),
|
||||
MeasureSpec.EXACTLY));
|
||||
|
||||
setMeasuredDimension(width, height);
|
||||
}
|
||||
|
||||
@@ -397,6 +429,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
mTaskStackView.layout(left, top, left + getMeasuredWidth(), top + getMeasuredHeight());
|
||||
}
|
||||
|
||||
// Layout the empty view
|
||||
mEmptyView.layout(left, top, right, bottom);
|
||||
|
||||
// Layout the history button left-aligned with the stack, but offset from the top of the
|
||||
// view
|
||||
Rect historyButtonRect = mTaskStackView.mLayoutAlgorithm.mHistoryButtonRect;
|
||||
@@ -545,12 +580,21 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
|
||||
public final void onBusEvent(ShowHistoryEvent event) {
|
||||
// Hide the history button when the history view is shown
|
||||
hideHistoryButton(mHistoryTransitionDuration);
|
||||
hideHistoryButton(getResources().getInteger(R.integer.recents_history_transition_duration),
|
||||
event.postHideStackAnimationTrigger);
|
||||
event.postHideStackAnimationTrigger.addLastDecrementRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setAlpha(0f);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public final void onBusEvent(HideHistoryEvent event) {
|
||||
// Show the history button when the history view is hidden
|
||||
showHistoryButton(mHistoryTransitionDuration);
|
||||
setAlpha(1f);
|
||||
showHistoryButton(getResources().getInteger(R.integer.recents_history_transition_duration),
|
||||
event.postHideHistoryAnimationTrigger);
|
||||
}
|
||||
|
||||
public final void onBusEvent(ShowHistoryButtonEvent event) {
|
||||
@@ -571,25 +615,47 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
/**
|
||||
* Shows the history button.
|
||||
*/
|
||||
private void showHistoryButton(int duration) {
|
||||
private void showHistoryButton(final int duration) {
|
||||
ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger(getContext());
|
||||
postAnimationTrigger.increment();
|
||||
showHistoryButton(duration, postAnimationTrigger);
|
||||
postAnimationTrigger.decrement();
|
||||
}
|
||||
|
||||
private void showHistoryButton(final int duration,
|
||||
final ReferenceCountedTrigger postHideHistoryAnimationTrigger) {
|
||||
RecentsDebugFlags debugFlags = Recents.getDebugFlags();
|
||||
if (!debugFlags.isHistoryEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHistoryButton.setVisibility(View.VISIBLE);
|
||||
mHistoryButton.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(duration)
|
||||
.setInterpolator(mFastOutSlowInInterpolator)
|
||||
.withLayer()
|
||||
.start();
|
||||
mHistoryButton.setAlpha(0f);
|
||||
postHideHistoryAnimationTrigger.addLastDecrementRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mHistoryButton.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(duration)
|
||||
.setInterpolator(mFastOutSlowInInterpolator)
|
||||
.withLayer()
|
||||
.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Hides the history button.
|
||||
*/
|
||||
private void hideHistoryButton(int duration) {
|
||||
ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger(getContext());
|
||||
postAnimationTrigger.increment();
|
||||
hideHistoryButton(duration, postAnimationTrigger);
|
||||
postAnimationTrigger.decrement();
|
||||
}
|
||||
|
||||
private void hideHistoryButton(int duration,
|
||||
final ReferenceCountedTrigger postHideStackAnimationTrigger) {
|
||||
mHistoryButton.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(duration)
|
||||
@@ -598,10 +664,12 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
|
||||
@Override
|
||||
public void run() {
|
||||
mHistoryButton.setVisibility(View.INVISIBLE);
|
||||
postHideStackAnimationTrigger.decrement();
|
||||
}
|
||||
})
|
||||
.withLayer()
|
||||
.start();
|
||||
postHideStackAnimationTrigger.increment();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -189,7 +189,7 @@ public class RecentsViewTouchHandler {
|
||||
case MotionEvent.ACTION_CANCEL: {
|
||||
if (mDragging) {
|
||||
ReferenceCountedTrigger postAnimationTrigger = new ReferenceCountedTrigger(
|
||||
mRv.getContext(), null, null, null);
|
||||
mRv.getContext());
|
||||
postAnimationTrigger.increment();
|
||||
EventBus.getDefault().send(new DragEndEvent(mDragTask, mTaskView,
|
||||
mLastDropTarget, postAnimationTrigger));
|
||||
|
||||
@@ -62,13 +62,14 @@ public class SystemBarScrimViews {
|
||||
* Prepares the scrim views for animating when entering Recents. This will be called before
|
||||
* the first draw.
|
||||
*/
|
||||
public void prepareEnterRecentsAnimation() {
|
||||
public void prepareEnterRecentsAnimation(boolean hasStatusBarScrim, boolean animateStatusBarScrim,
|
||||
boolean hasNavBarScrim, boolean animateNavBarScrim) {
|
||||
RecentsConfiguration config = Recents.getConfiguration();
|
||||
RecentsActivityLaunchState launchState = config.getLaunchState();
|
||||
mHasNavBarScrim = launchState.hasNavBarScrim();
|
||||
mShouldAnimateNavBarScrim = launchState.shouldAnimateNavBarScrim();
|
||||
mHasStatusBarScrim = launchState.hasStatusBarScrim();
|
||||
mShouldAnimateStatusBarScrim = launchState.shouldAnimateStatusBarScrim();
|
||||
mHasNavBarScrim = hasStatusBarScrim;
|
||||
mShouldAnimateStatusBarScrim = animateStatusBarScrim;
|
||||
mHasStatusBarScrim = hasNavBarScrim;
|
||||
mShouldAnimateNavBarScrim = animateNavBarScrim;
|
||||
|
||||
mNavBarScrimView.setVisibility(mHasNavBarScrim && !mShouldAnimateNavBarScrim ?
|
||||
View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
@@ -1537,32 +1537,47 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
||||
}
|
||||
|
||||
public final void onBusEvent(ShowHistoryEvent event) {
|
||||
// The history view's animation will be deferred until all the stack task views are animated
|
||||
// away
|
||||
int historyTransitionDuration =
|
||||
getResources().getInteger(R.integer.recents_history_transition_duration);
|
||||
List<TaskView> taskViews = getTaskViews();
|
||||
int taskViewCount = taskViews.size();
|
||||
for (int i = taskViewCount - 1; i >= 0; i--) {
|
||||
TaskView tv = taskViews.get(i);
|
||||
tv.animate()
|
||||
.alpha(0f)
|
||||
.setDuration(200)
|
||||
.setDuration(historyTransitionDuration)
|
||||
.setUpdateListener(null)
|
||||
.setListener(null)
|
||||
.withLayer()
|
||||
.withEndAction(event.postHideStackAnimationTrigger.decrementAsRunnable())
|
||||
.start();
|
||||
event.postHideStackAnimationTrigger.increment();
|
||||
}
|
||||
}
|
||||
|
||||
public final void onBusEvent(HideHistoryEvent event) {
|
||||
// The stack task view animations will be deferred until the history view has been animated
|
||||
// away
|
||||
final int historyTransitionDuration =
|
||||
getResources().getInteger(R.integer.recents_history_transition_duration);
|
||||
List<TaskView> taskViews = getTaskViews();
|
||||
int taskViewCount = taskViews.size();
|
||||
for (int i = taskViewCount - 1; i >= 0; i--) {
|
||||
TaskView tv = taskViews.get(i);
|
||||
tv.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(200)
|
||||
.setUpdateListener(null)
|
||||
.setListener(null)
|
||||
.withLayer()
|
||||
.start();
|
||||
final TaskView tv = taskViews.get(i);
|
||||
event.postHideHistoryAnimationTrigger.addLastDecrementRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tv.animate()
|
||||
.alpha(1f)
|
||||
.setDuration(historyTransitionDuration)
|
||||
.setUpdateListener(null)
|
||||
.setListener(null)
|
||||
.withLayer()
|
||||
.start();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user