Merge "Defer launching next task until after first layout." into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a9375fef09
@@ -164,6 +164,8 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
@ViewDebug.ExportedProperty(category="recents")
|
@ViewDebug.ExportedProperty(category="recents")
|
||||||
private boolean mAwaitingFirstLayout = true;
|
private boolean mAwaitingFirstLayout = true;
|
||||||
@ViewDebug.ExportedProperty(category="recents")
|
@ViewDebug.ExportedProperty(category="recents")
|
||||||
|
private boolean mLaunchNextAfterFirstMeasure = false;
|
||||||
|
@ViewDebug.ExportedProperty(category="recents")
|
||||||
@InitialStateAction
|
@InitialStateAction
|
||||||
private int mInitialState = INITIAL_STATE_UPDATE_ALL;
|
private int mInitialState = INITIAL_STATE_UPDATE_ALL;
|
||||||
@ViewDebug.ExportedProperty(category="recents")
|
@ViewDebug.ExportedProperty(category="recents")
|
||||||
@@ -336,6 +338,7 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
// Since we always animate to the same place in (the initial state), always reset the stack
|
// Since we always animate to the same place in (the initial state), always reset the stack
|
||||||
// to the initial state when resuming
|
// to the initial state when resuming
|
||||||
mAwaitingFirstLayout = true;
|
mAwaitingFirstLayout = true;
|
||||||
|
mLaunchNextAfterFirstMeasure = false;
|
||||||
mInitialState = INITIAL_STATE_UPDATE_ALL;
|
mInitialState = INITIAL_STATE_UPDATE_ALL;
|
||||||
requestLayout();
|
requestLayout();
|
||||||
}
|
}
|
||||||
@@ -1223,6 +1226,12 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
mInitialState = INITIAL_STATE_UPDATE_NONE;
|
mInitialState = INITIAL_STATE_UPDATE_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If we got the launch-next event before the first layout pass, then re-send it after the
|
||||||
|
// initial state has been updated
|
||||||
|
if (mLaunchNextAfterFirstMeasure) {
|
||||||
|
mLaunchNextAfterFirstMeasure = false;
|
||||||
|
EventBus.getDefault().post(new LaunchNextTaskRequestEvent());
|
||||||
|
}
|
||||||
|
|
||||||
// Rebind all the views, including the ignore ones
|
// Rebind all the views, including the ignore ones
|
||||||
bindVisibleTaskViews(mStackScroller.getStackScroll(), false /* ignoreTaskOverrides */);
|
bindVisibleTaskViews(mStackScroller.getStackScroll(), false /* ignoreTaskOverrides */);
|
||||||
@@ -1665,6 +1674,11 @@ public class TaskStackView extends FrameLayout implements TaskStack.TaskStackCal
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final void onBusEvent(LaunchNextTaskRequestEvent event) {
|
public final void onBusEvent(LaunchNextTaskRequestEvent event) {
|
||||||
|
if (mAwaitingFirstLayout) {
|
||||||
|
mLaunchNextAfterFirstMeasure = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int launchTaskIndex = mStack.indexOfStackTask(mStack.getLaunchTarget());
|
int launchTaskIndex = mStack.indexOfStackTask(mStack.getLaunchTarget());
|
||||||
if (launchTaskIndex != -1) {
|
if (launchTaskIndex != -1) {
|
||||||
launchTaskIndex = Math.max(0, launchTaskIndex - 1);
|
launchTaskIndex = Math.max(0, launchTaskIndex - 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user