feature: removed sensitivity setting

Removed the sensitivity setting.
Many people were complaining about the default sensitivity
being too low. Nobody every complained about sensitivity being too high.
This commit is contained in:
Josia Pietsch 2024-08-28 10:54:57 +02:00
parent b0deb94b7a
commit 849db934ac
Signed by: jrpie
GPG key ID: E70B571D66986A2D
5 changed files with 7 additions and 55 deletions

View file

@ -1,14 +1,12 @@
package de.jrpie.android.launcher package de.jrpie.android.launcher
import android.app.Activity import android.app.Activity
import android.app.ActivityOptions
import android.app.AlertDialog import android.app.AlertDialog
import android.app.Service import android.app.Service
import android.app.role.RoleManager import android.app.role.RoleManager
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.pm.ActivityInfo
import android.content.pm.ApplicationInfo import android.content.pm.ApplicationInfo
import android.content.pm.LauncherActivityInfo import android.content.pm.LauncherActivityInfo
import android.content.pm.LauncherApps import android.content.pm.LauncherApps
@ -48,7 +46,6 @@ import de.jrpie.android.launcher.list.apps.AppsRecyclerAdapter
import de.jrpie.android.launcher.list.other.LauncherAction import de.jrpie.android.launcher.list.other.LauncherAction
import de.jrpie.android.launcher.settings.SettingsActivity import de.jrpie.android.launcher.settings.SettingsActivity
import de.jrpie.android.launcher.tutorial.TutorialActivity import de.jrpie.android.launcher.tutorial.TutorialActivity
import kotlin.contracts.contract
/* Preference Key Constants */ /* Preference Key Constants */
@ -66,8 +63,6 @@ const val PREF_EDGE_ACTIONS_ENABLED = "enableEdgeActions"
const val PREF_SEARCH_AUTO_LAUNCH = "searchAutoLaunch" const val PREF_SEARCH_AUTO_LAUNCH = "searchAutoLaunch"
const val PREF_SEARCH_AUTO_KEYBOARD = "searchAutoKeyboard" const val PREF_SEARCH_AUTO_KEYBOARD = "searchAutoKeyboard"
const val PREF_SLIDE_SENSITIVITY = "slideSensitivity"
const val PREF_STARTED = "startedBefore" const val PREF_STARTED = "startedBefore"
const val PREF_STARTED_TIME = "firstStartup" const val PREF_STARTED_TIME = "firstStartup"
@ -447,7 +442,6 @@ fun resetSettings(context: Context) {
.putInt(PREF_DATE_FORMAT, 0) .putInt(PREF_DATE_FORMAT, 0)
.putBoolean(PREF_SCREEN_FULLSCREEN, true) .putBoolean(PREF_SCREEN_FULLSCREEN, true)
.putBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false) .putBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
.putInt(PREF_SLIDE_SENSITIVITY, 50)
Gesture.values().forEach { editor.putString(it.id, it.pickDefaultApp(context)) } Gesture.values().forEach { editor.putString(it.id, it.pickDefaultApp(context)) }

View file

@ -159,21 +159,18 @@ class HomeActivity: UIObject, AppCompatActivity(),
val doubleActions = preferences.getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false) val doubleActions = preferences.getBoolean(PREF_DOUBLE_ACTIONS_ENABLED, false)
val edgeActions = preferences.getBoolean(PREF_EDGE_ACTIONS_ENABLED, false) val edgeActions = preferences.getBoolean(PREF_EDGE_ACTIONS_ENABLED, false)
val edgeStrictness = 0.15 val edgeStrictness = 0.15
// how distinguished the swipe has to be to launch something
// strictness = opposite of sensitivity. TODO - May have to be adjusted
val strictness = (4 / bufferedPointerCount) * ((100 - preferences.getInt(PREF_SLIDE_SENSITIVITY, 50)) / 50)
var gesture = if(abs(diffX) > abs(diffY)) { // horizontal swipe var gesture = if(abs(diffX) > abs(diffY)) { // horizontal swipe
if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) if (diffX > width / 4)
Gesture.SWIPE_LEFT Gesture.SWIPE_LEFT
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) else if (diffX < -width / 4)
Gesture.SWIPE_RIGHT Gesture.SWIPE_RIGHT
else null else null
} else { // vertical swipe } else { // vertical swipe
// Only open if the swipe was not from the phones top edge // Only open if the swipe was not from the phones top edge
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) if (diffY < -height / 8 && e1.y > 100)
Gesture.SWIPE_DOWN Gesture.SWIPE_DOWN
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) else if (diffY > height / 8)
Gesture.SWIPE_UP Gesture.SWIPE_UP
else null else null
} }

View file

@ -1,14 +1,12 @@
package de.jrpie.android.launcher.settings.launcher package de.jrpie.android.launcher.settings.launcher
import android.content.Intent import android.content.Intent
import android.graphics.PorterDuff
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.ArrayAdapter import android.widget.ArrayAdapter
import android.widget.SeekBar
import android.widget.Switch import android.widget.Switch
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import de.jrpie.android.launcher.PREF_DATE_FORMAT import de.jrpie.android.launcher.PREF_DATE_FORMAT
@ -18,7 +16,6 @@ import de.jrpie.android.launcher.PREF_SCREEN_FULLSCREEN
import de.jrpie.android.launcher.PREF_SCREEN_TIMEOUT_DISABLED import de.jrpie.android.launcher.PREF_SCREEN_TIMEOUT_DISABLED
import de.jrpie.android.launcher.PREF_SEARCH_AUTO_KEYBOARD import de.jrpie.android.launcher.PREF_SEARCH_AUTO_KEYBOARD
import de.jrpie.android.launcher.PREF_SEARCH_AUTO_LAUNCH import de.jrpie.android.launcher.PREF_SEARCH_AUTO_LAUNCH
import de.jrpie.android.launcher.PREF_SLIDE_SENSITIVITY
import de.jrpie.android.launcher.R import de.jrpie.android.launcher.R
import de.jrpie.android.launcher.UIObject import de.jrpie.android.launcher.UIObject
import de.jrpie.android.launcher.getPreferences import de.jrpie.android.launcher.getPreferences
@ -67,7 +64,6 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
setButtonColor(binding.settingsLauncherButtonChooseWallpaper, vibrantColor) setButtonColor(binding.settingsLauncherButtonChooseWallpaper, vibrantColor)
binding.settingsSeekbarSensitivity.progressDrawable.setColorFilter(vibrantColor, PorterDuff.Mode.SRC_IN)
} }
override fun setOnClicks() { override fun setOnClicks() {
@ -109,18 +105,6 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
bindSwitchToPref(binding.settingsLauncherSwitchAutoKeyboard, PREF_SEARCH_AUTO_KEYBOARD, true) {} bindSwitchToPref(binding.settingsLauncherSwitchAutoKeyboard, PREF_SEARCH_AUTO_KEYBOARD, true) {}
bindSwitchToPref(binding.settingsLauncherSwitchEnableDouble, PREF_DOUBLE_ACTIONS_ENABLED, false) {} bindSwitchToPref(binding.settingsLauncherSwitchEnableDouble, PREF_DOUBLE_ACTIONS_ENABLED, false) {}
bindSwitchToPref(binding.settingsLauncherSwitchEnableEdge, PREF_EDGE_ACTIONS_ENABLED, false) {} bindSwitchToPref(binding.settingsLauncherSwitchEnableEdge, PREF_EDGE_ACTIONS_ENABLED, false) {}
binding.settingsSeekbarSensitivity.setOnSeekBarChangeListener(
object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(p0: SeekBar?, p1: Int, p2: Boolean) {}
override fun onStartTrackingTouch(p0: SeekBar?) {}
override fun onStopTrackingTouch(p0: SeekBar?) {
preferences.edit()
.putInt(PREF_SLIDE_SENSITIVITY, p0!!.progress * 100 / 4) // scale to %
.apply()
}
}
)
} }
override fun adjustLayout() { override fun adjustLayout() {
@ -171,7 +155,5 @@ class SettingsFragmentLauncher : Fragment(), UIObject {
} }
override fun onNothingSelected(parent: AdapterView<*>?) { } override fun onNothingSelected(parent: AdapterView<*>?) { }
} }
binding.settingsSeekbarSensitivity.progress = preferences.getInt(PREF_SLIDE_SENSITIVITY, 2) * 4 / 100
} }
} }

View file

@ -195,6 +195,7 @@
tools:layout_editor_absoluteY="16dp" /> tools:layout_editor_absoluteY="16dp" />
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -204,30 +205,6 @@
android:orientation="horizontal" android:orientation="horizontal"
android:paddingLeft="8sp"> 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:max="4"
android:progress="2" />
</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_auto_launch" android:id="@+id/settings_launcher_text_auto_launch"
android:layout_width="0dp" android:layout_width="0dp"

View file

@ -1,4 +1,5 @@
- Chinese translation (thank you, yzqzss!) - Chinese translation (thank you, yzqzss!)
- improved French translation
All Apps: All Apps:
- Removed three dots in app list (use long click instead) - Removed three dots in app list (use long click instead)
@ -9,3 +10,4 @@ All Apps:
Settings: Settings:
- Fixed settings for small displays - Fixed settings for small displays
- Removed sensitivity setting (everybody was setting it to maximum anyway)