[到达终点部分页面]
This commit is contained in:
yangyakun
2023-07-18 19:48:31 +08:00
parent dbefe02d86
commit cd7329d3d4
7 changed files with 124 additions and 20 deletions

View File

@@ -126,8 +126,6 @@ class TaxiPassengerBaseFragment() :
controller.changeZoom2(0.8f)
}
showOrHideArrivedEndLayout(true)
}
BottomBar.SelectView.OVERMAPVIEW -> {
overMapView.displayCustomOverView()

View File

@@ -3,19 +3,21 @@ package com.mogo.och.taxi.passenger.ui.arrived
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RelativeLayout
import androidx.lifecycle.ViewModelProvider
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.callback.ITaxiPassengerCommonCallback
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.aciv_close
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.actv_endstation
import kotlinx.android.synthetic.main.taxi_p_arrived_end_panel.view.svp_frame
import java.util.concurrent.TimeUnit
@@ -25,7 +27,7 @@ import java.util.concurrent.TimeUnit
* 评价View
* Created on 2022/5/16
*/
class ArrivedView :RelativeLayout {
class ArrivedView : WindowRelativeLayout, ArrivedViewModel.ArrivedViewCallback {
constructor(context: Context?) : super(context)
@@ -62,6 +64,12 @@ class ArrivedView :RelativeLayout {
}
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
val viewModel = ViewModelProvider(this).get(ArrivedViewModel::class.java)
viewModel.setViewCallback(this)
}
override fun onDetachedFromWindow() {
svp_frame.setBackgroundResource(R.drawable.tail_ani_0000)
svp_frame.setVideoAllCallBack(null)
@@ -119,4 +127,8 @@ class ArrivedView :RelativeLayout {
}
}
override fun setEndStation(stationName: String) {
actv_endstation.text = stationName
}
}

View File

@@ -0,0 +1,32 @@
package com.mogo.och.taxi.passenger.ui.arrived
import androidx.lifecycle.ViewModel
import com.mogo.och.taxi.passenger.model.TaxiPassengerModel
class ArrivedViewModel: ViewModel() {
private val TAG = ArrivedViewModel::class.java.simpleName
private var viewCallback:ArrivedViewCallback?=null
init {
}
fun setViewCallback(viewCallback: ArrivedViewCallback){
this.viewCallback = viewCallback
TaxiPassengerModel.currentOCHOrder?.endSiteAddr?.let {
this.viewCallback?.setEndStation(it)
}
}
override fun onCleared() {
super.onCleared()
this.viewCallback = null
}
interface ArrivedViewCallback{
fun setEndStation(stationName:String)
}
}

View File

@@ -4,17 +4,15 @@ import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.RelativeLayout
import androidx.core.content.res.ResourcesCompat
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.ViewModelStore
import androidx.lifecycle.ViewModelStoreOwner
import com.elegant.utils.UiThreadHandler
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.util.OverlayViewUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.utils.AnimatorDrawableUtil
import com.mogo.och.taxi.passenger.R
import com.mogo.och.taxi.passenger.widget.WindowRelativeLayout
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.actv_orderinfo
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.starting_autopilot_view_close
import kotlinx.android.synthetic.main.taxi_p_start_autopilot_view.view.taxi_p_autopilot_btn_bg
@@ -26,8 +24,7 @@ import java.util.Arrays
* @author: wangmingjun
* @date: 2022/6/14
*/
class StartAutopilotView : RelativeLayout, StartAutopilotViewModel.StartAutopilotCallback,
ViewModelStoreOwner {
class StartAutopilotView : WindowRelativeLayout, StartAutopilotViewModel.StartAutopilotCallback{
constructor(context: Context) : super(context)
@@ -42,9 +39,6 @@ class StartAutopilotView : RelativeLayout, StartAutopilotViewModel.StartAutopilo
private const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
}
//定义ViewModelStore变量
private lateinit var mViewModelStore: ViewModelStore
var isStarting = false
private var mAnimationDrawable: AnimatorDrawableUtil? = null
private var mCarAnimationDrawable: AnimatorDrawableUtil? = null
@@ -87,7 +81,6 @@ class StartAutopilotView : RelativeLayout, StartAutopilotViewModel.StartAutopilo
private fun initView() {
LayoutInflater.from(context).inflate(R.layout.taxi_p_start_autopilot_view, this, true)
mViewModelStore = ViewModelStore()
}
fun startAutopilotBgAnimatorDrawable(isStart: Boolean) {
@@ -236,13 +229,6 @@ class StartAutopilotView : RelativeLayout, StartAutopilotViewModel.StartAutopilo
isStarting = false
clearStartingAnimFrame()
clearBgAnimDrawable()
//View移除时清理所有的viewModel
viewModelStore.clear()
super.onDetachedFromWindow()
}
override fun getViewModelStore(): ViewModelStore {
//接口方法实现
return mViewModelStore;
}
}

View File

@@ -0,0 +1,30 @@
package com.mogo.och.taxi.passenger.widget
import android.content.Context
import android.util.AttributeSet
import android.widget.RelativeLayout
import androidx.lifecycle.ViewModelStore
import androidx.lifecycle.ViewModelStoreOwner
open class WindowRelativeLayout: RelativeLayout, ViewModelStoreOwner {
constructor(context: Context?) : super(context)
constructor(context: Context?, attributeSet: AttributeSet) : super(context, attributeSet)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int) : super(context, attributeSet, defStyleAttr)
constructor(context: Context?, attributeSet: AttributeSet, defStyleAttr: Int, defStyleRes: Int) : super(context, attributeSet, defStyleAttr, defStyleRes)
//定义ViewModelStore变量
private var mViewModelStore: ViewModelStore = ViewModelStore()
override fun getViewModelStore(): ViewModelStore {
return mViewModelStore
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
mViewModelStore.clear()
}
}

View File

@@ -24,4 +24,49 @@
android:layout_width="@dimen/dp_120"
android:layout_height="@dimen/dp_120"/>
<androidx.appcompat.widget.AppCompatTextView
app:layout_constraintStart_toStartOf="@+id/actv_endstation"
app:layout_constraintBottom_toTopOf="@+id/actv_endstation"
android:layout_marginBottom="@dimen/dp_26"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_64"
android:text="已到达"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_endstation"
app:layout_constraintStart_toStartOf="@+id/v_video_right_rear"
app:layout_constraintBottom_toTopOf="@+id/v_video_right_rear"
android:layout_marginBottom="@dimen/dp_26"
android:textColor="@android:color/white"
android:maxLines="2"
android:ellipsize="end"
android:maxWidth="@dimen/dp_1200"
android:textSize="@dimen/dp_100"
tools:text="环球贸易中心环球贸易中心环球贸易中心环球贸易中心环球贸易中心环球贸易中心环球贸易中心环球贸易中心"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<View
android:id="@+id/v_video_right_rear"
android:background="@color/background_error"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="@dimen/dp_90"
android:layout_marginBottom="@dimen/dp_90"
android:layout_width="@dimen/dp_900"
android:layout_height="@dimen/dp_506"/>
<androidx.appcompat.widget.AppCompatTextView
app:layout_constraintStart_toStartOf="@+id/v_video_right_rear"
app:layout_constraintBottom_toBottomOf="@+id/v_video_right_rear"
android:layout_marginStart="@dimen/dp_44"
android:layout_marginBottom="@dimen/dp_11"
android:text="前向摄像头"
android:textSize="@dimen/dp_40"
android:textColor="@color/taxi_p_76D7FF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -77,6 +77,7 @@
<color name="taxi_p_282F62">#282F62</color>
<color name="taxi_p_121842">#121842</color>
<color name="taxi_p_242C65">#242C65</color>
<color name="taxi_p_76D7FF">#76D7FF</color>