mirror of
https://github.com/He4eT/yamf_launcher.git
synced 2026-05-04 17:37:25 +00:00
Show recent apps with swipe
This commit is contained in:
parent
4971ca8019
commit
1d02aa8d78
2 changed files with 21 additions and 1 deletions
|
|
@ -1205,6 +1205,19 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
|
|||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,9 @@ 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)
|
||||
}
|
||||
|
|
@ -23,4 +26,8 @@ class ScreenLockService : AccessibilityService() {
|
|||
private fun performLockScreen() {
|
||||
performGlobalAction(GLOBAL_ACTION_LOCK_SCREEN)
|
||||
}
|
||||
|
||||
private fun performShowRecents() {
|
||||
performGlobalAction(GLOBAL_ACTION_RECENTS)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue