mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-22 14:01:28 +01:00
Fixed swipe detection for low strictness
This commit is contained in:
parent
340ee73152
commit
cc2e7710c8
2 changed files with 20 additions and 28 deletions
12
.idea/runConfigurations.xml
generated
12
.idea/runConfigurations.xml
generated
|
@ -1,12 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
|
@ -156,22 +156,26 @@ class HomeActivity: UIObject, AppCompatActivity(),
|
|||
// strictness = opposite of sensitivity. TODO - May have to be adjusted
|
||||
val strictness = (4 / bufferedPointerCount) * ((100 - launcherPreferences.getInt(PREF_SLIDE_SENSITIVITY, 50)) / 50)
|
||||
|
||||
// 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 (bufferedPointerCount == 1) launch(downApp, this, R.anim.top_down)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleDownApp, this, R.anim.top_down)
|
||||
}
|
||||
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
|
||||
if (bufferedPointerCount == 1) launch(upApp, this, R.anim.bottom_up)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleUpApp, this, R.anim.bottom_up)
|
||||
}
|
||||
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||
if (bufferedPointerCount == 1) launch(leftApp,this, R.anim.right_left)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleLeftApp,this, R.anim.right_left)
|
||||
}
|
||||
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||
if (bufferedPointerCount == 1) launch(rightApp, this, R.anim.left_right)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleRightApp, this, R.anim.left_right)
|
||||
|
||||
if(abs(diffX) > abs(diffY)) { // horizontal swipe
|
||||
if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||
if (bufferedPointerCount == 1) launch(leftApp,this, R.anim.right_left)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleLeftApp,this, R.anim.right_left)
|
||||
}
|
||||
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||
if (bufferedPointerCount == 1) launch(rightApp, this, R.anim.left_right)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleRightApp, this, R.anim.left_right)
|
||||
}
|
||||
} else { // vertical swipe
|
||||
// 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 (bufferedPointerCount == 1) launch(downApp, this, R.anim.top_down)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleDownApp, this, R.anim.top_down)
|
||||
}
|
||||
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
|
||||
if (bufferedPointerCount == 1) launch(upApp, this, R.anim.bottom_up)
|
||||
else if (bufferedPointerCount == 2 && doubleActions) launch(doubleUpApp, this, R.anim.bottom_up)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
|
|
Loading…
Add table
Reference in a new issue