From d2bf42b7e84fb0856e4b92dd32c6f2c286b26617 Mon Sep 17 00:00:00 2001 From: Saul Henriquez Date: Tue, 29 Sep 2020 13:15:54 -0600 Subject: [PATCH] Fix Custom app drawer labels lost after restarting #11 Signed-off-by: Saul Henriquez --- Omega/src/com/saggitt/omega/OmegaPreferences.kt | 7 +++---- src/com/android/launcher3/WorkspaceItemInfo.java | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Omega/src/com/saggitt/omega/OmegaPreferences.kt b/Omega/src/com/saggitt/omega/OmegaPreferences.kt index 12b993a0c2..e1c44aab15 100644 --- a/Omega/src/com/saggitt/omega/OmegaPreferences.kt +++ b/Omega/src/com/saggitt/omega/OmegaPreferences.kt @@ -18,15 +18,14 @@ package com.saggitt.omega import android.annotation.SuppressLint -import android.content.ComponentName import android.content.Context import android.content.SharedPreferences import android.os.Looper -import android.os.Process import android.text.TextUtils import com.android.launcher3.LauncherAppState import com.android.launcher3.LauncherFiles import com.android.launcher3.R +import com.android.launcher3.Utilities.makeComponentKey import com.android.launcher3.allapps.search.DefaultAppSearchAlgorithm import com.android.launcher3.util.ComponentKey import com.android.launcher3.util.Executors @@ -185,14 +184,14 @@ class OmegaPreferences(val context: Context) : SharedPreferences.OnSharedPrefere val customAppName = object : MutableMapPref("pref_appNameMap", reloadAll) { override fun flattenKey(key: ComponentKey) = key.toString() - override fun unflattenKey(key: String) = ComponentKey(ComponentName(context, key), Process.myUserHandle()) + override fun unflattenKey(key: String) = makeComponentKey(context, key) override fun flattenValue(value: String) = value override fun unflattenValue(value: String) = value } val customAppIcon = object : MutableMapPref("pref_appIconMap", reloadAll) { override fun flattenKey(key: ComponentKey) = key.toString() - override fun unflattenKey(key: String) = ComponentKey(ComponentName(context, key), Process.myUserHandle()) + override fun unflattenKey(key: String) = makeComponentKey(context, key) override fun flattenValue(value: IconPackManager.CustomIconEntry) = value.toString() override fun unflattenValue(value: String) = IconPackManager.CustomIconEntry.fromString(value) } diff --git a/src/com/android/launcher3/WorkspaceItemInfo.java b/src/com/android/launcher3/WorkspaceItemInfo.java index 9d5f5893c5..4644c3778d 100644 --- a/src/com/android/launcher3/WorkspaceItemInfo.java +++ b/src/com/android/launcher3/WorkspaceItemInfo.java @@ -242,9 +242,9 @@ private void updateDatabase(Context context, boolean updateIcon, boolean reload) } public void onLoadCustomizations(String titleAlias, String swipeUpAction, - IconPackManager.CustomIconEntry customEntry, Bitmap icon) { + IconPackManager.CustomIconEntry customIcon, Bitmap icon) { customTitle = titleAlias; - customIconEntry = customEntry; + customIconEntry = customIcon; this.customIcon = icon; this.swipeUpAction = swipeUpAction; }