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

Commit 0f200c1

Browse files
committed
hotfix for custom icon changing, bump version
1 parent 52056a7 commit 0f200c1

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ buildscript {
1313

1414
allprojects {
1515
ext {
16-
version_name = "1.1.1"
17-
version_code = 16
16+
version_name = "1.1.2"
17+
version_code = 17
1818

1919
compile_sdk_version = 27
2020
min_sdk_version = 21

src/com/hdeva/launcher/LeanSettings.java

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.content.ComponentName;
44
import android.content.Context;
55
import android.content.SharedPreferences;
6+
import android.text.TextUtils;
67
import android.util.Pair;
78

89
import com.android.launcher3.Utilities;
@@ -340,11 +341,19 @@ public static Pair<String, Integer> getCustomIcon(Context context, ComponentName
340341
}
341342

342343
public static void setCustomIcon(Context context, String forComponent, String iconPack, int iconResId) {
343-
Utilities.getCustomIconPrefs(context)
344-
.edit()
345-
.putString(String.format(CUSTOM_ICON_PACK_KEY_TEMPLATE, forComponent), iconPack)
346-
.putInt(String.format(CUSTOM_ICON_RES_KEY_TEMPLATE, forComponent), iconResId)
347-
.apply();
344+
if (TextUtils.isEmpty(forComponent)) {
345+
return;
346+
}
347+
348+
ComponentName componentName = ComponentName.unflattenFromString(forComponent);
349+
350+
if (componentName != null) {
351+
Utilities.getCustomIconPrefs(context)
352+
.edit()
353+
.putString(String.format(CUSTOM_ICON_PACK_KEY_TEMPLATE, componentName.flattenToString()), iconPack)
354+
.putInt(String.format(CUSTOM_ICON_RES_KEY_TEMPLATE, componentName.flattenToString()), iconResId)
355+
.apply();
356+
}
348357
}
349358

350359
private static SharedPreferences prefs(Context context) {

0 commit comments

Comments
 (0)