mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Changing the state UI logic for normal build and quickStep build
> Creating ShareHandlers for managing UI > In normal build, hotseat is hidden in overview, while in QuickStepBuild, it is visible Change-Id: I5f8d35c75b861d912d93fce186b5dd74106184c3
This commit is contained in:
@@ -15,10 +15,12 @@ import android.view.animation.Interpolator;
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager;
|
||||
import com.android.launcher3.LauncherStateManager.AnimationConfig;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.anim.AnimationLayerSet;
|
||||
import com.android.launcher3.anim.AnimationSuccessListener;
|
||||
import com.android.launcher3.anim.Interpolators;
|
||||
import com.android.launcher3.graphics.GradientView;
|
||||
@@ -35,7 +37,8 @@ import com.android.launcher3.util.Themes;
|
||||
* If release velocity < THRES1, snap according to either top or bottom depending on whether it's
|
||||
* closer to top or closer to the page indicator.
|
||||
*/
|
||||
public class AllAppsTransitionController implements SearchUiManager.OnScrollRangeChangeListener {
|
||||
public class AllAppsTransitionController
|
||||
implements SearchUiManager.OnScrollRangeChangeListener, LauncherStateManager.StateHandler {
|
||||
|
||||
private static final Property<AllAppsTransitionController, Float> PROGRESS =
|
||||
new Property<AllAppsTransitionController, Float>(Float.class, "progress") {
|
||||
@@ -122,8 +125,8 @@ public class AllAppsTransitionController implements SearchUiManager.OnScrollRang
|
||||
*
|
||||
* @param progress value between 0 and 1, 0 shows all apps and 1 shows workspace
|
||||
*
|
||||
* @see #setFinalProgress(float)
|
||||
* @see #animateToFinalProgress(float, AnimatorSet, AnimationConfig)
|
||||
* @see #setState(LauncherState)
|
||||
* @see #setStateWithAnimation(LauncherState, AnimationLayerSet, AnimatorSet, AnimationConfig)
|
||||
*/
|
||||
public void setProgress(float progress) {
|
||||
mProgress = progress;
|
||||
@@ -161,33 +164,32 @@ public class AllAppsTransitionController implements SearchUiManager.OnScrollRang
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the vertical transition progress to {@param progress} and updates all the dependent UI
|
||||
* Sets the vertical transition progress to {@param state} and updates all the dependent UI
|
||||
* accordingly.
|
||||
*/
|
||||
public void setFinalProgress(float progress) {
|
||||
setProgress(progress);
|
||||
@Override
|
||||
public void setState(LauncherState state) {
|
||||
setProgress(state.verticalProgress);
|
||||
onProgressAnimationEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an animation which updates the vertical transition progress and updates all the
|
||||
* dependent UI using various animation events
|
||||
*
|
||||
* @param progress the final vertical progress at the end of the animation
|
||||
* @param animationOut the target AnimatorSet where this animation should be added
|
||||
* @param outConfig an in/out configuration which can be shared with other animations
|
||||
*/
|
||||
public void animateToFinalProgress(
|
||||
float progress, AnimatorSet animationOut, AnimationConfig outConfig) {
|
||||
if (Float.compare(mProgress, progress) == 0) {
|
||||
@Override
|
||||
public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
|
||||
AnimatorSet animationOut, AnimationConfig config) {
|
||||
if (Float.compare(mProgress, toState.verticalProgress) == 0) {
|
||||
// Fail fast
|
||||
onProgressAnimationEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
Interpolator interpolator = outConfig.userControlled ? LINEAR : FAST_OUT_SLOW_IN;
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(this, PROGRESS, mProgress, progress);
|
||||
anim.setDuration(outConfig.duration);
|
||||
Interpolator interpolator = config.userControlled ? LINEAR : FAST_OUT_SLOW_IN;
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(
|
||||
this, PROGRESS, mProgress, toState.verticalProgress);
|
||||
anim.setDuration(config.duration);
|
||||
anim.setInterpolator(interpolator);
|
||||
anim.addListener(new AnimationSuccessListener() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user