mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-04 17:37:25 +00:00
Added a function to lock shortcuts.
This commit is contained in:
parent
ec512b25e6
commit
5d913b120c
6 changed files with 28 additions and 14 deletions
|
|
@ -239,19 +239,7 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
}
|
||||
|
||||
ViewCompat.addAccessibilityAction(textView, getString(R.string.accessibility_set_shortcut)) { _, _ ->
|
||||
uiUtils.setMenuTitleAlignment(menuTitle)
|
||||
uiUtils.setMenuTitleSize(menuTitle)
|
||||
menuTitle.hint = textView.text
|
||||
menuTitle.setText(textView.text)
|
||||
menuTitle.visibility = View.VISIBLE
|
||||
if (savedView != null) {
|
||||
setRenameShortcutListener(index, textView)
|
||||
}
|
||||
|
||||
appAdapter?.shortcutTextView = textView
|
||||
contactAdapter?.shortcutTextView = textView
|
||||
toAppMenu()
|
||||
true
|
||||
launchShortcutSelection(index, textView, savedView)
|
||||
}
|
||||
|
||||
ViewCompat.addAccessibilityAction(textView, getString(R.string.settings_title)) { _, _ ->
|
||||
|
|
@ -265,6 +253,13 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
}
|
||||
|
||||
textView.setOnLongClickListener {
|
||||
launchShortcutSelection(index, textView, savedView)
|
||||
}
|
||||
}
|
||||
|
||||
private fun launchShortcutSelection(index: Int, textView: TextView, savedView: List<String>?) : Boolean {
|
||||
|
||||
if (!sharedPreferenceManager.areShortcutsLocked()) {
|
||||
uiUtils.setMenuTitleAlignment(menuTitle)
|
||||
uiUtils.setMenuTitleSize(menuTitle)
|
||||
menuTitle.hint = textView.text
|
||||
|
|
@ -279,8 +274,10 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
contactAdapter?.shortcutTextView = textView
|
||||
toAppMenu()
|
||||
|
||||
return@setOnLongClickListener true
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
private fun setRenameShortcutListener(index: Int, textView: TextView) {
|
||||
|
|
@ -672,6 +669,10 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
setPreferences()
|
||||
setShortcuts()
|
||||
}
|
||||
|
||||
"lockShortcuts" -> {
|
||||
setShortcuts()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,10 @@ class SharedPreferenceManager (private val context: Context) {
|
|||
return preferences.getString("shortcutWeight", "0.09")?.toFloat()
|
||||
}
|
||||
|
||||
fun areShortcutsLocked(): Boolean {
|
||||
return preferences.getBoolean("lockShortcuts", false)
|
||||
}
|
||||
|
||||
fun isBatteryEnabled(): Boolean {
|
||||
return preferences.getBoolean("batteryEnabled", false)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
<string name="vertical_alignment">Vertikale Ausrichtung</string>
|
||||
<string name="shortcut_size">Verknüpfungsgröße</string>
|
||||
<string name="shortcut_spacing">Verknüpfungsabstand</string>
|
||||
<string name="lock_shortcuts">Lock Shortcuts</string>
|
||||
|
||||
<string name="gestures">Gesten</string>
|
||||
<string name="swipe_left">Linkswisch</string>
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@
|
|||
<string name="vertical_alignment">Pikakuvakkeiden Pystysijainti</string>
|
||||
<string name="shortcut_size">Pikakuvakkeiden koko</string>
|
||||
<string name="shortcut_spacing">Pikakuvakkeiden väli</string>
|
||||
<string name="lock_shortcuts">Lock Shortcuts</string>
|
||||
|
||||
<string name="gestures">Eleet</string>
|
||||
<string name="swipe_left">Vasen Pyyhkäisy</string>
|
||||
|
|
|
|||
|
|
@ -103,6 +103,7 @@
|
|||
<string name="vertical_alignment">Vertical Alignment</string>
|
||||
<string name="shortcut_size">Shortcut Size</string>
|
||||
<string name="shortcut_spacing">Shortcut Spacing</string>
|
||||
<string name="lock_shortcuts">Lock Shortcuts</string>
|
||||
|
||||
<string name="gestures">Gestures</string>
|
||||
<string name="swipe_left">Swipe Left</string>
|
||||
|
|
|
|||
|
|
@ -192,6 +192,12 @@
|
|||
app:key="shortcutWeight"
|
||||
app:title="@string/shortcut_spacing"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
<SwitchPreference
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:defaultValue="false"
|
||||
android:title="@string/lock_shortcuts"
|
||||
app:key="lockShortcuts" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue