| app/src/main/java/com/xw/yunwei/MyApp.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| app/src/main/java/com/xw/yunwei/ui/task/accident/detail/AccidentDetailVM.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| app/src/main/java/com/xw/yunwei/ui/task/normal/NormalTaskDetailVM.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| app/src/main/java/com/xw/yunwei/ui/work/car/detail/dispatch/DispatchFragment.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| common/src/main/java/com/xw/common/custom/SlideButtonView.kt | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| common/src/main/res/mipmap/ic_slide_gray_r.png | 补丁 | 查看 | 原始文档 | blame | 历史 | |
| common/src/main/res/values/attrs.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
app/src/main/java/com/xw/yunwei/MyApp.kt
@@ -463,7 +463,7 @@ val isOk = taskRepository.checkApplyForReassignResult(taskModel.id.toString()) activity.viewModel.dismissDialog() isOk?.also { ToastUtilCommon.showSuc(if (it) "改派成功" else "暂未找到运维人员") if (it) ToastUtilCommon.showSuc("改派成功") else ToastUtilCommon.showError("暂未找到运维人员") EventBus.getDefault().post(SwitchTabMain(1)) if (!it) { EventBus.getDefault().post(SwitchTabTask(4)) app/src/main/java/com/xw/yunwei/ui/task/accident/detail/AccidentDetailVM.kt
@@ -450,7 +450,7 @@ val isOk = taskRepository.checkApplyForReassignResult(taskId.toString()) dismissDialog() isOk?.also { ToastUtilCommon.showSuc(if (it) "改派成功" else "暂未找到运维人员") if (it) ToastUtilCommon.showSuc("改派成功") else ToastUtilCommon.showError("暂未找到运维人员") EventBus.getDefault().post(SwitchTabMain(1)) if (!it) { EventBus.getDefault().post(SwitchTabTask(4)) app/src/main/java/com/xw/yunwei/ui/task/normal/NormalTaskDetailVM.kt
@@ -450,7 +450,7 @@ val isOk = taskRepository.checkApplyForReassignResult(taskId.toString()) dismissDialog() isOk?.also { ToastUtilCommon.showSuc(if (it) "改派成功" else "暂未找到运维人员") if (it) ToastUtilCommon.showSuc("改派成功") else ToastUtilCommon.showError("暂未找到运维人员") EventBus.getDefault().post(SwitchTabMain(1)) if (!it) { EventBus.getDefault().post(SwitchTabTask(4)) app/src/main/java/com/xw/yunwei/ui/work/car/detail/dispatch/DispatchFragment.kt
@@ -39,9 +39,14 @@ viewModel.carInfo.observe(this) { initBasicInfo(it) if (it.isWorking()) { resetSlideView(binding.slideView1, DIRECTION_LEFT, "左滑收车") resetSlideView( binding.slideView1, !it.hadOpenTakeOrder(), DIRECTION_LEFT, "左滑收车" ) } else { resetSlideView(binding.slideView1, DIRECTION_RIGHT, "右滑发车") resetSlideView(binding.slideView1, true, DIRECTION_RIGHT, "右滑发车") } } @@ -124,9 +129,14 @@ SelectConfirmAcceptCarPointDialog.hadOperation = false }) { if (getSlideDirection() == DIRECTION_RIGHT) { resetSlideView(this, DIRECTION_LEFT, "左滑收车") resetSlideView( this, !carModel.hadOpenTakeOrder(), DIRECTION_LEFT, "左滑收车" ) } else if (getSlideDirection() == DIRECTION_LEFT) { resetSlideView(this, DIRECTION_RIGHT, "右滑发车") resetSlideView(this, true, DIRECTION_RIGHT, "右滑发车") } viewModel.queryInfo() } @@ -140,9 +150,14 @@ binding.slideView1.animateReset() }) { if (getSlideDirection() == DIRECTION_RIGHT) { resetSlideView(this, DIRECTION_LEFT, "左滑收车") resetSlideView( this, !carModel.hadOpenTakeOrder(), DIRECTION_LEFT, "左滑收车" ) } else if (getSlideDirection() == DIRECTION_LEFT) { resetSlideView(this, DIRECTION_RIGHT, "右滑发车") resetSlideView(this, true, DIRECTION_RIGHT, "右滑发车") } viewModel.queryInfo() } @@ -165,6 +180,12 @@ viewModel.runOnMainThread { viewModel.carInfo.value?.acceptOrTestStatus = setStatus viewModel.checkCould() resetSlideView( binding.slideView1, viewModel.carInfo.value?.hadOpenTakeOrder() != true, DIRECTION_LEFT, "左滑收车" ) } } } @@ -173,7 +194,13 @@ binding.unlockBox.setOnClickListener { viewModel.unlockByType(2) } } private fun resetSlideView(slideView: SlideButtonView, direction: Int, text: String) { private fun resetSlideView( slideView: SlideButtonView, enable: Boolean, direction: Int, text: String ) { slideView.enable = enable if (direction == DIRECTION_RIGHT) { // 右滑模式 slideView.setThumbDrawable(com.xw.common.R.mipmap.ic_slide_r) slideView.setSlideTextColor(getResColor(com.xw.common.R.color.blue_5)) @@ -181,9 +208,9 @@ slideView.setSlideText(text) slideView.setSlideDirection(direction) } else if (direction == DIRECTION_LEFT) { // 左滑模式 slideView.setThumbDrawable(com.xw.common.R.mipmap.ic_slide_l) slideView.setThumbDrawable(if (enable) com.xw.common.R.mipmap.ic_slide_l else com.xw.common.R.mipmap.ic_slide_gray_r) slideView.setSlideTextColor(getResColor(com.xw.common.R.color.white)) slideView.setSlideBackgroundColor(getResColor(com.xw.common.R.color.orange_5)) slideView.setSlideBackgroundColor(getResColor(if (enable) com.xw.common.R.color.orange_5 else com.xw.common.R.color.gray_4)) slideView.setSlideText(text) slideView.setSlideDirection(direction) } common/src/main/java/com/xw/common/custom/SlideButtonView.kt
@@ -56,6 +56,12 @@ private var maxThumbX: Float = 0f private var isDragging = false private var slideThreshold: Float = 0.7f //是否能够使用 var enable: Boolean = true set(value) { field = value invalidate() } private val scroller = Scroller(context, DecelerateInterpolator()) private var onSlideCompleteListener: (() -> Unit)? = null @@ -78,6 +84,7 @@ thumbShape = getInt(R.styleable.SlideButtonView_thumbShape, SHAPE_ROUND_RECT) thumbCornerRadius = getDimension(R.styleable.SlideButtonView_thumbCornerRadius, 0f) slideThreshold = getFloat(R.styleable.SlideButtonView_slideThreshold, 0.7f) enable = getBoolean(R.styleable.SlideButtonView_enable, enable) } finally { recycle() } @@ -213,6 +220,9 @@ } override fun onTouchEvent(event: MotionEvent): Boolean { if (!enable) { return super.onTouchEvent(event) } when (event.action) { MotionEvent.ACTION_DOWN -> { val touchX = event.x common/src/main/res/mipmap/ic_slide_gray_r.png
common/src/main/res/values/attrs.xml
@@ -50,6 +50,8 @@ <attr name="backgroundCornerRadius" format="dimension" /> <!-- 滑块圆角半径(当 thumbShape=roundRect 时有效) --> <attr name="thumbCornerRadius" format="dimension" /> <!-- 是否能够使用 --> <attr name="enable" format="boolean" /> </declare-styleable> <declare-styleable name="SlideSwitchView">