Disable auto-launching of searched apps

Closes #60
This commit is contained in:
Finn M Glas 2020-06-28 07:11:04 +02:00
parent d16c20f5a6
commit f4a590f373
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
2 changed files with 7 additions and 3 deletions

View file

@ -56,6 +56,7 @@ const val PREF_WALLPAPER = "background_uri"
const val PREF_THEME = "theme" const val PREF_THEME = "theme"
const val PREF_SCREEN_TIMEOUT_DISABLED = "disableTimeout" const val PREF_SCREEN_TIMEOUT_DISABLED = "disableTimeout"
const val PREF_SEARCH_AUTO_LAUNCH = "searchAutoLaunch"
const val PREF_STARTED = "startedBefore" const val PREF_STARTED = "startedBefore"
const val PREF_STARTED_TIME = "firstStartup" const val PREF_STARTED_TIME = "firstStartup"
@ -358,6 +359,7 @@ fun resetSettings(context: Context) {
.putInt(PREF_VIBRANT, vibrantColor) .putInt(PREF_VIBRANT, vibrantColor)
.putString(PREF_THEME, "finn") .putString(PREF_THEME, "finn")
.putBoolean(PREF_SCREEN_TIMEOUT_DISABLED, false) .putBoolean(PREF_SCREEN_TIMEOUT_DISABLED, false)
.putBoolean(PREF_SEARCH_AUTO_LAUNCH, false)
// load action defaults // load action defaults
for (actionKey in ACTIONS) for (actionKey in ACTIONS)

View file

@ -167,9 +167,11 @@ class AppsRecyclerAdapter(val activity: Activity,
} }
} }
// Launch apps automatically if only one result is found // Launch apps automatically if only one result is found and the user wants it
// TODO: Add option to disable this // Disabled at the moment. The Setting 'PREF_SEARCH_AUTO_LAUNCH' may be
if (appsListDisplayed.size == 1 && intention == "view") { // modifyable at some later point.
if (appsListDisplayed.size == 1 && intention == "view"
&& launcherPreferences.getBoolean(PREF_SEARCH_AUTO_LAUNCH, false)) {
launch(appsListDisplayed[0].packageName.toString(), activity) launch(appsListDisplayed[0].packageName.toString(), activity)
val inputMethodManager = activity.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager val inputMethodManager = activity.getSystemService(Activity.INPUT_METHOD_SERVICE) as InputMethodManager