mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Fix initialization error in LauncherState
This commit is contained in:
@@ -20,6 +20,7 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ValueAnimator;
|
||||
|
||||
import ch.deletescape.lawnchair.LawnchairLauncher;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager;
|
||||
@@ -50,7 +51,7 @@ public class BackButtonAlphaHandler implements LauncherStateManager.StateHandler
|
||||
return;
|
||||
}
|
||||
float fromAlpha = mOverviewInteractionState.getBackButtonAlpha();
|
||||
float toAlpha = toState.hideBackButton ? 0 : 1;
|
||||
float toAlpha = toState.hideBackButton && !UiFactory.hasBackGesture(mLauncher) ? 0 : 1;
|
||||
if (Float.compare(fromAlpha, toAlpha) != 0) {
|
||||
ValueAnimator anim = ValueAnimator.ofFloat(fromAlpha, toAlpha);
|
||||
anim.setDuration(config.duration);
|
||||
|
||||
@@ -107,7 +107,8 @@ public class UiFactory {
|
||||
public static void onLauncherStateOrFocusChanged(Launcher launcher) {
|
||||
boolean shouldBackButtonBeHidden = launcher != null
|
||||
&& launcher.getStateManager().getState().hideBackButton
|
||||
&& launcher.hasWindowFocus();
|
||||
&& launcher.hasWindowFocus()
|
||||
&& !hasBackGesture(launcher);
|
||||
if (shouldBackButtonBeHidden) {
|
||||
// Show the back button if there is a floating view visible.
|
||||
shouldBackButtonBeHidden = AbstractFloatingView.getTopOpenViewWithType(launcher,
|
||||
@@ -117,6 +118,14 @@ public class UiFactory {
|
||||
.setBackButtonAlpha(shouldBackButtonBeHidden ? 0 : 1, true /* animate */);
|
||||
}
|
||||
|
||||
public static boolean hasBackGesture(Launcher launcher) {
|
||||
if (launcher instanceof LawnchairLauncher) {
|
||||
return ((LawnchairLauncher) launcher).getGestureController().getHasBackGesture();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetOverview(Launcher launcher) {
|
||||
RecentsView recents = launcher.getOverviewPanel();
|
||||
recents.reset();
|
||||
|
||||
Reference in New Issue
Block a user