use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.
the class Launcher method restoreState.
/**
* Restores the previous state, if it exists.
*
* @param savedState The previous state.
*/
private void restoreState(Bundle savedState) {
if (savedState == null) {
return;
}
int stateOrdinal = savedState.getInt(RUNTIME_STATE, NORMAL.ordinal);
LauncherState[] stateValues = LauncherState.values();
LauncherState state = stateValues[stateOrdinal];
NonConfigInstance lastInstance = (NonConfigInstance) getLastNonConfigurationInstance();
boolean forceRestore = lastInstance != null && (lastInstance.config.diff(mOldConfig) & CONFIG_UI_MODE) != 0;
if (forceRestore || !state.shouldDisableRestore()) {
mStateManager.goToState(state, false);
}
PendingRequestArgs requestArgs = savedState.getParcelable(RUNTIME_STATE_PENDING_REQUEST_ARGS);
if (requestArgs != null) {
setWaitingForResult(requestArgs);
}
mPendingActivityRequestCode = savedState.getInt(RUNTIME_STATE_PENDING_REQUEST_CODE);
mPendingActivityResult = savedState.getParcelable(RUNTIME_STATE_PENDING_ACTIVITY_RESULT);
SparseArray<Parcelable> widgetsState = savedState.getSparseParcelableArray(RUNTIME_STATE_WIDGET_PANEL);
if (widgetsState != null) {
WidgetsFullSheet.show(this, false).restoreHierarchyState(widgetsState);
}
}
use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.
the class AllAppsTransitionController method setState.
/**
* Sets the vertical transition progress to {@param state} and updates all the dependent UI
* accordingly.
*/
@Override
public void setState(LauncherState state) {
setProgress(state.getVerticalProgress(mLauncher));
setAlphas(state, new StateAnimationConfig(), NO_ANIM_PROPERTY_SETTER);
onProgressAnimationEnd();
}
use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.
the class OverviewToHomeAnim method animateWithVelocity.
/**
* Starts the animation. If velocity < 0 (i.e. upwards), also plays a
* {@link WorkspaceRevealAnim}.
*/
public void animateWithVelocity(float velocity) {
StateManager<LauncherState> stateManager = mLauncher.getStateManager();
LauncherState startState = stateManager.getState();
if (startState != OVERVIEW) {
Log.e(TAG, "animateFromOverviewToHome: unexpected start state " + startState);
}
AnimatorSet anim = new AnimatorSet();
boolean playWorkspaceRevealAnim = velocity < 0;
if (playWorkspaceRevealAnim) {
WorkspaceRevealAnim workspaceRevealAnim = new WorkspaceRevealAnim(mLauncher, false);
workspaceRevealAnim.addAnimatorListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
mIsHomeStaggeredAnimFinished = true;
maybeOverviewToHomeAnimComplete();
}
});
anim.play(workspaceRevealAnim.getAnimators());
} else {
mIsHomeStaggeredAnimFinished = true;
}
StateAnimationConfig config = new StateAnimationConfig();
if (playWorkspaceRevealAnim) {
// WorkspaceRevealAnim handles the depth, so don't interfere.
config.animFlags |= StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
}
config.duration = startState.getTransitionDuration(mLauncher);
AnimatorSet stateAnim = stateManager.createAtomicAnimation(startState, NORMAL, config);
stateAnim.addListener(new AnimationSuccessListener() {
@Override
public void onAnimationSuccess(Animator animator) {
mIsOverviewHidden = true;
maybeOverviewToHomeAnimComplete();
}
});
anim.play(stateAnim);
stateManager.setCurrentAnimation(anim, NORMAL);
anim.start();
}
use of com.android.launcher3.LauncherState in project android_packages_apps_Launcher3 by crdroidandroid.
the class LauncherRecentsView method onTaskLaunchAnimationEnd.
@Override
protected void onTaskLaunchAnimationEnd(boolean success) {
if (success) {
mActivity.getStateManager().moveToRestState();
} else {
LauncherState state = mActivity.getStateManager().getState();
mActivity.getAllAppsController().setState(state);
}
super.onTaskLaunchAnimationEnd(success);
}
Aggregations