mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-05 01:47:24 +00:00
Added an option to automatically launch the final search result app when it becomes the only item in the menu
This commit is contained in:
parent
493d0aff07
commit
2a5710c6bb
3 changed files with 15 additions and 1 deletions
|
|
@ -854,7 +854,9 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun applySearchFilter(newFilteredApps: MutableList<Triple<LauncherActivityInfo, UserHandle, Int>>) {
|
private suspend fun applySearchFilter(newFilteredApps: MutableList<Triple<LauncherActivityInfo, UserHandle, Int>>) {
|
||||||
if (!listsEqual(installedApps, newFilteredApps)) {
|
if (sharedPreferenceManager.isAutoLaunchEnabled() && newFilteredApps.size == 1) {
|
||||||
|
appUtils.launchApp(newFilteredApps[0].first.applicationInfo.packageName, newFilteredApps[0].second)
|
||||||
|
} else if (!listsEqual(installedApps, newFilteredApps)) {
|
||||||
updateMenu(newFilteredApps)
|
updateMenu(newFilteredApps)
|
||||||
|
|
||||||
installedApps = newFilteredApps
|
installedApps = newFilteredApps
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,10 @@ class SharedPreferenceManager (private val context: Context) {
|
||||||
return preferences.getBoolean("autoKeyboard", false)
|
return preferences.getBoolean("autoKeyboard", false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isAutoLaunchEnabled(): Boolean {
|
||||||
|
return preferences.getBoolean("autoLaunch", false)
|
||||||
|
}
|
||||||
|
|
||||||
fun areContactsEnabled(): Boolean {
|
fun areContactsEnabled(): Boolean {
|
||||||
return preferences.getBoolean("contactsEnabled", false)
|
return preferences.getBoolean("contactsEnabled", false)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,14 @@
|
||||||
android:title="Automatically Open Keyboard"
|
android:title="Automatically Open Keyboard"
|
||||||
app:dependency="searchEnabled"
|
app:dependency="searchEnabled"
|
||||||
app:key="autoKeyboard" />
|
app:key="autoKeyboard" />
|
||||||
|
<SwitchPreference
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:title="Automatic App Opening"
|
||||||
|
app:dependency="searchEnabled"
|
||||||
|
app:key="autoLaunch"
|
||||||
|
app:summary="Automatically launch an app when it's the last search result" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue