Implemented showing hidden apps in shortcut selection

This commit is contained in:
ottoptj 2024-12-22 04:50:03 +02:00
commit 1124c478d3
5 changed files with 23 additions and 3 deletions

View file

@ -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<Triple<LauncherActivityInfo, UserHandle, Int>>()
val updatedApps = appUtils.getInstalledApps()
val updatedApps = appUtils.getInstalledApps(showHidden)
val filteredApps = getFilteredApps(cleanQuery, newFilteredApps, updatedApps)
if (filteredApps != null) {
applySearchFilter(filteredApps)

View file

@ -106,6 +106,8 @@
<string name="shortcut_size">Verknüpfungsgröße</string>
<string name="shortcut_spacing">Verknüpfungsabstand</string>
<string name="lock_shortcuts">Lock Shortcuts</string>
<string name="hidden_shortcut_title">Hidden Apps</string>
<string name="hidden_shortcuts">Show Hidden Apps in Shortcut Selection</string>
<string name="gestures">Gesten</string>
<string name="swipe_left">Linkswisch</string>

View file

@ -104,6 +104,8 @@
<string name="shortcut_size">Pikakuvakkeiden Koko</string>
<string name="shortcut_spacing">Pikakuvakkeiden Väli</string>
<string name="lock_shortcuts">Lukitse Pikakuvakkeet</string>
<string name="hidden_shortcut_title">Hidden Apps</string>
<string name="hidden_shortcuts">Show Hidden Apps in Shortcut Selection</string>
<string name="gestures">Eleet</string>
<string name="swipe_left">Vasen Pyyhkäisy</string>

View file

@ -106,6 +106,8 @@
<string name="shortcut_size">Shortcut Size</string>
<string name="shortcut_spacing">Shortcut Spacing</string>
<string name="lock_shortcuts">Lock Shortcuts</string>
<string name="hidden_shortcut_title">Hidden Apps</string>
<string name="hidden_shortcuts">Show Hidden Apps in Shortcut Selection</string>
<string name="gestures">Gestures</string>
<string name="swipe_left">Swipe Left</string>

View file

@ -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" />
</PreferenceCategory>
<PreferenceCategory