Skip to content

Commit

Permalink
feat: Added please_select_app to the home screen apps (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
CreativeCodeCat authored Mar 31, 2024
1 parent 805bb88 commit 65c7e9c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ class AppDrawerFragment : Fragment() {
val n = arguments?.getInt("n", 0) ?: 0

when (flag) {
AppDrawerFlag.SetHomeApp -> {
binding.drawerButton.text = getString(R.string.rename)
binding.drawerButton.isVisible = true
binding.drawerButton.setOnClickListener { renameListener(flag, n) }
}
AppDrawerFlag.SetHomeApp,
AppDrawerFlag.SetShortSwipeRight,
AppDrawerFlag.SetShortSwipeLeft,
AppDrawerFlag.SetShortSwipeUp,
Expand Down Expand Up @@ -132,6 +128,22 @@ class AppDrawerFragment : Fragment() {
} else
binding.search.queryHint = hiddenAppsHint
}
if (flag == AppDrawerFlag.SetHomeApp) {
val fontColor = getHexFontColor(requireActivity())
val hiddenAppsHint = getString(R.string.please_select_app)
if (prefs.followAccentColors) {
val coloredHint = SpannableString(hiddenAppsHint)
coloredHint.setSpan(
ForegroundColorSpan(fontColor),
0,
hiddenAppsHint.length,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
)

binding.search.queryHint = coloredHint
} else
binding.search.queryHint = hiddenAppsHint
}
if (flag == AppDrawerFlag.LaunchApp && prefs.useAllAppsText) {
val fontColor = getHexFontColor(requireActivity())
val allAppsHint = getString(R.string.show_apps)
Expand All @@ -156,12 +168,17 @@ class AppDrawerFragment : Fragment() {
}

override fun onQueryTextChange(newText: String?): Boolean {
newText?.let {
appAdapter.filter.filter(it.trim())
binding.drawerButton.apply {
isVisible = !newText.isNullOrEmpty()
text = if (isVisible) getString(R.string.rename) else null
setOnClickListener { if (isVisible) renameListener(flag, n) }
}
newText?.let { appAdapter.filter.filter(it.trim()) }
return false
}

})

}

@RequiresApi(Build.VERSION_CODES.Q)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-en-rCA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

<!-- Unsorted Strings -->
<string name="show_apps">All apps</string>
<string name="please_select_app">Please select an app</string>
<string name="drawer_list_empty_hint">No apps found</string>
<string name="long_press_for_settings">Long press anywhere for settings</string>
<string name="swipe_up_for_apps">Swipe up for all apps</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-en-rGB/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

<!-- Unsorted Strings -->
<string name="show_apps">All apps</string>
<string name="please_select_app">Please select an app</string>
<string name="drawer_list_empty_hint">No apps found</string>
<string name="long_press_for_settings">Long press anywhere for settings</string>
<string name="swipe_up_for_apps">Swipe up for all apps</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-en-rUS/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

<!-- Unsorted Strings -->
<string name="show_apps">All apps</string>
<string name="please_select_app">Please select an app</string>
<string name="drawer_list_empty_hint">No apps found</string>
<string name="long_press_for_settings">Long press anywhere for settings</string>
<string name="swipe_up_for_apps">Swipe up for all apps</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@

<!-- Unsorted Strings -->
<string name="show_apps">All apps</string>
<string name="please_select_app">Please select an app</string>
<string name="drawer_list_empty_hint">No apps found</string>
<string name="long_press_for_settings">Long press anywhere for settings</string>
<string name="swipe_up_for_apps">Swipe up for all apps</string>
Expand Down

0 comments on commit 65c7e9c

Please sign in to comment.