diff --git a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/ItemViewTouchListener.kt b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/ItemViewTouchListener.kt index 1aa1e9afa3..f9cd1a55b8 100644 --- a/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/ItemViewTouchListener.kt +++ b/OCH/mogo-och-taxi-passenger/src/main/java/com/mogo/och/taxi/passenger/ui/leftmenu/ItemViewTouchListener.kt @@ -3,6 +3,8 @@ package com.mogo.och.taxi.passenger.ui.leftmenu import android.annotation.SuppressLint import android.view.MotionEvent import android.view.View +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant class ItemViewTouchListener : View.OnTouchListener { @@ -10,25 +12,34 @@ class ItemViewTouchListener : private var dragTime = 0L @SuppressLint("ClickableViewAccessibility") override fun onTouch(view: View, motionEvent: MotionEvent): Boolean { - when (motionEvent.action) { - MotionEvent.ACTION_DOWN -> { - LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action) - dragTime = System.currentTimeMillis() - } - MotionEvent.ACTION_MOVE -> { - if (LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action)) { - return false + try { + when (motionEvent.action) { + MotionEvent.ACTION_DOWN -> { + LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action) + dragTime = System.currentTimeMillis() } - } - MotionEvent.ACTION_UP -> { - LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action) - if (System.currentTimeMillis() - dragTime > 500) { - dragTime = 0 - return true + MotionEvent.ACTION_MOVE -> { + if (LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action)) { + return false + } } + MotionEvent.ACTION_UP -> { + LeftMenuOpen.dragAndOpen(motionEvent.rawX.toInt(),motionEvent.action) + if (System.currentTimeMillis() - dragTime > 500) { + dragTime = 0 + return true + } + } + else -> {} } - else -> {} + } catch (e: Exception) { + CallerLogger.e(SceneConstant.M_TAXI_P + TAG, e.message) + e.printStackTrace() } return false } + + companion object { + const val TAG = "ItemViewTouchListener" + } } \ No newline at end of file