Lawnchair: Fix icon size and label size reload, implement launcher restart

This commit is contained in:
Kshitij Gupta
2021-03-17 21:31:27 +05:30
parent 15c5ae0356
commit 480ac2c76b
17 changed files with 207 additions and 46 deletions

View File

@@ -45,13 +45,21 @@ import com.android.launcher3.util.SecureSettingsObserver;
import com.android.launcher3.util.SimpleBroadcastReceiver;
import com.android.launcher3.widget.custom.CustomWidgetManager;
import app.lawnchair.LawnchairAppKt;
public class LauncherAppState {
public static final String ACTION_FORCE_ROLOAD = "force-reload-launcher";
// We do not need any synchronization for this variable as its only written on UI thread.
public static final MainThreadInitializedObject<LauncherAppState> INSTANCE =
new MainThreadInitializedObject<>(LauncherAppState::new);
new MainThreadInitializedObject<LauncherAppState>(LauncherAppState::new) {
@Override
protected void onPostInit(Context context) {
super.onPostInit(context);
LawnchairAppKt.getLawnchairApp(context).onLauncherAppStateCreated();
}
};
private final Context mContext;
private final LauncherModel mModel;
@@ -65,6 +73,7 @@ public class LauncherAppState {
private SimpleBroadcastReceiver mModelChangeReceiver;
private SafeCloseable mCalendarChangeTracker;
private SafeCloseable mUserChangeListener;
private Launcher mLauncher;
public static LauncherAppState getInstance(final Context context) {
return INSTANCE.get(context);
@@ -177,6 +186,14 @@ public class LauncherAppState {
}
}
public void setLauncher(Launcher launcher) {
mLauncher = launcher;
}
public Launcher getLauncher() {
return mLauncher;
}
public IconCache getIconCache() {
return mIconCache;
}