making some motionevents not nullable again
This commit is contained in:
parent
385a7c6c86
commit
759af97742
|
@ -424,14 +424,12 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyGestureListener(private val flingListener: FlingListener) : GestureDetector.SimpleOnGestureListener() {
|
private class MyGestureListener(private val flingListener: FlingListener) : GestureDetector.SimpleOnGestureListener() {
|
||||||
override fun onSingleTapUp(event: MotionEvent?): Boolean {
|
override fun onSingleTapUp(event: MotionEvent): Boolean {
|
||||||
if (event != null) {
|
(flingListener as MainActivity).homeScreenClicked(event.x, event.y)
|
||||||
(flingListener as MainActivity).homeScreenClicked(event.x, event.y)
|
|
||||||
}
|
|
||||||
return super.onSingleTapUp(event)
|
return super.onSingleTapUp(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 {
|
||||||
// ignore fling events just after releasing an icon from dragging
|
// ignore fling events just after releasing an icon from dragging
|
||||||
if (System.currentTimeMillis() - mLastUpEvent < 500L) {
|
if (System.currentTimeMillis() - mLastUpEvent < 500L) {
|
||||||
return true
|
return true
|
||||||
|
@ -445,10 +443,8 @@ class MainActivity : SimpleActivity(), FlingListener {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onLongPress(event: MotionEvent?) {
|
override fun onLongPress(event: MotionEvent) {
|
||||||
if (event != null) {
|
(flingListener as MainActivity).homeScreenLongPressed(event.x, event.y)
|
||||||
(flingListener as MainActivity).homeScreenLongPressed(event.x, event.y)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue