Browse Source

1.优化测评点击按钮无效bug

王鹏鹏 2 years ago
parent
commit
48e32572d0

+ 3 - 8
baselib/src/main/java/com/yingyangfly/baselib/utils/CommonUtils.kt

@@ -1,4 +1,4 @@
-package com.hyphenate.easeui.utils
+package com.yingyangfly.baselib.utils
 
 import java.io.File
 
@@ -17,7 +17,7 @@ object CommonUtils {
         get() {
             var flag = false
             val curClickTime = System.currentTimeMillis()
-            if (curClickTime - lastClickTime >= MIN_CLICK_DELAY_TIME) {
+            if (curClickTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
                 flag = true
             }
             lastClickTime = curClickTime
@@ -27,18 +27,13 @@ object CommonUtils {
         get() {
             var flag = false
             val curClickTime = System.currentTimeMillis()
-            if (curClickTime - lastClickTime >= SHORT_MIN_CLICK_DELAY_TIME) {
+            if (curClickTime - lastClickTime > SHORT_MIN_CLICK_DELAY_TIME) {
                 flag = true
             }
             lastClickTime = curClickTime
             return flag
         }
 
-    @JvmStatic
-    fun getCompanyUnit(company: String, num: String): String {
-        return if ("g" == company || "克" == company) "" else "共(" + num + "g)"
-    }
-
     /**
      * 删除目录及目录下的文件
      */

+ 5 - 5
mmse/src/main/java/com/yingyangfly/mmse/fragment/MultipleChoiceFragment.kt

@@ -6,7 +6,7 @@ import android.view.MotionEvent
 import android.view.View
 import androidx.core.os.bundleOf
 import androidx.navigation.Navigation
-import com.hyphenate.easeui.utils.CommonUtils
+import com.yingyangfly.baselib.utils.CommonUtils
 import com.yingyang.mmse.R
 import com.yingyang.mmse.databinding.FragmentMultipleChoiceBinding
 import com.yingyangfly.baselib.base.BaseFragment
@@ -131,9 +131,7 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>(), Vi
                 if (v.id == R.id.btnPrevious) {
                     pageUp(v)
                 } else if (v.id == R.id.btnNext) {
-                    if (CommonUtils.isFastClick) {
-                        pageNext(v)
-                    }
+                    pageNext(v)
                 }
             }
             MotionEvent.ACTION_CANCEL -> {
@@ -194,7 +192,9 @@ class MultipleChoiceFragment : BaseFragment<FragmentMultipleChoiceBinding>(), Vi
                     )
                 }
                 19 -> {
-                    RxBus.get().send(RxBusCodes.EndMMSEQuestion)
+                    if (CommonUtils.isFastClick) {
+                        RxBus.get().send(RxBusCodes.EndMMSEQuestion)
+                    }
                 }
                 else -> {
                     val bundle = Bundle()

+ 5 - 5
moca/src/main/java/com/yingyangfly/moca/singlechoice/SingleChoiceFragment.kt

@@ -6,7 +6,7 @@ import android.view.MotionEvent
 import android.view.View
 import androidx.core.os.bundleOf
 import androidx.navigation.Navigation
-import com.hyphenate.easeui.utils.CommonUtils
+import com.yingyangfly.baselib.utils.CommonUtils
 import com.yingyang.moca.R
 import com.yingyang.moca.databinding.FragmentSingleChoiceBinding
 import com.yingyangfly.baselib.base.BaseFragment
@@ -127,9 +127,7 @@ class SingleChoiceFragment : BaseFragment<FragmentSingleChoiceBinding>(),
                 if (v.id == R.id.btnPrevious) {
                     previousPage(v)
                 } else if (v.id == R.id.btnNext) {
-                    if (CommonUtils.isFastClick) {
-                        nextPage(v)
-                    }
+                    nextPage(v)
                 }
             }
             MotionEvent.ACTION_CANCEL -> {
@@ -187,7 +185,9 @@ class SingleChoiceFragment : BaseFragment<FragmentSingleChoiceBinding>(),
                     loadData()
                 }
                 76 -> {
-                    RxBus.get().send(RxBusCodes.EndMOCAQuestion)
+                    if (CommonUtils.isFastClick) {
+                        RxBus.get().send(RxBusCodes.EndMOCAQuestion)
+                    }
                 }
                 else -> {
                     val controller = Navigation.findNavController(v)