Implement option to enable double swipes

This commit is contained in:
Finn M Glas 2020-08-20 23:09:15 +02:00
parent 09926d34ed
commit 096abc2c61
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
5 changed files with 77 additions and 1 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_enable_double, vibrantColor)
settings_launcher_container.setBackgroundColor(dominantColor) settings_launcher_container.setBackgroundColor(dominantColor)
setButtonColor(settings_theme_custom_button_select, vibrantColor) setButtonColor(settings_theme_custom_button_select, vibrantColor)
@ -137,6 +138,15 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
setWindowFlags(activity!!.window) setWindowFlags(activity!!.window)
} }
settings_launcher_switch_enable_double.setOnClickListener { // Toggle double actions
launcherPreferences.edit()
.putBoolean(PREF_DOUBLE_ACTIONS_ENABLED,
!launcherPreferences.getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, true))
.apply()
intendedSettingsPause = true
activity!!.recreate()
}
} }
fun resetToCustomTheme(context: Activity) { fun resetToCustomTheme(context: Activity) {
@ -168,7 +178,9 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
settings_launcher_switch_screen_timeout.isChecked = settings_launcher_switch_screen_timeout.isChecked =
launcherPreferences.getBoolean(PREF_SCREEN_TIMEOUT_DISABLED, false) launcherPreferences.getBoolean(PREF_SCREEN_TIMEOUT_DISABLED, false)
settings_launcher_switch_screen_full.isChecked = settings_launcher_switch_screen_full.isChecked =
launcherPreferences.getBoolean(PREF_SCREEN_FULLSCREEN, false) launcherPreferences.getBoolean(PREF_SCREEN_FULLSCREEN, true)
settings_launcher_switch_enable_double.isChecked =
launcherPreferences.getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
// Load values into the date-format spinner // Load values into the date-format spinner
val staticAdapter = ArrayAdapter.createFromResource( val staticAdapter = ArrayAdapter.createFromResource(

View file

@ -189,4 +189,56 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/settings_launcher_section_functions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/settings_launcher_section_functions_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_section_functions"
android:textColor="#ccc"
android:textSize="18sp"
tools:layout_editor_absoluteX="32dp"
tools:layout_editor_absoluteY="16dp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16sp"
android:layout_marginBottom="16sp"
android:gravity="top"
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_enable_double"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_enable_double"
android:textSize="16sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/settings_launcher_text_time_format" />
<Space
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Switch
android:id="@+id/settings_launcher_switch_enable_double"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
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> </LinearLayout>

View file

@ -75,6 +75,10 @@
<string name="settings_launcher_disable_timeout">Bildschirm wach halten</string> <string name="settings_launcher_disable_timeout">Bildschirm wach halten</string>
<string name="settings_launcher_full_screen">Vollbild verwenden</string> <string name="settings_launcher_full_screen">Vollbild verwenden</string>
<string name="settings_launcher_section_functions">Funktionen</string>
<string name="settings_launcher_enable_double">Doppelte Wischaktionen</string>
<!-- <!--
- -
- Settings : Meta - Settings : Meta

View file

@ -75,6 +75,10 @@
<string name="settings_launcher_disable_timeout">Gardez l\'écran allumé</string> <string name="settings_launcher_disable_timeout">Gardez l\'écran allumé</string>
<string name="settings_launcher_full_screen">Utiliser le plein écran</string> <string name="settings_launcher_full_screen">Utiliser le plein écran</string>
<string name="settings_launcher_section_functions">Fonctions</string>
<string name="settings_launcher_enable_double">Double balayage actions</string>
<!-- <!--
- -
- Settings : Meta - Settings : Meta

View file

@ -95,6 +95,10 @@
<string name="settings_launcher_disable_timeout">Keep screen on</string> <string name="settings_launcher_disable_timeout">Keep screen on</string>
<string name="settings_launcher_full_screen">Use full screen</string> <string name="settings_launcher_full_screen">Use full screen</string>
<string name="settings_launcher_section_functions">Functions</string>
<string name="settings_launcher_enable_double">Double swipe actions</string>
<!-- <!--
- -
- Settings : Meta - Settings : Meta