add an option to search the web from the app list

This commit is contained in:
Josia Pietsch 2024-12-21 03:04:50 +01:00
parent 2d53562d58
commit 9216837879
Signed by: jrpie
GPG key ID: E70B571D66986A2D
5 changed files with 18 additions and 1 deletions

View file

@ -62,6 +62,7 @@ import eu.jonahbauer.android.preference.annotations.Preferences;
}),
@PreferenceGroup(name = "functionality", prefix = "settings_functionality_", suffix = "_key", value = {
@Preference(name = "search_auto_launch", type = boolean.class, defaultValue = "true"),
@Preference(name = "search_web", type = boolean.class, description = "false"),
@Preference(name = "search_auto_open_keyboard", type = boolean.class, defaultValue = "true"),
}),
@PreferenceGroup(name = "enabled_gestures", prefix = "settings_enabled_gestures_", suffix = "_key", value = {

View file

@ -1,5 +1,6 @@
package de.jrpie.android.launcher.ui.list.apps
import android.content.Intent
import android.content.SharedPreferences
import android.os.Bundle
import android.view.LayoutInflater
@ -86,7 +87,13 @@ class ListFragmentApps : Fragment(), UIObject {
override fun onQueryTextSubmit(query: String): Boolean {
appsRViewAdapter.setSearchString(query)
if (LauncherPreferences.functionality().searchWeb()) {
val i = Intent(Intent.ACTION_WEB_SEARCH).putExtra("query", query)
activity?.startActivity(i)
} else {
appsRViewAdapter.selectItem(0)
}
return true
}

View file

@ -140,6 +140,7 @@
<string name="settings_enabled_gestures_edge_swipe_key" translatable="false">enabled_gestures.edge_actions</string>
<string name="settings_enabled_gestures_edge_swipe_edge_width_key" translatable="false">enabled_gestures.edge_actions.edge_width</string>
<string name="settings_functionality_search_auto_launch_key" translatable="false">functionality.search_auto_launch</string>
<string name="settings_functionality_search_web_key" translatable="false">functionality.search_web</string>
<string name="settings_functionality_search_auto_open_keyboard_key" translatable="false">functionality.search_auto_keyboard</string>

View file

@ -136,6 +136,8 @@
<string name="settings_enabled_gestures_edge_swipe_summary">Swipe at the edge of the screen</string>
<string name="settings_enabled_gestures_edge_swipe_edge_width">Edge width</string>
<string name="settings_functionality_auto_launch">Launch search results</string>
<string name="settings_functionality_search_web">Search the web</string>
<string name="settings_functionality_search_web_summary">Press return while searching the app list to launch a web search.</string>
<string name="settings_functionality_auto_keyboard">Start keyboard for search</string>
<string name="settings_launcher_sensitivity">Sensitivity</string>

View file

@ -93,6 +93,12 @@
android:key="@string/settings_functionality_search_auto_launch_key"
android:defaultValue="true"
android:title="@string/settings_functionality_auto_launch" />
<SwitchPreference
android:key="@string/settings_functionality_search_web_key"
android:title="@string/settings_functionality_search_web"
android:defaultValue="false"
android:summary="@string/settings_functionality_search_web_summary"
/>
<SwitchPreference
android:key="@string/settings_functionality_search_auto_open_keyboard_key"
android:defaultValue="true"