mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Added scaling to the title of the shortcut selection menu and fixed auto launching bugs
This commit is contained in:
parent
fdc8fad134
commit
2e0d4e7957
2 changed files with 9 additions and 4 deletions
|
|
@ -233,6 +233,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
|
||||
ViewCompat.addAccessibilityAction(textView, "Set Shortcut App") { _, _ ->
|
||||
uiUtils.setMenuTitleAlignment(binding.menuTitle)
|
||||
uiUtils.setMenuTitleSize(binding.menuTitle)
|
||||
binding.menuTitle.visibility = View.VISIBLE
|
||||
|
||||
appAdapter?.shortcutTextView = textView
|
||||
|
|
@ -252,11 +253,12 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
|
||||
textView.setOnLongClickListener {
|
||||
uiUtils.setMenuTitleAlignment(binding.menuTitle)
|
||||
uiUtils.setMenuTitleSize(binding.menuTitle)
|
||||
binding.menuTitle.visibility = View.VISIBLE
|
||||
|
||||
appAdapter?.shortcutTextView = textView
|
||||
searchSwitcher.visibility = View.GONE
|
||||
toAppMenu()
|
||||
searchSwitcher.visibility = View.GONE
|
||||
|
||||
return@setOnLongClickListener true
|
||||
}
|
||||
|
|
@ -268,9 +270,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
appRecycler.scrollToPosition(0)
|
||||
if (searchSwitcher.visibility == View.VISIBLE) {
|
||||
contactRecycler.scrollToPosition(0)
|
||||
searchSwitcher.setImageDrawable(ResourcesCompat.getDrawable(resources, R.drawable.contacts_24px, null))
|
||||
menuView.displayedChild = 0
|
||||
searchSwitcher.contentDescription = getString(R.string.switch_to_contacts)
|
||||
setAppViewDetails()
|
||||
}
|
||||
}
|
||||
catch (_: UninitializedPropertyAccessException) {}
|
||||
|
|
@ -883,7 +884,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
}
|
||||
|
||||
private suspend fun applySearchFilter(newFilteredApps: MutableList<Triple<LauncherActivityInfo, UserHandle, Int>>) {
|
||||
if (sharedPreferenceManager.isAutoLaunchEnabled() && newFilteredApps.size == 1) {
|
||||
if (searchSwitcher.visibility == View.VISIBLE && menuView.displayedChild == 0 && newFilteredApps.size == 1) {
|
||||
appUtils.launchApp(newFilteredApps[0].first.applicationInfo.packageName, newFilteredApps[0].second)
|
||||
} else if (!listsEqual(installedApps, newFilteredApps)) {
|
||||
updateMenu(newFilteredApps)
|
||||
|
|
|
|||
|
|
@ -420,6 +420,10 @@ class UIUtils(private val context: Context) {
|
|||
setTextSize(searchView, sharedPreferenceManager.getSearchSize(), 18F, 21F, 25F, 27F, 30F, 33F)
|
||||
}
|
||||
|
||||
fun setMenuTitleSize(menuTitle: TextView) {
|
||||
setTextSize(menuTitle, sharedPreferenceManager.getAppSize(), 27F, 30F, 33F, 36F, 39F, 42F)
|
||||
}
|
||||
|
||||
private fun setTextSize(view: TextView, size: String?, t: Float, s: Float, m: Float, l: Float, x: Float, h: Float) {
|
||||
try {
|
||||
view.textSize = when (size) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue