diff --git a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt index 3b70360..55b02dd 100644 --- a/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt +++ b/app/src/main/java/eu/ottop/yamlauncher/MainActivity.kt @@ -1170,31 +1170,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh val deltaY = e2.y - e1.y val deltaX = e2.x - e1.x - // Swipe right - if (deltaX > 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && sharedPreferenceManager.isGestureEnabled("right")) { - if (rightSwipeActivity.first != null && rightSwipeActivity.second != null) { - canLaunchShortcut = false - appUtils.launchApp(rightSwipeActivity.first!!.componentName, launcherApps.profiles[rightSwipeActivity.second!!]) - } else { - Toast.makeText(this@MainActivity, getString(R.string.launch_error), Toast.LENGTH_SHORT).show() - } - } - else if (deltaX > 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && !sharedPreferenceManager.isGestureEnabled("right")) { - if (gestureUtils.isAccessibilityServiceEnabled( - ScreenLockService::class.java - ) - ) { - val intent = Intent(this@MainActivity, ScreenLockService::class.java) - intent.action = "RECENTS" - startService(intent) - finishAndRemoveTask() - } else { - gestureUtils.promptEnableAccessibility() - } - } - // Swipe up - else if (deltaY < -swipeThreshold && abs(velocityY) > swipeVelocityThreshold) { + if (deltaY < -swipeThreshold && abs(velocityY) > swipeVelocityThreshold) { canLaunchShortcut = false openAppMenu() } @@ -1217,6 +1194,17 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh Toast.makeText(this@MainActivity, getString(R.string.launch_error), Toast.LENGTH_SHORT).show() } } + + + // Swipe right + else if (deltaX > 0 && abs(deltaX) > swipeThreshold && abs(velocityX) > swipeVelocityThreshold && sharedPreferenceManager.isGestureEnabled("right")) { + if (rightSwipeActivity.first != null && rightSwipeActivity.second != null) { + canLaunchShortcut = false + appUtils.launchApp(rightSwipeActivity.first!!.componentName, launcherApps.profiles[rightSwipeActivity.second!!]) + } else { + Toast.makeText(this@MainActivity, getString(R.string.launch_error), Toast.LENGTH_SHORT).show() + } + } } return true } diff --git a/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt b/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt index afcf884..403ccec 100644 --- a/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt +++ b/app/src/main/java/eu/ottop/yamlauncher/tasks/ScreenLockService.kt @@ -16,9 +16,6 @@ class ScreenLockService : AccessibilityService() { if (intent != null && intent.action == "LOCK_SCREEN") { performLockScreen() } - if (intent != null && intent.action == "RECENTS") { - performShowRecents() - } stopSelf() return super.onStartCommand(intent, flags, startId) } @@ -26,8 +23,4 @@ class ScreenLockService : AccessibilityService() { private fun performLockScreen() { performGlobalAction(GLOBAL_ACTION_LOCK_SCREEN) } - - private fun performShowRecents() { - performGlobalAction(GLOBAL_ACTION_RECENTS) - } } \ No newline at end of file