Implement auto launching from search

I implemented it before, but now it can be enabled / disabled in 
settings.
This commit is contained in:
Finn M Glas 2020-08-21 00:15:10 +02:00
parent 93fdf19d46
commit 64d4738f9c
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
5 changed files with 49 additions and 28 deletions

View file

@ -111,6 +111,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
setSwitchColor(settings_launcher_switch_screen_timeout, vibrantColor) setSwitchColor(settings_launcher_switch_screen_timeout, vibrantColor)
setSwitchColor(settings_launcher_switch_screen_full, vibrantColor) setSwitchColor(settings_launcher_switch_screen_full, vibrantColor)
setSwitchColor(settings_launcher_switch_auto_launch, vibrantColor)
setSwitchColor(settings_launcher_switch_enable_double, vibrantColor) setSwitchColor(settings_launcher_switch_enable_double, vibrantColor)
settings_launcher_container.setBackgroundColor(dominantColor) settings_launcher_container.setBackgroundColor(dominantColor)
@ -137,7 +138,14 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
setWindowFlags(activity!!.window) setWindowFlags(activity!!.window)
} }
settings_launcher_switch_auto_launch.isChecked = launcherPreferences.getBoolean(PREF_SEARCH_AUTO_LAUNCH, false)
settings_launcher_switch_auto_launch.setOnCheckedChangeListener { _, isChecked -> // Toggle double actions
launcherPreferences.edit()
.putBoolean(PREF_SEARCH_AUTO_LAUNCH, isChecked)
.apply()
}
settings_launcher_switch_enable_double.isChecked = launcherPreferences.getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false) settings_launcher_switch_enable_double.isChecked = launcherPreferences.getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
settings_launcher_switch_enable_double.setOnCheckedChangeListener { _, isChecked -> // Toggle double actions settings_launcher_switch_enable_double.setOnCheckedChangeListener { _, isChecked -> // Toggle double actions
launcherPreferences.edit() launcherPreferences.edit()

View file

@ -43,9 +43,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings_launcher_time_format" android:text="@string/settings_launcher_time_format"
android:textSize="16sp" android:textSize="16sp" />
app:layout_constraintBottom_toTopOf="@id/settings_launcher_text_screen_timeout"
app:layout_constraintStart_toStartOf="parent" />
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"
@ -72,9 +70,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings_launcher_theme" android:text="@string/settings_launcher_theme"
android:textSize="16sp" android:textSize="16sp" />
app:layout_constraintBottom_toTopOf="@id/settings_launcher_text_screen_timeout"
app:layout_constraintStart_toStartOf="parent" />
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"
@ -134,9 +130,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings_launcher_disable_timeout" android:text="@string/settings_launcher_disable_timeout"
android:textSize="16sp" android:textSize="16sp" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settings_launcher_text_time_format" />
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"
@ -148,10 +142,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="false" android:checked="false"
android:textSize="18sp" android:textSize="18sp" />
app:layout_constraintBottom_toBottomOf="@id/settings_launcher_text_screen_timeout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/settings_launcher_text_screen_timeout" />
</LinearLayout> </LinearLayout>
@ -168,9 +159,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings_launcher_full_screen" android:text="@string/settings_launcher_full_screen"
android:textSize="16sp" android:textSize="16sp" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settings_launcher_text_time_format" />
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"
@ -182,10 +171,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="false" android:checked="false"
android:textSize="18sp" android:textSize="18sp" />
app:layout_constraintBottom_toBottomOf="@id/settings_launcher_text_screen_timeout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/settings_launcher_text_screen_timeout" />
</LinearLayout> </LinearLayout>
@ -215,14 +201,41 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="8sp"> android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_auto_launch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_auto_launch"
android:textSize="16sp" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Switch
android:id="@+id/settings_launcher_switch_auto_launch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView <TextView
android:id="@+id/settings_launcher_text_enable_double" android:id="@+id/settings_launcher_text_enable_double"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/settings_launcher_enable_double" android:text="@string/settings_launcher_enable_double"
android:textSize="16sp" android:textSize="16sp" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settings_launcher_text_time_format" />
<Space <Space
android:layout_width="0dp" android:layout_width="0dp"
@ -234,10 +247,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="false" android:checked="false"
android:textSize="18sp" android:textSize="18sp" />
app:layout_constraintBottom_toBottomOf="@id/settings_launcher_text_screen_timeout"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/settings_launcher_text_screen_timeout" />
</LinearLayout> </LinearLayout>

View file

@ -78,6 +78,7 @@
<string name="settings_launcher_section_functions">Funktionen</string> <string name="settings_launcher_section_functions">Funktionen</string>
<string name="settings_launcher_enable_double">Doppelte Wischaktionen</string> <string name="settings_launcher_enable_double">Doppelte Wischaktionen</string>
<string name="settings_launcher_auto_launch">Suchergebisse launchen</string>
<!-- <!--
- -

View file

@ -78,6 +78,7 @@
<string name="settings_launcher_section_functions">Fonctions</string> <string name="settings_launcher_section_functions">Fonctions</string>
<string name="settings_launcher_enable_double">Double balayage actions</string> <string name="settings_launcher_enable_double">Double balayage actions</string>
<string name="settings_launcher_auto_launch">Lancer apps par recherche</string>
<!-- <!--
- -

View file

@ -98,6 +98,7 @@
<string name="settings_launcher_section_functions">Functions</string> <string name="settings_launcher_section_functions">Functions</string>
<string name="settings_launcher_enable_double">Double swipe actions</string> <string name="settings_launcher_enable_double">Double swipe actions</string>
<string name="settings_launcher_auto_launch">Launch search results</string>
<!-- <!--
- -