mirror of
https://github.com/jrpie/Launcher.git
synced 2025-02-23 14:31:30 +01:00
Disable system default animations
This commit is contained in:
parent
7669c44b4d
commit
c141623029
1 changed files with 29 additions and 41 deletions
|
@ -150,28 +150,24 @@ class HomeActivity : AppCompatActivity(),
|
||||||
|
|
||||||
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
override fun onKeyDown(keyCode: Int, event: KeyEvent?): Boolean {
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK) { if (settingsIconShown) hideSettingsIcon() }
|
if (keyCode == KeyEvent.KEYCODE_BACK) { if (settingsIconShown) hideSettingsIcon() }
|
||||||
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) launch(
|
else if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
|
||||||
volumeUpApp,
|
launch(volumeUpApp, this)
|
||||||
this
|
overridePendingTransition(0, 0)
|
||||||
)
|
}
|
||||||
else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) launch(
|
else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {
|
||||||
volumeDownApp,
|
launch(volumeDownApp, this)
|
||||||
this
|
overridePendingTransition(0, 0)
|
||||||
)
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
fun dateViewOnTouch(v: View) {
|
fun dateViewOnTouch(v: View) {
|
||||||
launch(
|
launch(calendarApp, this)
|
||||||
calendarApp,
|
overridePendingTransition(0, 0)
|
||||||
this
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
fun timeViewOnTouch(v: View) {
|
fun timeViewOnTouch(v: View) {
|
||||||
launch(
|
launch(clockApp,this)
|
||||||
clockApp,
|
overridePendingTransition(0, 0)
|
||||||
this
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFling(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean {
|
override fun onFling(e1: MotionEvent, e2: MotionEvent, dX: Float, dY: Float): Boolean {
|
||||||
|
@ -185,42 +181,34 @@ class HomeActivity : AppCompatActivity(),
|
||||||
val strictness = 4 // how distinguished the swipe has to be to be accepted
|
val strictness = 4 // how distinguished the swipe has to be to be accepted
|
||||||
|
|
||||||
// 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) launch(
|
if (diffY < -height / 8 && abs(diffY) > strictness * abs(diffX) && e1.y > 100) {
|
||||||
downApp,
|
launch(downApp,this)
|
||||||
this
|
overridePendingTransition(0, 0)
|
||||||
)
|
}
|
||||||
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
|
else if (diffY > height / 8 && abs(diffY) > strictness * abs(diffX)) {
|
||||||
launch(
|
launch(upApp, this)
|
||||||
upApp,
|
|
||||||
this
|
|
||||||
)
|
|
||||||
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
|
overridePendingTransition(R.anim.bottom_up, android.R.anim.fade_out)
|
||||||
}
|
}
|
||||||
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) launch(
|
else if (diffX > width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||||
leftApp,
|
launch(leftApp,this)
|
||||||
this
|
overridePendingTransition(0, 0)
|
||||||
)
|
}
|
||||||
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) launch(
|
else if (diffX < -width / 4 && abs(diffX) > strictness * abs(diffY)) {
|
||||||
rightApp,
|
launch(rightApp, this)
|
||||||
this
|
overridePendingTransition(0, 0)
|
||||||
)
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLongPress(event: MotionEvent) {
|
override fun onLongPress(event: MotionEvent) {
|
||||||
if(longClickApp != "") launch(
|
launch(longClickApp, this)
|
||||||
longClickApp,
|
overridePendingTransition(0, 0)
|
||||||
this
|
|
||||||
)
|
|
||||||
else openSettings(this)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDoubleTap(event: MotionEvent): Boolean {
|
override fun onDoubleTap(event: MotionEvent): Boolean {
|
||||||
launch(
|
launch(doubleClickApp, this)
|
||||||
doubleClickApp,
|
overridePendingTransition(0, 0)
|
||||||
this
|
|
||||||
)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue