Make keyboard autolaunching optional

Closes #81
This commit is contained in:
Finn M Glas 2020-12-30 22:49:11 +01:00
parent cd2a9ed619
commit 04ecd47a02
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
8 changed files with 47 additions and 13 deletions

View file

@ -77,6 +77,7 @@ const val PREF_DATE_FORMAT = "dateFormat"
const val PREF_DOUBLE_ACTIONS_ENABLED = "enableDoubleActions" const val PREF_DOUBLE_ACTIONS_ENABLED = "enableDoubleActions"
const val PREF_SEARCH_AUTO_LAUNCH = "searchAutoLaunch" const val PREF_SEARCH_AUTO_LAUNCH = "searchAutoLaunch"
const val PREF_SEARCH_AUTO_KEYBOARD = "searchAutoKeyboard"
const val PREF_SLIDE_SENSITIVITY = "slideSensitivity" const val PREF_SLIDE_SENSITIVITY = "slideSensitivity"

View file

@ -6,12 +6,9 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager
import com.finnmglas.launcher.R import com.finnmglas.launcher.*
import com.finnmglas.launcher.UIObject
import com.finnmglas.launcher.dominantColor
import com.finnmglas.launcher.list.forApp import com.finnmglas.launcher.list.forApp
import com.finnmglas.launcher.list.intention import com.finnmglas.launcher.list.intention
import com.finnmglas.launcher.openSoftKeyboard
import kotlinx.android.synthetic.main.list.* import kotlinx.android.synthetic.main.list.*
import kotlinx.android.synthetic.main.list_apps.* import kotlinx.android.synthetic.main.list_apps.*
@ -69,8 +66,8 @@ class ListFragmentApps : Fragment(), UIObject {
} }
}) })
when (intention) { if (intention == "view" && launcherPreferences.getBoolean(PREF_SEARCH_AUTO_KEYBOARD, true)) {
"view" -> openSoftKeyboard(context!!, list_apps_searchview) openSoftKeyboard(context!!, list_apps_searchview)
} }
} }
} }

View file

@ -115,6 +115,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_auto_launch, vibrantColor)
setSwitchColor(settings_launcher_switch_auto_keyboard, 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)
@ -150,6 +151,13 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
.apply() .apply()
} }
settings_launcher_switch_auto_keyboard.isChecked = launcherPreferences.getBoolean(PREF_SEARCH_AUTO_KEYBOARD, true)
settings_launcher_switch_auto_keyboard.setOnCheckedChangeListener { _, isChecked -> // Toggle double actions
launcherPreferences.edit()
.putBoolean(PREF_SEARCH_AUTO_KEYBOARD, 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()
@ -216,9 +224,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
.apply() .apply()
} }
override fun onNothingSelected(parent: AdapterView<*>?) { override fun onNothingSelected(parent: AdapterView<*>?) { }
}
} }
// Load values into the theme spinner // Load values into the theme spinner
@ -246,10 +252,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
2 -> if (getSavedTheme(activity!!) != "custom") resetToCustomTheme(activity!!) 2 -> if (getSavedTheme(activity!!) != "custom") resetToCustomTheme(activity!!)
} }
} }
override fun onNothingSelected(parent: AdapterView<*>?) { }
override fun onNothingSelected(parent: AdapterView<*>?) {
}
} }
settings_seekbar_sensitivity.progress = launcherPreferences.getInt(PREF_SLIDE_SENSITIVITY, 2) * 4 / 100 settings_seekbar_sensitivity.progress = launcherPreferences.getInt(PREF_SLIDE_SENSITIVITY, 2) * 4 / 100

View file

@ -246,6 +246,35 @@
</LinearLayout> </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
android:id="@+id/settings_launcher_text_start_keyboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_auto_keyboard"
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_keyboard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:textSize="18sp" />
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View file

@ -79,6 +79,7 @@
<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> <string name="settings_launcher_auto_launch">Suchergebisse launchen</string>
<string name="settings_launcher_auto_keyboard">Tastatur in Suche öffnen</string>
<string name="settings_launcher_sensitivity">Empfindlichkeit</string> <string name="settings_launcher_sensitivity">Empfindlichkeit</string>

View file

@ -101,6 +101,7 @@
<string name="settings_launcher_enable_double">Deslizar con dos dedos</string> <string name="settings_launcher_enable_double">Deslizar con dos dedos</string>
<string name="settings_launcher_auto_launch">Auto-lanzar búsquedas</string> <string name="settings_launcher_auto_launch">Auto-lanzar búsquedas</string>
<string name="settings_launcher_auto_keyboard">Abrir teclado en búsqueda</string>
<string name="settings_launcher_sensitivity">Sensibilidad</string> <string name="settings_launcher_sensitivity">Sensibilidad</string>

View file

@ -79,6 +79,7 @@
<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> <string name="settings_launcher_auto_launch">Lancer apps par recherche</string>
<string name="settings_launcher_auto_keyboard">Ouvrir clavier en recherche</string>
<string name="settings_launcher_sensitivity">Sensibilité</string> <string name="settings_launcher_sensitivity">Sensibilité</string>

View file

@ -99,6 +99,7 @@
<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> <string name="settings_launcher_auto_launch">Launch search results</string>
<string name="settings_launcher_auto_keyboard">Start keyboard for search</string>
<string name="settings_launcher_sensitivity">Sensitivity</string> <string name="settings_launcher_sensitivity">Sensitivity</string>