From 1124c478d3ffee0a3aa8b4805c9456eccd5f79c0 Mon Sep 17 00:00:00 2001 From: ottoptj Date: Sun, 22 Dec 2024 04:50:03 +0200 Subject: [PATCH] Implemented showing hidden apps in shortcut selection --- .../java/eu/ottop/yamlauncher/MainActivity.kt | 17 +++++++++++++++-- app/src/main/res/values-de/strings.xml | 2 ++ app/src/main/res/values-fi/strings.xml | 2 ++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/home_preferences.xml | 3 ++- 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt index afd6d93..8718d87 100644 --- a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt +++ b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt @@ -113,6 +113,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh private var isJobActive = true private var isInitialOpen = false private var canLaunchShortcut = true + private var showHidden = false private var swipeThreshold = 100 private var swipeVelocityThreshold = 100 @@ -277,6 +278,17 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh contactAdapter?.shortcutIndex = index contactAdapter?.shortcutTextView = textView internetSearch.visibility = View.GONE + + if (sharedPreferenceManager.showHiddenShortcuts()) { + lifecycleScope.launch(Dispatchers.Default) { + showHidden = true + refreshAppMenu() + runOnUiThread { + toAppMenu() // This is intentionally slow to happen + } + } + return true + } toAppMenu() return true @@ -711,6 +723,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh fun backToHome(animSpeed: Long = sharedPreferenceManager.getAnimationSpeed()) { canLaunchShortcut = true + showHidden = false closeKeyboard() animations.showHome(binding.homeView, binding.appView, animSpeed) animations.backgroundOut(this@MainActivity, animSpeed) @@ -745,7 +758,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh // Don't reset app menu while under a search if (isJobActive) { - val updatedApps = appUtils.getInstalledApps() + val updatedApps = appUtils.getInstalledApps(showHidden) if (!listsEqual(installedApps, updatedApps)) { updateMenu(updatedApps) @@ -987,7 +1000,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh when (menuView.displayedChild) { 0 -> { val newFilteredApps = mutableListOf>() - val updatedApps = appUtils.getInstalledApps() + val updatedApps = appUtils.getInstalledApps(showHidden) val filteredApps = getFilteredApps(cleanQuery, newFilteredApps, updatedApps) if (filteredApps != null) { applySearchFilter(filteredApps) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 9959f3f..2c3c0d3 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -106,6 +106,8 @@ Verknüpfungsgröße Verknüpfungsabstand Lock Shortcuts + Hidden Apps + Show Hidden Apps in Shortcut Selection Gesten Linkswisch diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index c088ac1..bf35815 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -104,6 +104,8 @@ Pikakuvakkeiden Koko Pikakuvakkeiden Väli Lukitse Pikakuvakkeet + Hidden Apps + Show Hidden Apps in Shortcut Selection Eleet Vasen Pyyhkäisy diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6fc7897..703d45a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -106,6 +106,8 @@ Shortcut Size Shortcut Spacing Lock Shortcuts + Hidden Apps + Show Hidden Apps in Shortcut Selection Gestures Swipe Left diff --git a/app/src/main/res/xml/home_preferences.xml b/app/src/main/res/xml/home_preferences.xml index 82a6d3c..a8ece67 100644 --- a/app/src/main/res/xml/home_preferences.xml +++ b/app/src/main/res/xml/home_preferences.xml @@ -202,7 +202,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:defaultValue="true" - android:title="@string/lock_shortcuts" + android:title="@string/hidden_shortcut_title" + android:summary="@string/hidden_shortcuts" app:key="showHiddenShortcuts" />