mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 19:38:21 +00:00
Merge "Reland "Handle uiMode changes in QuickstepLauncher"" into main
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
android:stateNotNeeded="true"
|
||||
android:windowSoftInputMode="adjustPan"
|
||||
android:screenOrientation="unspecified"
|
||||
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize"
|
||||
android:configChanges="keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenSize|screenLayout|smallestScreenSize|uiMode"
|
||||
android:resizeableActivity="true"
|
||||
android:resumeWhilePausing="true"
|
||||
android:taskAffinity=""
|
||||
|
||||
@@ -80,12 +80,16 @@ public abstract class BaseDraggingActivity extends BaseActivity
|
||||
updateTheme();
|
||||
}
|
||||
|
||||
protected void updateTheme() {
|
||||
private void updateTheme() {
|
||||
if (mThemeRes != Themes.getActivityThemeRes(this)) {
|
||||
recreate();
|
||||
recreateToUpdateTheme();
|
||||
}
|
||||
}
|
||||
|
||||
protected void recreateToUpdateTheme() {
|
||||
recreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActionModeStarted(ActionMode mode) {
|
||||
super.onActionModeStarted(mode);
|
||||
|
||||
@@ -46,6 +46,7 @@ import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_
|
||||
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE_PENDING_ACTIVITY_RESULT;
|
||||
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE_PENDING_REQUEST_ARGS;
|
||||
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE_PENDING_REQUEST_CODE;
|
||||
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE_RECREATE_TO_UPDATE_THEME;
|
||||
import static com.android.launcher3.LauncherConstants.SavedInstanceKeys.RUNTIME_STATE_WIDGET_PANEL;
|
||||
import static com.android.launcher3.LauncherConstants.TraceEvents.COLD_STARTUP_TRACE_COOKIE;
|
||||
import static com.android.launcher3.LauncherConstants.TraceEvents.COLD_STARTUP_TRACE_METHOD_NAME;
|
||||
@@ -422,6 +423,8 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
private final SettingsCache.OnChangeListener mNaturalScrollingChangedListener =
|
||||
enabled -> mIsNaturalScrollingEnabled = enabled;
|
||||
|
||||
private boolean mRecreateToUpdateTheme = false;
|
||||
|
||||
public static Launcher getLauncher(Context context) {
|
||||
return fromContext(context);
|
||||
}
|
||||
@@ -1352,7 +1355,8 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
|
||||
NonConfigInstance lastInstance = (NonConfigInstance) getLastNonConfigurationInstance();
|
||||
boolean forceRestore = lastInstance != null
|
||||
&& (lastInstance.config.diff(mOldConfig) & CONFIG_UI_MODE) != 0;
|
||||
&& ((lastInstance.config.diff(mOldConfig) & CONFIG_UI_MODE) != 0
|
||||
|| savedState.getBoolean(RUNTIME_STATE_RECREATE_TO_UPDATE_THEME));
|
||||
if (forceRestore || !state.shouldDisableRestore()) {
|
||||
mStateManager.goToState(state, false /* animated */);
|
||||
}
|
||||
@@ -1746,6 +1750,12 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void recreateToUpdateTheme() {
|
||||
mRecreateToUpdateTheme = true;
|
||||
super.recreateToUpdateTheme();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(Bundle state) {
|
||||
super.onRestoreInstanceState(state);
|
||||
@@ -1791,6 +1801,8 @@ public class Launcher extends StatefulActivity<LauncherState>
|
||||
outState.putParcelable(RUNTIME_STATE_PENDING_ACTIVITY_RESULT, mPendingActivityResult);
|
||||
}
|
||||
|
||||
outState.putBoolean(RUNTIME_STATE_RECREATE_TO_UPDATE_THEME, mRecreateToUpdateTheme);
|
||||
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
|
||||
@@ -67,5 +67,8 @@ public class LauncherConstants {
|
||||
static final String RUNTIME_STATE_WIDGET_PANEL = "launcher.widget_panel";
|
||||
// Type int[]
|
||||
static final String RUNTIME_STATE_CURRENT_SCREEN_IDS = "launcher.current_screen_ids";
|
||||
// Type: boolean
|
||||
static final String RUNTIME_STATE_RECREATE_TO_UPDATE_THEME =
|
||||
"launcher.recreate_to_update_theme";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user