mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 01:46:49 +00:00
Fix taskbar layout issues in setup wizard
- Align nav buttons (only back is enabled) to start instead of end - Don't animate from init() - Provide 0 contentInsets.bottom - Auto-stash the taskbar during setup - Hide the stashed handle by adding an alpha channel for home disabled - Report 0 contentInsets when stashed if the handle isn't visible - Tint nav buttons according to theme Test: adb shell am start -a android.intent.action.MAIN -n com.google.android.setupwizard/.SetupWizardTestActivity Bug: 194786060 Change-Id: I4a40501e8aad2a38ec00398efe9ea3dbfa7428cd
This commit is contained in:
@@ -25,15 +25,21 @@ import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.provider.Settings;
|
||||
import android.view.ViewConfiguration;
|
||||
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
|
||||
import com.android.launcher3.util.SettingsCache;
|
||||
import com.android.quickstep.AnimatedFloat;
|
||||
import com.android.quickstep.SystemUiProxy;
|
||||
import com.android.quickstep.interaction.AllSetActivity;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
|
||||
import java.util.function.IntPredicate;
|
||||
|
||||
@@ -47,11 +53,12 @@ public class TaskbarStashController {
|
||||
public static final int FLAG_STASHED_IN_APP_MANUAL = 1 << 1; // long press, persisted
|
||||
public static final int FLAG_STASHED_IN_APP_PINNED = 1 << 2; // app pinning
|
||||
public static final int FLAG_STASHED_IN_APP_EMPTY = 1 << 3; // no hotseat icons
|
||||
public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 4;
|
||||
public static final int FLAG_STASHED_IN_APP_SETUP = 1 << 4; // setup wizard and AllSetActivity
|
||||
public static final int FLAG_IN_STASHED_LAUNCHER_STATE = 1 << 5;
|
||||
|
||||
// If we're in an app and any of these flags are enabled, taskbar should be stashed.
|
||||
public static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL
|
||||
| FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY;
|
||||
| FLAG_STASHED_IN_APP_PINNED | FLAG_STASHED_IN_APP_EMPTY | FLAG_STASHED_IN_APP_SETUP;
|
||||
|
||||
/**
|
||||
* How long to stash/unstash when manually invoked via long press.
|
||||
@@ -103,7 +110,7 @@ public class TaskbarStashController {
|
||||
private AnimatedFloat mIconScaleForStash;
|
||||
private AnimatedFloat mIconTranslationYForStash;
|
||||
// Stashed handle properties.
|
||||
private AnimatedFloat mTaskbarStashedHandleAlpha;
|
||||
private AlphaProperty mTaskbarStashedHandleAlpha;
|
||||
private AnimatedFloat mTaskbarStashedHandleHintScale;
|
||||
|
||||
/** Whether we are currently visually stashed (might change based on launcher state). */
|
||||
@@ -143,12 +150,14 @@ public class TaskbarStashController {
|
||||
|
||||
StashedHandleViewController stashedHandleController =
|
||||
controllers.stashedHandleViewController;
|
||||
mTaskbarStashedHandleAlpha = stashedHandleController.getStashedHandleAlpha();
|
||||
mTaskbarStashedHandleAlpha = stashedHandleController.getStashedHandleAlpha().getProperty(
|
||||
StashedHandleViewController.ALPHA_INDEX_STASHED);
|
||||
mTaskbarStashedHandleHintScale = stashedHandleController.getStashedHandleHintScale();
|
||||
|
||||
boolean isManuallyStashedInApp = supportsManualStashing()
|
||||
&& mPrefs.getBoolean(SHARED_PREFS_STASHED_KEY, DEFAULT_STASHED_PREF);
|
||||
updateStateForFlag(FLAG_STASHED_IN_APP_MANUAL, isManuallyStashedInApp);
|
||||
updateStateForFlag(FLAG_STASHED_IN_APP_SETUP, isInSetup());
|
||||
applyState();
|
||||
|
||||
SystemUiProxy.INSTANCE.get(mActivity)
|
||||
@@ -176,6 +185,23 @@ public class TaskbarStashController {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether we are in Setup Wizard or the corresponding AllSetActivity that follows it.
|
||||
*/
|
||||
private boolean isInSetup() {
|
||||
boolean isInSetup = !SettingsCache.INSTANCE.get(mActivity).getValue(
|
||||
Settings.Secure.getUriFor(Settings.Secure.USER_SETUP_COMPLETE), 0);
|
||||
if (isInSetup) {
|
||||
return true;
|
||||
}
|
||||
ActivityManager.RunningTaskInfo runningTask =
|
||||
ActivityManagerWrapper.getInstance().getRunningTask();
|
||||
if (runningTask == null || runningTask.baseActivity == null) {
|
||||
return false;
|
||||
}
|
||||
return runningTask.baseActivity.equals(new ComponentName(mActivity, AllSetActivity.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the taskbar is currently visually stashed.
|
||||
*/
|
||||
@@ -199,7 +225,12 @@ public class TaskbarStashController {
|
||||
}
|
||||
|
||||
public int getContentHeight() {
|
||||
return isStashed() ? mStashedHeight : mUnstashedHeight;
|
||||
if (isStashed()) {
|
||||
boolean isAnimating = mAnimator != null && mAnimator.isStarted();
|
||||
return mControllers.stashedHandleViewController.isStashedHandleVisible() || isAnimating
|
||||
? mStashedHeight : 0;
|
||||
}
|
||||
return mUnstashedHeight;
|
||||
}
|
||||
|
||||
public int getStashedHeight() {
|
||||
|
||||
Reference in New Issue
Block a user