Create a sensitivity slider

As discussed in #73
This commit is contained in:
Finn M Glas 2020-10-19 14:00:18 +02:00
parent 0c3e263c47
commit 1559f96838
No known key found for this signature in database
GPG key ID: 902A30146014DFBF
5 changed files with 47 additions and 0 deletions

View file

@ -4,6 +4,7 @@ import android.Manifest
import android.app.Activity
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.PorterDuff
import android.os.Build
import android.os.Bundle
import android.provider.MediaStore
@ -13,6 +14,8 @@ import android.view.View
import android.view.ViewGroup
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.SeekBar
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
@ -116,6 +119,7 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
settings_launcher_container.setBackgroundColor(dominantColor)
setButtonColor(settings_theme_custom_button_select, vibrantColor)
settings_seekbar_sensitivity.progressDrawable.setColorFilter(vibrantColor, PorterDuff.Mode.SRC_IN);
}
override fun setOnClicks() {
@ -155,6 +159,20 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
intendedSettingsPause = true
activity!!.recreate()
}
settings_seekbar_sensitivity.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {
}
override fun onStartTrackingTouch(p0: SeekBar?) {
}
override fun onStopTrackingTouch(p0: SeekBar?) {
Toast.makeText(
context,
"Smooth Seekbar current progress ${p0?.progress}",
Toast.LENGTH_SHORT
).show()
}
})
}
fun resetToCustomTheme(context: Activity) {

View file

@ -201,6 +201,29 @@
android:orientation="horizontal"
android:paddingLeft="8sp">
<TextView
android:id="@+id/settings_launcher_text_sensitivity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/settings_launcher_sensitivity"
android:textSize="16sp" />
<SeekBar
android:id="@+id/settings_seekbar_sensitivity"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:progress="50" />
</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_auto_launch"
android:layout_width="wrap_content"

View file

@ -80,6 +80,8 @@
<string name="settings_launcher_enable_double">Doppelte Wischaktionen</string>
<string name="settings_launcher_auto_launch">Suchergebisse launchen</string>
<string name="settings_launcher_sensitivity">Empfindlichkeit</string>
<!--
-
- Settings : Meta

View file

@ -80,6 +80,8 @@
<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_sensitivity">Sensibilité</string>
<!--
-
- Settings : Meta

View file

@ -100,6 +100,8 @@
<string name="settings_launcher_enable_double">Double swipe actions</string>
<string name="settings_launcher_auto_launch">Launch search results</string>
<string name="settings_launcher_sensitivity">Sensitivity</string>
<!--
-
- Settings : Meta