Skip to content

Commit

Permalink
Fix Custom app drawer labels lost after restarting #11
Browse files Browse the repository at this point in the history
Signed-off-by: Saul Henriquez <[email protected]>
  • Loading branch information
saulhdev committed Sep 29, 2020
1 parent 5806038 commit d2bf42b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 3 additions & 4 deletions Omega/src/com/saggitt/omega/OmegaPreferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -185,14 +184,14 @@ class OmegaPreferences(val context: Context) : SharedPreferences.OnSharedPrefere

val customAppName = object : MutableMapPref<ComponentKey, String>("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<ComponentKey, IconPackManager.CustomIconEntry>("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)
}
Expand Down
4 changes: 2 additions & 2 deletions src/com/android/launcher3/WorkspaceItemInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit d2bf42b

Please sign in to comment.