Option to turn off app shortcuts

Closes #795
This commit is contained in:
Jays2Kings 2021-05-08 16:09:14 -04:00
parent ddcd4a51bf
commit d9fcf8f3f7
5 changed files with 17 additions and 0 deletions

View File

@ -204,6 +204,8 @@ object PreferenceKeys {
const val hideBottomNavOnScroll = "hide_bottom_nav_on_scroll" const val hideBottomNavOnScroll = "hide_bottom_nav_on_scroll"
const val showMangaAppShortcuts = "show_manga_app_shortcuts"
const val createLegacyBackup = "create_legacy_backup" const val createLegacyBackup = "create_legacy_backup"
const val dohProvider = "doh_provider" const val dohProvider = "doh_provider"

View File

@ -402,6 +402,7 @@ class PreferencesHelper(val context: Context) {
fun createLegacyBackup() = flowPrefs.getBoolean(Keys.createLegacyBackup, true) fun createLegacyBackup() = flowPrefs.getBoolean(Keys.createLegacyBackup, true)
fun dohProvider() = prefs.getInt(Keys.dohProvider, -1) fun dohProvider() = prefs.getInt(Keys.dohProvider, -1)
fun appShortcuts() = prefs.getBoolean(Keys.showMangaAppShortcuts, true)
fun incognitoMode() = flowPrefs.getBoolean(Keys.incognitoMode, false) fun incognitoMode() = flowPrefs.getBoolean(Keys.incognitoMode, false)
} }

View File

@ -77,6 +77,13 @@ class SettingsGeneralController : SettingsController() {
defaultValue = true defaultValue = true
} }
switchPreference {
key = Keys.showMangaAppShortcuts
titleRes = R.string.app_shortcuts
summaryRes = R.string.show_recent_in_shortcuts
defaultValue = true
}
switchPreference { switchPreference {
key = Keys.automaticUpdates key = Keys.automaticUpdates
titleRes = R.string.check_for_updates titleRes = R.string.check_for_updates

View File

@ -38,6 +38,11 @@ class MangaShortcutManager(
val context: Context = preferences.context val context: Context = preferences.context
fun updateShortcuts() { fun updateShortcuts() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N_MR1) {
if (!preferences.appShortcuts()) {
val shortcutManager = context.getSystemService(ShortcutManager::class.java)
shortcutManager.removeAllDynamicShortcuts()
return
}
GlobalScope.launchIO { GlobalScope.launchIO {
val shortcutManager = context.getSystemService(ShortcutManager::class.java) val shortcutManager = context.getSystemService(ShortcutManager::class.java)

View File

@ -611,6 +611,8 @@
<string name="auto_check_for_app_versions">Automatically check for new app versions</string> <string name="auto_check_for_app_versions">Automatically check for new app versions</string>
<string name="secure_screen">Secure screen</string> <string name="secure_screen">Secure screen</string>
<string name="hide_bottom_nav">Auto-hide bottom navigation</string> <string name="hide_bottom_nav">Auto-hide bottom navigation</string>
<string name="app_shortcuts">App shortcuts</string>
<string name="show_recent_in_shortcuts">Show recent sources and series in app shortcuts</string>
<string name="follow_system_theme">Follow system theme</string> <string name="follow_system_theme">Follow system theme</string>
<string name="hides_on_scroll">Hides when scrolling</string> <string name="hides_on_scroll">Hides when scrolling</string>
<string name="hide_app_block_screenshots">Hide app contents when switching apps and block screenshots</string> <string name="hide_app_block_screenshots">Hide app contents when switching apps and block screenshots</string>