diff --git a/OCH/common/common/build.gradle b/OCH/common/common/build.gradle index 5a7057c888..6597437eaf 100644 --- a/OCH/common/common/build.gradle +++ b/OCH/common/common/build.gradle @@ -74,6 +74,7 @@ dependencies { api rootProject.ext.dependencies.flexbox api project(":OCH:common:data") + api rootProject.ext.dependencies.lottie if (Boolean.valueOf(USE_MAVEN_PACKAGE)) { api rootProject.ext.dependencies.mogocommons diff --git a/OCH/shuttle/driver_weaknet/src/main/assets/data.json b/OCH/common/common/src/main/assets/data.json similarity index 100% rename from OCH/shuttle/driver_weaknet/src/main/assets/data.json rename to OCH/common/common/src/main/assets/data.json diff --git a/OCH/shuttle/driver_weaknet/src/main/assets/images/img_0.png b/OCH/common/common/src/main/assets/images/img_0.png similarity index 100% rename from OCH/shuttle/driver_weaknet/src/main/assets/images/img_0.png rename to OCH/common/common/src/main/assets/images/img_0.png diff --git a/OCH/shuttle/driver_weaknet/src/main/assets/images/img_1.png b/OCH/common/common/src/main/assets/images/img_1.png similarity index 100% rename from OCH/shuttle/driver_weaknet/src/main/assets/images/img_1.png rename to OCH/common/common/src/main/assets/images/img_1.png diff --git a/OCH/shuttle/driver_weaknet/src/main/assets/images/img_2.png b/OCH/common/common/src/main/assets/images/img_2.png similarity index 100% rename from OCH/shuttle/driver_weaknet/src/main/assets/images/img_2.png rename to OCH/common/common/src/main/assets/images/img_2.png diff --git a/OCH/shuttle/driver_weaknet/src/main/assets/slide.json b/OCH/common/common/src/main/assets/slide.json similarity index 100% rename from OCH/shuttle/driver_weaknet/src/main/assets/slide.json rename to OCH/common/common/src/main/assets/slide.json diff --git a/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/CommonSlideView.kt b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/CommonSlideView.kt new file mode 100644 index 0000000000..69e257067f --- /dev/null +++ b/OCH/common/common/src/main/java/com/mogo/och/common/module/wigets/CommonSlideView.kt @@ -0,0 +1,159 @@ +package com.mogo.och.common.module.wigets + +import android.animation.ObjectAnimator +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.MotionEvent +import androidx.appcompat.widget.AppCompatTextView +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.constraintlayout.widget.ConstraintSet +import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger +import com.mogo.och.common.module.R +import com.mogo.och.common.module.utils.ResourcesUtils +import com.mogo.och.common.module.utils.RxUtils +import kotlinx.android.synthetic.main.common_slide_view.view.lottie_bg + +class CommonSlideView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr) { + companion object { + const val TAG = "LoadingMapStatusView" + } + + + private var initialX = 0f + private var initialY = 0f + private val tempSet = ConstraintSet() + + private var draggableButton: AppCompatTextView + + private var slideListener:SlideListener?=null + + private var slideTitle:String?=null + private var assetsfolder:String?=null + + fun setSlideListener(slideListener:SlideListener){ + this.slideListener = slideListener + } + + + init { + LayoutInflater.from(context).inflate(R.layout.common_slide_view, this, true) + + try { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.CommonSlideView) + slideTitle = typedArray.getString(R.styleable.CommonSlideView_slide_title)?:"" + assetsfolder = typedArray.getString(R.styleable.CommonSlideView_assetsfolder)?:"images" + typedArray.recycle() + } catch (e: Exception) { + e.printStackTrace() + } + + draggableButton = findViewById(R.id.actv_draggable_block) + draggableButton.text = slideTitle + lottie_bg.imageAssetsFolder = assetsfolder + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + CallerLogger.d(TAG,"onAttachedToWindow") + } + + + /** + * 为该组件的触碰事件重写事件处理方法 + */ + override fun onTouchEvent(event: MotionEvent?): Boolean { + when (event?.action) { + MotionEvent.ACTION_DOWN -> { + initialX = event.rawX; + initialY = event.rawY; + } + MotionEvent.ACTION_MOVE -> { + val dx = event.rawX - initialX; + val dy = event.rawY - initialY; + initialX = event.rawX; + initialY = event.rawY; + + if(draggableButton.translationX<0){ + tempSet.clone(this) + tempSet.setTranslationX(draggableButton.id, 0f) + tempSet.applyTo(this) + }else if(draggableButton.translationX>=0&&draggableButton.translationX<=width-draggableButton.width){ + tempSet.clone(this) + val dex = (draggableButton.translationX + dx).takeIf { it>=0 }?:0f + val newDex = dex.takeIf { it<=width-draggableButton.width }?:(width-draggableButton.width).toFloat() + tempSet.setTranslationX(draggableButton.id, newDex) + tempSet.applyTo(this) + }else{ + tempSet.clone(this) + val dex = (draggableButton.translationX + dx).takeIf { it<=width-draggableButton.width }?:(width-draggableButton.width).toFloat() + tempSet.setTranslationX(draggableButton.id, dex) + tempSet.applyTo(this) + } + } + MotionEvent.ACTION_UP -> { + if(draggableButton.translationX<(width-draggableButton.width)){ + ObjectAnimator.ofFloat( + draggableButton, "translationX", draggableButton.translationX, + 0f + ).apply { + duration = 100 + }.start() + }else if (draggableButton.translationX>=(width-draggableButton.width)){ + lottie_bg.setAnimation("data.json") + lottie_bg.playAnimation() + draggableButton.setTextColor(ResourcesUtils.getColor(R.color.common_80FFFFFF)) + RxUtils.createSubscribe(1_000) { + slideListener?.slideEnd() + } + }else{ + ObjectAnimator.ofFloat( + draggableButton, "translationX", draggableButton.translationX, + 0f + ).apply { + duration = 100 + }.start() + } + } + else -> {} + } + return true + } + + + override fun onVisibilityAggregated(isVisible: Boolean) { + super.onVisibilityAggregated(isVisible) + if(isVisible){ + lottie_bg.setAnimation("slide.json") + lottie_bg.playAnimation() + draggableButton.setTextColor(ResourcesUtils.getColor(R.color.white)) + ObjectAnimator.ofFloat( + draggableButton, "translationX", draggableButton.translationX, + 0f + ).apply { + duration = 100 + }.start() + } + } + + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerLogger.d(TAG,"onDetachedFromWindow") + } + + fun setTextValue(value: String) { + draggableButton.text = value + } + + interface SlideListener{ + fun slideEnd() + } + + + +} \ No newline at end of file diff --git a/OCH/common/common/src/main/res/drawable-nodpi/common_slide_block.png b/OCH/common/common/src/main/res/drawable-nodpi/common_slide_block.png new file mode 100755 index 0000000000..ba80399ef4 Binary files /dev/null and b/OCH/common/common/src/main/res/drawable-nodpi/common_slide_block.png differ diff --git a/OCH/common/common/src/main/res/layout/common_slide_view.xml b/OCH/common/common/src/main/res/layout/common_slide_view.xml new file mode 100644 index 0000000000..d6f443fc5d --- /dev/null +++ b/OCH/common/common/src/main/res/layout/common_slide_view.xml @@ -0,0 +1,32 @@ + + + + + + + \ No newline at end of file diff --git a/OCH/common/common/src/main/res/values/attrs.xml b/OCH/common/common/src/main/res/values/attrs.xml index 13b47cc9ee..31323f4270 100644 --- a/OCH/common/common/src/main/res/values/attrs.xml +++ b/OCH/common/common/src/main/res/values/attrs.xml @@ -9,6 +9,12 @@ + + + + + + diff --git a/OCH/common/common/src/main/res/values/colors.xml b/OCH/common/common/src/main/res/values/colors.xml index 770f857d92..4bdbaf74bf 100644 --- a/OCH/common/common/src/main/res/values/colors.xml +++ b/OCH/common/common/src/main/res/values/colors.xml @@ -16,6 +16,7 @@ #3B4577 #80000000 + #80FFFFFF #1466FB #E0EFFF #B8C2D7 diff --git a/OCH/shuttle/driver_weaknet/build.gradle b/OCH/shuttle/driver_weaknet/build.gradle index a230b9a66d..3f2bd62161 100644 --- a/OCH/shuttle/driver_weaknet/build.gradle +++ b/OCH/shuttle/driver_weaknet/build.gradle @@ -61,7 +61,6 @@ dependencies { implementation rootProject.ext.dependencies.roomRxjava implementation rootProject.ext.dependencies.androidxrecyclerview kapt rootProject.ext.dependencies.recyclerviewadapterhelper - implementation rootProject.ext.dependencies.lottie implementation rootProject.ext.dependencies.androidxroomruntime kapt rootProject.ext.dependencies.androidxroomcompiler diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/taskrunning/TaskRunningView.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/taskrunning/TaskRunningView.kt index 957f39e00d..4eb0cc1fd0 100644 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/taskrunning/TaskRunningView.kt +++ b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/ui/taskrunning/TaskRunningView.kt @@ -10,15 +10,13 @@ import androidx.recyclerview.widget.LinearLayoutManager import com.mogo.commons.AbsMogoApplication import com.mogo.eagle.core.utilcode.kotlin.onClick import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger -import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration import com.mogo.och.common.module.manager.autopilot.line.LineManager import com.mogo.och.common.module.utils.ResourcesUtils import com.mogo.och.common.module.wigets.CommonDialogStatus -import com.mogo.och.common.module.wigets.OCHCommitDialog +import com.mogo.och.common.module.wigets.CommonSlideView import com.mogo.och.shuttle.weaknet.R import com.mogo.och.weaknet.model.LineModel import com.mogo.och.weaknet.ui.bizswitch.SwtichBizeModel -import com.mogo.och.weaknet.view.BizLeaveStationView.SlideListener import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.aciv_task_leave_station_slide_bg import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.actv_arriver_station import kotlinx.android.synthetic.main.shuttle_weak_task_running.view.actv_complete_task @@ -63,7 +61,7 @@ class TaskRunningView: ConstraintLayout, TaskRunningModel.SwtichLineViewCallback rl_running_task_station_list.setLayoutManager(linearLayoutManager) mAdapter = TaskRunningAdapter(context, mutableListOf()) rl_running_task_station_list.setAdapter(mAdapter) - aciv_task_leave_station_slide_bg.setSlideListener(object : SlideListener{ + aciv_task_leave_station_slide_bg.setSlideListener(object : CommonSlideView.SlideListener { override fun slideEnd() { viewModel?.leaveStation() } diff --git a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/view/BizMapView.kt b/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/view/BizMapView.kt deleted file mode 100644 index aa7c1e657e..0000000000 --- a/OCH/shuttle/driver_weaknet/src/main/java/com/mogo/och/weaknet/view/BizMapView.kt +++ /dev/null @@ -1,63 +0,0 @@ -package com.mogo.och.weaknet.view - -import android.content.Context -import android.os.Bundle -import android.util.AttributeSet -import android.view.LayoutInflater -import android.widget.FrameLayout -import com.mogo.eagle.core.data.config.FunctionBuildConfig -import com.mogo.eagle.core.function.view.MapBizView -import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils -import com.mogo.map.uicontroller.IMogoMapUIController -import com.mogo.och.shuttle.weaknet.R - -/** - * 魔戒蓝牙控件 - * 放置于StatusBar右侧位置 - */ -class BizMapView @JvmOverloads constructor( - context: Context, - attrs: AttributeSet? = null, - defStyleAttr: Int = 0 -) : FrameLayout(context, attrs, defStyleAttr) { - - private lateinit var mapBizView: MapBizView - - init { - if (AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)) { - LayoutInflater.from(context).inflate(R.layout.shuttle_weak_m2_bizmap_map, this, true) - }else if(AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)){ - LayoutInflater.from(context).inflate(R.layout.shuttle_weak_jl_bizmap_map, this, true) - }else{ - LayoutInflater.from(context).inflate(R.layout.shuttle_weak_jl_bizmap_map, this, true) - } - mapBizView = findViewById(R.id.bizMapView) - } - - fun getUI(): IMogoMapUIController? { - return mapBizView.getUI() - } - - fun onCreate(bundle: Bundle?) { - mapBizView.onCreate(bundle) - } - fun onResume() { - mapBizView.onResume() - } - - fun onSaveInstanceState(outState: Bundle){ - mapBizView.onSaveInstanceState(outState) - } - - fun onLowMemory() { - mapBizView.onLowMemory() - } - - fun onPause() { - mapBizView.onPause() - } - - fun onDestroy() { - mapBizView.onDestroy() - } -} \ No newline at end of file diff --git a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_task_leave_station_view.xml b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_task_leave_station_view.xml index ff7fa80565..60aaed0563 100644 --- a/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_task_leave_station_view.xml +++ b/OCH/shuttle/driver_weaknet/src/main/res/layout/shuttle_weak_task_leave_station_view.xml @@ -7,15 +7,6 @@ android:layout_width="wrap_content" android:layout_height="wrap_content"> - - - - - - - - - - diff --git a/OCH/taxi/unmanned-driver/src/main/res/values/attrs.xml b/OCH/taxi/unmanned-driver/src/main/res/values/attrs.xml index 99006aeb52..0e9452f453 100644 --- a/OCH/taxi/unmanned-driver/src/main/res/values/attrs.xml +++ b/OCH/taxi/unmanned-driver/src/main/res/values/attrs.xml @@ -5,94 +5,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file