Lawnchair: Customize IDP

This commit is contained in:
Kshitij Gupta
2021-03-07 20:19:53 +05:30
parent eb828ea8b9
commit 3373bcf13b
2 changed files with 44 additions and 0 deletions
@@ -28,6 +28,7 @@ import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.content.res.TypedArray;
@@ -61,6 +62,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import ch.deletescape.lawnchair.sharedprefs.LawnchairPreferences;
public class InvariantDeviceProfile {
public static final String TAG = "IDP";
@@ -298,6 +301,25 @@ public class InvariantDeviceProfile {
ComponentName cn = new ComponentName(context.getPackageName(), getClass().getName());
defaultWidgetPadding = AppWidgetHostView.getDefaultPaddingForWidget(context, cn, null);
// Lawnchair prefs
SharedPreferences prefs = LawnchairPreferences.Companion.getInstance(context);
if (prefs == null) return;
// Lawnchair grid sizes
numHotseatIcons = prefs.getInt(LawnchairPreferences.HOTSEAT_COLUMNS, numHotseatIcons);
numRows = prefs.getInt(LawnchairPreferences.WORKSPACE_ROWS, numRows);
numColumns = prefs.getInt(LawnchairPreferences.WORKSPACE_COLUMNS, numColumns);
numAllAppsColumns = prefs.getInt(LawnchairPreferences.ALL_APPS_COLUMNS, numAllAppsColumns);
numFolderRows = prefs.getInt(LawnchairPreferences.FOLDER_ROWS, numFolderRows);
numFolderColumns = prefs.getInt(LawnchairPreferences.FOLDER_COLUMNS, numFolderColumns);
// Lawnchair icon and text sizes
iconSize = prefs.getFloat(LawnchairPreferences.ICON_SIZE_FACTOR, 1f) * iconSize;
iconTextSize = prefs.getFloat(LawnchairPreferences.TEXT_SIZE_FACTOR, 1f) * iconTextSize;
allAppsIconSize = prefs.getFloat(LawnchairPreferences.ALL_APPS_ICON_SIZE_FACTOR, 1f) * allAppsIconSize;
allAppsIconTextSize = prefs.getFloat(LawnchairPreferences.ALL_APPS_TEXT_SIZE_FACTOR, 1f) * allAppsIconTextSize;
}
@Nullable