mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-02-18 12:30:38 +01:00
pass grid clicks at the custom view
This commit is contained in:
parent
889e70468e
commit
69dc2bcfcd
@ -150,11 +150,22 @@ class MainActivity : SimpleActivity(), FlingListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun homeScreenClicked(x: Float, y: Float) {
|
||||||
|
if (x >= home_screen_grid.left && x <= home_screen_grid.right && y >= home_screen_grid.top && y <= home_screen_grid.bottom) {
|
||||||
|
home_screen_grid.gridClicked(x, y)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun showWidgetsFragment() {
|
private fun showWidgetsFragment() {
|
||||||
showFragment(widgets_fragment)
|
showFragment(widgets_fragment)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyGestureListener(private val flingListener: FlingListener) : GestureDetector.SimpleOnGestureListener() {
|
private class MyGestureListener(private val flingListener: FlingListener) : GestureDetector.SimpleOnGestureListener() {
|
||||||
|
override fun onSingleTapConfirmed(event: MotionEvent): Boolean {
|
||||||
|
(flingListener as MainActivity).homeScreenClicked(event.x, event.y)
|
||||||
|
return super.onSingleTapConfirmed(event)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onFling(event1: MotionEvent, event2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
|
override fun onFling(event1: MotionEvent, event2: MotionEvent, velocityX: Float, velocityY: Float): Boolean {
|
||||||
if (velocityY > 0) {
|
if (velocityY > 0) {
|
||||||
flingListener.onFlingDown()
|
flingListener.onFlingDown()
|
||||||
|
@ -59,4 +59,8 @@ class HomeScreenGrid(context: Context, attrs: AttributeSet, defStyle: Int) : Vie
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun gridClicked(x: Float, y: Float) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user