Skip to content
This repository was archived by the owner on Dec 17, 2023. It is now read-only.

Commit 7c64e3d

Browse files
committed
add option to change icon label size separately
1 parent c6a3a94 commit 7c64e3d

File tree

5 files changed

+27
-3
lines changed

5 files changed

+27
-3
lines changed

res/values/lean_strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@
9898
<string name="double_tap_to_lock_disable_warning">By disabling admin access, you will not be able to use double tap to lock on your home screen.</string>
9999

100100
<string name="icon_size_title">Icon size</string>
101+
<string name="icon_text_size_title">Icon label size</string>
101102

102103
<string name="icon_size_extra_small">Extra small (-25%)</string>
103104
<string name="icon_size_small">Small (-10%)</string>

res/xml/launcher_preferences.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,15 @@
264264
android:summary="%s"
265265
android:title="@string/icon_size_title" />
266266

267+
<ListPreference
268+
android:defaultValue="average"
269+
android:entries="@array/icon_size_names"
270+
android:entryValues="@array/icon_size_values"
271+
android:key="pref_icon_text_size"
272+
android:persistent="true"
273+
android:summary="%s"
274+
android:title="@string/icon_text_size_title" />
275+
267276
</PreferenceCategory>
268277

269278
<PreferenceCategory

src/com/android/launcher3/InvariantDeviceProfile.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ public InvariantDeviceProfile(InvariantDeviceProfile p) {
157157
iconSize = interpolatedDeviceProfileOut.iconSize * iconSizeModifier;
158158
landscapeIconSize = interpolatedDeviceProfileOut.landscapeIconSize * iconSizeModifier;
159159
iconBitmapSize = Utilities.pxFromDp(iconSize, dm);
160-
iconTextSize = interpolatedDeviceProfileOut.iconTextSize * iconSizeModifier;
160+
float iconTextSizeModifier = LeanSettings.getIconTextSizeModifier(context);
161+
iconTextSize = interpolatedDeviceProfileOut.iconTextSize * iconTextSizeModifier;
161162
fillResIconDpi = getLauncherIconDensity(iconBitmapSize);
162163

163164
// If the partner customization apk contains any grid overrides, apply them

src/com/google/android/apps/nexuslauncher/SettingsActivity.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ public void onCreate(Bundle bundle) {
116116
findPreference(LeanSettings.HOTSEAT_ICONS).setOnPreferenceChangeListener(this);
117117
findPreference(LeanSettings.FORCE_COLORED_G_ICON).setOnPreferenceChangeListener(this);
118118
findPreference(LeanSettings.ICON_SIZE).setOnPreferenceChangeListener(this);
119+
findPreference(LeanSettings.ICON_TEXT_SIZE).setOnPreferenceChangeListener(this);
119120
findPreference(LeanSettings.HOTSEAT_BACKGROUND).setOnPreferenceChangeListener(this);
120121
findPreference(LeanSettings.DARK_BOTTOM_SEARCH_BAR).setOnPreferenceChangeListener(this);
121122
findPreference(LeanSettings.DARK_TOP_SEARCH_BAR).setOnPreferenceChangeListener(this);
@@ -201,6 +202,7 @@ public boolean onPreferenceChange(Preference preference, final Object newValue)
201202
case LeanSettings.GRID_ROWS:
202203
case LeanSettings.HOTSEAT_ICONS:
203204
case LeanSettings.ICON_SIZE:
205+
case LeanSettings.ICON_TEXT_SIZE:
204206
if (preference instanceof ListPreference) {
205207
((ListPreference) preference).setValue((String) newValue);
206208
}

src/com/hdeva/launcher/LeanSettings.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class LeanSettings {
2424
public static final String FORCE_COLORED_G_ICON = "pref_colored_g_icon";
2525
public static final String DOUBLE_TAP_TO_LOCK = "pref_double_tap_to_lock";
2626
public static final String ICON_SIZE = "pref_icon_size";
27+
public static final String ICON_TEXT_SIZE = "pref_icon_text_size";
2728
public static final String RESET_APP_VISIBILITY_ON_DEFAULT_ICON_PACK = "pref_reset_app_visibility_on_default_icon_pack";
2829
public static final String SEARCH_PROVIDER = "pref_search_provider";
2930
public static final String HOTSEAT_BACKGROUND = "pref_hotseat_background";
@@ -65,6 +66,7 @@ public class LeanSettings {
6566
private static final boolean FORCE_COLORED_G_ICON_DEFAULT = false;
6667
private static final boolean DOUBLE_TAP_TO_LOCK_DEFAULT = false;
6768
private static final String ICON_SIZE_DEFAULT = "average";
69+
private static final String ICON_TEXT_SIZE_DEFAULT = "average";
6870
private static final boolean RESET_APP_VISIBILITY_ON_DEFAULT_ICON_PACK_DEFAULT = true;
6971
private static final String SEARCH_PROVIDER_DEFAULT = "https://www.google.com";
7072
private static final String HOTSEAT_BACKGROUND_DEFAULT = "100";
@@ -204,9 +206,18 @@ private static int getIconCount(Context context, String preferenceName, String p
204206
}
205207

206208
public static float getIconSizeModifier(Context context) {
207-
String saved = prefs(context).getString(ICON_SIZE, ICON_SIZE_DEFAULT);
209+
String modifier = prefs(context).getString(ICON_SIZE, ICON_SIZE_DEFAULT);
210+
return translateModifier(modifier);
211+
}
212+
213+
public static float getIconTextSizeModifier(Context context) {
214+
String modifier = prefs(context).getString(ICON_TEXT_SIZE, ICON_TEXT_SIZE_DEFAULT);
215+
return translateModifier(modifier);
216+
}
217+
218+
private static float translateModifier(String modifier) {
208219
float offset;
209-
switch (saved) {
220+
switch (modifier) {
210221
case "extrasmall":
211222
offset = 0.75F;
212223
break;

0 commit comments

Comments
 (0)