Loading bliss/res/values/arrays.xml +5 −0 Original line number Diff line number Diff line Loading @@ -7,4 +7,9 @@ <item>com.android.stk</item> <item>foundation.e.blissweather</item> </array> <!-- Key | Value string array to force alias --> <string-array name="aliased_apps"> <item>com.generalmagic.magicearth</item> <item>@string/maps</item> </string-array> </resources> bliss/res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -3,4 +3,5 @@ <string name="edit">Edit</string> <string name="search">Search</string> <string name="suggestions">SUGGESTIONS</string> <string name="maps">Maps</string> </resources> bliss/res_overrides/values/config.xml +1 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <string name="derived_app_name" translatable="false">BlissLauncher</string> <string name="launcher_activity_logic_class" translatable="false">foundation.e.bliss.LauncherActivityCachingLogic</string> <string-array name="filtered_components"> <item>@string/quickstep_component</item> Loading bliss/src/foundation/e/bliss/LauncherActivityCachingLogic.kt 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright © MURENA SAS 2023. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.bliss import android.content.Context import android.content.pm.LauncherActivityInfo import androidx.annotation.Keep import com.android.launcher3.R import com.android.launcher3.icons.LauncherActivityCachingLogic as BaseLogic import foundation.e.bliss.utils.resourcesToMap @Keep @Suppress("Unused") class LauncherActivityCachingLogic(context: Context) : BaseLogic() { private val aliasedApps by lazy { val list = context.resources.getStringArray(R.array.aliased_apps).toList() resourcesToMap(list) } override fun getLabel(info: LauncherActivityInfo): CharSequence { val customLabel = aliasedApps[info.componentName.packageName] return if (!customLabel.isNullOrEmpty()) { customLabel } else super.getLabel(info) } } bliss/src/foundation/e/bliss/utils/BlissUtils.kt +15 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ package foundation.e.bliss.utils import android.content.Context import android.view.View import android.view.inputmethod.InputMethodManager import kotlin.Exception fun Context.toggleKeyboard(view: View, hasFocus: Boolean) { val inputMethodManager = getSystemService(InputMethodManager::class.java) Loading @@ -29,3 +30,17 @@ fun Context.toggleKeyboard(view: View, hasFocus: Boolean) { inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) } } fun <T> resourcesToMap(array: List<T>): Map<T, T> { val map = mutableMapOf<T, T>() if (array.size.mod(2) == 0) { for (i in array.indices step 2) { map[array[i]] = array[i + 1] } } else { throw Exception("Failed to parse array resource") } return map } Loading
bliss/res/values/arrays.xml +5 −0 Original line number Diff line number Diff line Loading @@ -7,4 +7,9 @@ <item>com.android.stk</item> <item>foundation.e.blissweather</item> </array> <!-- Key | Value string array to force alias --> <string-array name="aliased_apps"> <item>com.generalmagic.magicearth</item> <item>@string/maps</item> </string-array> </resources>
bliss/res/values/strings.xml +2 −1 Original line number Diff line number Diff line Loading @@ -3,4 +3,5 @@ <string name="edit">Edit</string> <string name="search">Search</string> <string name="suggestions">SUGGESTIONS</string> <string name="maps">Maps</string> </resources>
bliss/res_overrides/values/config.xml +1 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <resources> <string name="derived_app_name" translatable="false">BlissLauncher</string> <string name="launcher_activity_logic_class" translatable="false">foundation.e.bliss.LauncherActivityCachingLogic</string> <string-array name="filtered_components"> <item>@string/quickstep_component</item> Loading
bliss/src/foundation/e/bliss/LauncherActivityCachingLogic.kt 0 → 100644 +31 −0 Original line number Diff line number Diff line /* * Copyright © MURENA SAS 2023. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/gpl.html */ package foundation.e.bliss import android.content.Context import android.content.pm.LauncherActivityInfo import androidx.annotation.Keep import com.android.launcher3.R import com.android.launcher3.icons.LauncherActivityCachingLogic as BaseLogic import foundation.e.bliss.utils.resourcesToMap @Keep @Suppress("Unused") class LauncherActivityCachingLogic(context: Context) : BaseLogic() { private val aliasedApps by lazy { val list = context.resources.getStringArray(R.array.aliased_apps).toList() resourcesToMap(list) } override fun getLabel(info: LauncherActivityInfo): CharSequence { val customLabel = aliasedApps[info.componentName.packageName] return if (!customLabel.isNullOrEmpty()) { customLabel } else super.getLabel(info) } }
bliss/src/foundation/e/bliss/utils/BlissUtils.kt +15 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ package foundation.e.bliss.utils import android.content.Context import android.view.View import android.view.inputmethod.InputMethodManager import kotlin.Exception fun Context.toggleKeyboard(view: View, hasFocus: Boolean) { val inputMethodManager = getSystemService(InputMethodManager::class.java) Loading @@ -29,3 +30,17 @@ fun Context.toggleKeyboard(view: View, hasFocus: Boolean) { inputMethodManager.hideSoftInputFromWindow(view.windowToken, 0) } } fun <T> resourcesToMap(array: List<T>): Map<T, T> { val map = mutableMapOf<T, T>() if (array.size.mod(2) == 0) { for (i in array.indices step 2) { map[array[i]] = array[i + 1] } } else { throw Exception("Failed to parse array resource") } return map }