[6.5.0]
[fea] [视角切换]
This commit is contained in:
@@ -25,7 +25,7 @@ class OrderStatusView : AppCompatImageView, OrderStatusViewModel.IVisualCallback
|
||||
)
|
||||
|
||||
private fun initView() {
|
||||
setImageResource(R.drawable.common_visual_medium)
|
||||
setImageResource(R.drawable.common_status_unorder)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
|
||||
@@ -0,0 +1,220 @@
|
||||
package com.mogo.och.common.module.wigets.map.switchvisual
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.LinearGradient
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Shader
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.constraintlayout.widget.ConstraintSet
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.R
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
|
||||
class SeekBarView : ConstraintLayout, VisualViewModel.IVisualCallback {
|
||||
|
||||
//定义、并创建画笔
|
||||
var p = Paint().apply {
|
||||
strokeWidth = 1f
|
||||
style = Paint.Style.STROKE
|
||||
isAntiAlias = true
|
||||
shader = LinearGradient(
|
||||
0f, 0f, 600f, 600f, intArrayOf(Color.RED, Color.BLUE, Color.BLACK),
|
||||
null, Shader.TileMode.CLAMP
|
||||
)
|
||||
}
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
private var viewModel: VisualViewModel? = null
|
||||
|
||||
override fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int) {
|
||||
super.onLayout(changed, left, top, right, bottom)
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
super.onDraw(canvas)
|
||||
|
||||
val split = (height - draggableButton.height) / 3f
|
||||
canvas.drawLine(0f,split,width.toFloat(),split,p)
|
||||
canvas.drawLine(0f,split*2,width.toFloat(),split*2,p)
|
||||
canvas.drawLine(0f,(height - draggableButton.height).toFloat(),width.toFloat(),split*3,p)
|
||||
val translationY = draggableButton.translationY
|
||||
canvas.drawLine(0f,translationY,width.toFloat(),translationY,p)
|
||||
}
|
||||
|
||||
private var initialX = 0f
|
||||
private var initialY = 0f
|
||||
private val tempSet = ConstraintSet()
|
||||
|
||||
/**
|
||||
* 为该组件的触碰事件重写事件处理方法
|
||||
*/
|
||||
override fun onTouchEvent(event: MotionEvent?): Boolean {
|
||||
if(value==VisualViewModel.Visualangle.UnChange){
|
||||
return true
|
||||
}
|
||||
when (event?.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
initialX = event.rawX;
|
||||
initialY = event.rawY;
|
||||
}
|
||||
MotionEvent.ACTION_MOVE -> {
|
||||
|
||||
if(draggableButton.translationY<-draggableButton.height){
|
||||
tempSet.clone(this)
|
||||
tempSet.setTranslationY(R.id.iv_setting_only_value,-draggableButton.height.toFloat())
|
||||
tempSet.applyTo(this)
|
||||
return true
|
||||
}else if (draggableButton.translationY>(height)){
|
||||
tempSet.clone(this)
|
||||
tempSet.setTranslationY(R.id.iv_setting_only_value,(height).toFloat())
|
||||
tempSet.applyTo(this)
|
||||
return true
|
||||
}
|
||||
|
||||
val dx = event.rawX - initialX;
|
||||
val dy = event.rawY - initialY;
|
||||
initialX = event.rawX;
|
||||
initialY = event.rawY;
|
||||
|
||||
tempSet.clone(this)
|
||||
tempSet.setTranslationY(R.id.iv_setting_only_value,draggableButton.translationY+dy)
|
||||
tempSet.applyTo(this)
|
||||
}
|
||||
MotionEvent.ACTION_UP -> {
|
||||
if(draggableButton.translationY<0){
|
||||
translationByValue(VisualViewModel.Visualangle.Middle)
|
||||
}else if (draggableButton.translationY>(height-draggableButton.height)){
|
||||
translationByValue(VisualViewModel.Visualangle.Long)
|
||||
}else{
|
||||
val marginTop = draggableButton.translationY
|
||||
val split = (height - draggableButton.height) / 2
|
||||
|
||||
// if(marginTop>0&&marginTop<split){
|
||||
// translationByValue(Visualangle.Middle)
|
||||
// }else if(marginTop>split&&marginTop<split*2){
|
||||
// translationByValue(Visualangle.Crossroads)
|
||||
// }else if(marginTop*2>split&&marginTop<(height - draggableButton.height)){
|
||||
// translationByValue(Visualangle.Long)
|
||||
// }
|
||||
|
||||
if(marginTop>0&&marginTop<split){
|
||||
translationByValue(VisualViewModel.Visualangle.Middle)
|
||||
}else if(marginTop>split&&marginTop<(height - draggableButton.height)){
|
||||
translationByValue(VisualViewModel.Visualangle.Long)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private var value: VisualViewModel.Visualangle by Delegates.observable(VisualViewModel.Visualangle.None) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
viewModel?.changeVisualView(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
fun translationByValue(visualangle: VisualViewModel.Visualangle){
|
||||
value = visualangle
|
||||
when (visualangle) {
|
||||
VisualViewModel.Visualangle.Middle -> {
|
||||
ObjectAnimator.ofFloat(draggableButton, "translationY", draggableButton.translationY, 0f).apply {
|
||||
duration = 100
|
||||
}.start()
|
||||
}
|
||||
VisualViewModel.Visualangle.Long -> {
|
||||
ObjectAnimator.ofFloat(
|
||||
draggableButton,
|
||||
"translationY",
|
||||
draggableButton.translationY,
|
||||
(height - draggableButton.height).toFloat()
|
||||
).apply {
|
||||
duration = 100
|
||||
}.start()
|
||||
}
|
||||
VisualViewModel.Visualangle.UnChange -> {
|
||||
ObjectAnimator.ofFloat(
|
||||
draggableButton,
|
||||
"translationY",
|
||||
draggableButton.translationY,
|
||||
(height - draggableButton.height) / 2f
|
||||
).apply {
|
||||
duration = 100
|
||||
}.start()
|
||||
alpha = 0.5f
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private lateinit var draggableButton:ImageView
|
||||
|
||||
private fun initView() {
|
||||
LayoutInflater.from(context).inflate(R.layout.taxi_p_seekbar_visualangle, this, true)
|
||||
draggableButton = findViewById(R.id.iv_setting_only_value)
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(VisualViewModel::class.java)
|
||||
}
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun setMiddleAngle() {
|
||||
UiThreadHandler.post({
|
||||
translationByValue(VisualViewModel.Visualangle.Middle)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
|
||||
}
|
||||
|
||||
override fun setLongAngle() {
|
||||
UiThreadHandler.post({
|
||||
translationByValue(VisualViewModel.Visualangle.Long)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
|
||||
}
|
||||
|
||||
override fun setUnableChange() {
|
||||
UiThreadHandler.post({
|
||||
translationByValue(VisualViewModel.Visualangle.UnChange)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun setSkyboxAngle() {
|
||||
UiThreadHandler.post({
|
||||
translationByValue(VisualViewModel.Visualangle.Middle)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
@@ -62,11 +62,21 @@ class VisualView : AppCompatImageView, VisualViewModel.IVisualCallback {
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun setViewResource(resource: Int) {
|
||||
override fun setMiddleAngle() {
|
||||
UiThreadHandler.post({
|
||||
setImageResource(resource)
|
||||
setImageResource(R.drawable.common_visual_medium)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun setLongAngle() {
|
||||
UiThreadHandler.post({
|
||||
setImageResource(R.drawable.common_visual_long)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun setUnableChange() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
package com.mogo.och.common.module.wigets.map.switchvisual
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.listener.MogoMapListenerHandler
|
||||
import com.mogo.eagle.core.function.angle.scenes.LongSight
|
||||
import com.mogo.eagle.core.function.api.map.angle.IMoGoVisualAngleChangeProvider
|
||||
import com.mogo.eagle.core.function.api.map.angle.Scene
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.mogo.och.common.module.R
|
||||
import com.mogo.eagle.core.function.angle.scenes.Default
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
class VisualViewModel : ViewModel(), IMogoMapListener {
|
||||
class VisualViewModel : ViewModel(),
|
||||
IMoGoVisualAngleChangeProvider.OnMoGoVisualAngleSceneChangeListener {
|
||||
|
||||
private val TAG = VisualViewModel::class.java.simpleName
|
||||
|
||||
@@ -20,72 +22,116 @@ class VisualViewModel : ViewModel(), IMogoMapListener {
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.unregisterHostMapListener(TAG)
|
||||
CallerVisualAngleManager.removeListener(TAG)
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IVisualCallback) {
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG, this)
|
||||
CallerVisualAngleManager.addListener(TAG, this)
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
|
||||
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode?) {
|
||||
CallerLogger.d(TAG,"视角切换成功${visualAngleMode}")
|
||||
visualAngleMode?.let {
|
||||
if (visualAngleMode.isMediumSight) {
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setViewResource(R.drawable.common_visual_medium)
|
||||
} else if (visualAngleMode.isLongSight) {
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setViewResource(R.drawable.common_visual_long)
|
||||
} else if (visualAngleMode.isCloseSight) {
|
||||
this.viewCallback?.setViewShow(false)
|
||||
} else{
|
||||
this.viewCallback?.setViewShow(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
override fun onSceneChanged(scene: Scene) {
|
||||
if (scene.isCanSwitch) {// 可切换
|
||||
when (scene.angle) {
|
||||
VisualAngleMode.MODE_MEDIUM_SIGHT -> {
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setMiddleAngle()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
override fun onMapLoaded() {
|
||||
super.onMapLoaded()
|
||||
CallerLogger.d(TAG,"地图加载成功 onMapLoaded")
|
||||
val mapUIController = CallerMapUIServiceManager.getMapUIController()
|
||||
mapUIController?.let {
|
||||
val visualAngleMode = mapUIController.currentMapVisualAngle
|
||||
if (visualAngleMode.isMediumSight) {
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setViewResource(R.drawable.common_visual_medium)
|
||||
} else if (visualAngleMode.isLongSight) {
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setViewResource(R.drawable.common_visual_long)
|
||||
} else if (visualAngleMode.isCloseSight) {
|
||||
this.viewCallback?.setViewShow(false)
|
||||
} else{
|
||||
this.viewCallback?.setViewShow(false)
|
||||
VisualAngleMode.MODE_LONG_SIGHT -> {
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setLongAngle()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
|
||||
}
|
||||
|
||||
VisualAngleMode.MAP_STYLE_VR_SKY_BOX -> {
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setSkyboxAngle()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
else -> {
|
||||
// 不可切换
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(false)
|
||||
this.viewCallback?.setUnableChange()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
} else {// 不可切换
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(false)
|
||||
this.viewCallback?.setUnableChange()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
fun changeVisualView() {
|
||||
val mapUIController = CallerMapUIServiceManager.getMapUIController()
|
||||
mapUIController?.currentMapVisualAngle?.let {
|
||||
CallerLogger.d(TAG,"切换视角:${it}")
|
||||
if (it.isLongSight) {
|
||||
mapUIController.setLockMode(true);
|
||||
mapUIController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
} else if (it.isMediumSight) {
|
||||
mapUIController.setLockMode(false);
|
||||
mapUIController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
} else {
|
||||
mapUIController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
CallerVisualAngleManager.getCurrentScene().let {
|
||||
val default = Default(0)
|
||||
|
||||
when (it.angle) {
|
||||
VisualAngleMode.MODE_MEDIUM_SIGHT -> {
|
||||
if(default.angle==VisualAngleMode.MODE_MEDIUM_SIGHT){
|
||||
CallerVisualAngleManager.changeScene(LongSight(0))
|
||||
}
|
||||
}
|
||||
|
||||
VisualAngleMode.MODE_LONG_SIGHT -> {
|
||||
CallerVisualAngleManager.changeScene(Default(0))
|
||||
}
|
||||
VisualAngleMode.MAP_STYLE_VR_SKY_BOX -> {
|
||||
if(default.angle==VisualAngleMode.MAP_STYLE_VR_SKY_BOX){
|
||||
CallerVisualAngleManager.changeScene(LongSight(0))
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun changeVisualView(angle: Visualangle) {
|
||||
|
||||
when (angle) {
|
||||
Visualangle.Middle -> {
|
||||
CallerVisualAngleManager.changeScene(Default(0))
|
||||
}
|
||||
|
||||
Visualangle.Long -> {
|
||||
CallerVisualAngleManager.changeScene(LongSight(0))
|
||||
}
|
||||
|
||||
Visualangle.UnChange -> {
|
||||
viewCallback?.setUnableChange()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum class Visualangle {
|
||||
Middle, Long, UnChange,None
|
||||
}
|
||||
|
||||
|
||||
interface IVisualCallback {
|
||||
fun setViewShow(boolean: Boolean)
|
||||
fun setViewShow(boolean: Boolean) {}
|
||||
|
||||
fun setViewResource(resource: Int)
|
||||
fun setMiddleAngle() {}
|
||||
|
||||
fun setLongAngle() {}
|
||||
|
||||
fun setSkyboxAngle() {}
|
||||
|
||||
fun setUnableChange() {}
|
||||
}
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="208dp"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_setting_only_bg"
|
||||
android:layout_width="39dp"
|
||||
android:layout_height="141dp"
|
||||
android:src="@drawable/taxi_p_visual_angle_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_setting_only_value"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/taxi_p_visual_angle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</merge>
|
||||
@@ -121,10 +121,10 @@
|
||||
android:id="@+id/lbv_go2_center"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginBottom="@dimen/dp_607"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_58"
|
||||
android:layout_width="@dimen/dp_78"
|
||||
android:layout_height="@dimen/dp_78"/>
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.music.MusicView
|
||||
android:id="@+id/mv_music_info"
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.och.taxi.passenger.common.R
|
||||
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_center_location
|
||||
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_center_location_bg
|
||||
import kotlinx.android.synthetic.main.taxi_p_leftbar.view.iv_visual_angle_title_value_bg
|
||||
|
||||
|
||||
class LeftBarView : ConstraintLayout {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:centerColor="@color/taxi_cp_9EB0D3"
|
||||
android:endColor="@color/taxi_cp_009EB0D3"
|
||||
android:startColor="@color/taxi_cp_009EB0D3" />
|
||||
</shape>
|
||||
@@ -2,28 +2,65 @@
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/dp_78"
|
||||
android:layout_height="@dimen/dp_78"
|
||||
android:layout_width="@dimen/dp_103"
|
||||
android:layout_height="@dimen/dp_441"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_center_location_bg"
|
||||
android:layout_width="@dimen/dp_78"
|
||||
android:layout_height="@dimen/dp_78"
|
||||
android:layout_marginTop="@dimen/dp_64"
|
||||
android:src="@drawable/taxi_p_reset_location_bg"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/taxi_p_left_bar_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_setting_music_bg" />
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.mogo.och.common.module.wigets.map.switchvisual.SeekBarView
|
||||
android:id="@+id/iv_visual_angle_title_value_bg"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="208dp"
|
||||
android:layout_marginTop="@dimen/dp_69"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_visual_angle_title_head"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:layout_marginTop="@dimen/dp_44"
|
||||
android:src="@drawable/taxi_p_title_head"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_center_location_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_center_location_bg"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_center_location"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_center_location_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_center_location_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_center_location_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_center_location_bg"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:layout_marginBottom="@dimen/dp_63"
|
||||
android:src="@drawable/taxi_p_center_location_selector"
|
||||
android:layout_width="@dimen/dp_41"
|
||||
android:layout_height="@dimen/dp_42"/>
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_center_location_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/iv_center_location_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/iv_center_location_bg" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_split"
|
||||
android:background="@drawable/taxi_p_left_bar_split"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/iv_center_location"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_visual_angle_title_bottom"
|
||||
android:layout_width="@dimen/dp_68"
|
||||
android:layout_height="@dimen/dp_2"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_visual_angle_title_bottom"
|
||||
android:layout_width="@dimen/dp_44"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:src="@drawable/taxi_p_title_bottom"
|
||||
android:layout_marginTop="-12dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/iv_visual_angle_title_value_bg"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
</merge>
|
||||
28
OCH/taxi/pcommon/src/main/res/layout/taxi_p_seekbar_.xml
Normal file
28
OCH/taxi/pcommon/src/main/res/layout/taxi_p_seekbar_.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="100px"
|
||||
android:layout_height="208px"
|
||||
tools:parentTag="androidx.constraintlayout.motion.widget.MotionLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_setting_only_bg"
|
||||
android:layout_width="39px"
|
||||
android:layout_height="141px"
|
||||
android:src="@drawable/taxi_p_visual_angle_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_setting_only_value"
|
||||
android:layout_width="100px"
|
||||
android:layout_height="100px"
|
||||
android:src="@drawable/taxi_p_visual_angle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</merge>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="208dp"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_setting_only_bg"
|
||||
android:layout_width="39dp"
|
||||
android:layout_height="141dp"
|
||||
android:src="@drawable/taxi_p_visual_angle_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_setting_only_value"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/taxi_p_visual_angle"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</merge>
|
||||
@@ -21,4 +21,7 @@
|
||||
<color name="taxi_cp_111D2F">#111D2F</color>
|
||||
<color name="taxi_cp_41444D">#41444D</color>
|
||||
|
||||
<color name="taxi_cp_9EB0D3">#9EB0D3</color>
|
||||
<color name="taxi_cp_009EB0D3">#009EB0D3</color>
|
||||
|
||||
</resources>
|
||||
@@ -93,9 +93,6 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
TaxiTaskModel.INSTANCE.startNaviToEndStation(isShow);
|
||||
}
|
||||
|
||||
public void reportToEndDisAndTime(long lastSumLength, long duration) {//米/秒
|
||||
// TaxiModel.INSTANCE.reportOrderRemain(lastSumLength,duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotArriveEnd() {
|
||||
|
||||
@@ -166,6 +166,7 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/viewDriverMsgBoxButton" />
|
||||
|
||||
<!--平行驾驶状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ParallelDriveView
|
||||
android:id="@+id/parallelDriveView"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -5,14 +5,19 @@ import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.common.module.biz.provider.CommonService
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.unmanned.passenger.ui.TaxiPassengerBaseFragment
|
||||
import com.mogo.och.unmanned.taxi.passenger.R
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_debug.view.tv_map_visual
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_debug.view.tv_map_visual_cro
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_debug.view.tv_show_arrive
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_debug.view.tv_show_evaluate
|
||||
import kotlinx.android.synthetic.main.taxt_u_p_debug.view.tv_show_order_info
|
||||
@@ -27,7 +32,8 @@ class DebugView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoAutopilotStatusListener,
|
||||
DebugViewModel.IVisualCallback {
|
||||
|
||||
companion object {
|
||||
const val TAG = "DebugView"
|
||||
@@ -57,6 +63,12 @@ class DebugView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
val viewModel = findViewTreeViewModelStoreOwner()?.let {
|
||||
ViewModelProvider(it).get(DebugViewModel::class.java)
|
||||
}
|
||||
|
||||
viewModel?.setDistanceCallback(this)
|
||||
|
||||
tv_show_arrive.onClick {
|
||||
fragment?.showOrHideArrivedEndLayout(true)
|
||||
}
|
||||
@@ -75,6 +87,12 @@ class DebugView @JvmOverloads constructor(
|
||||
tv_show_evaluate.onClick {
|
||||
fragment?.setEvaluateView()
|
||||
}
|
||||
tv_map_visual.onClick {
|
||||
viewModel?.changeVisualView()
|
||||
}
|
||||
tv_map_visual_cro.onClick {
|
||||
viewModel?.changeVisualView2Cro()
|
||||
}
|
||||
}
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun changeOverview(debugEvent: DebugEvent) {
|
||||
@@ -93,5 +111,20 @@ class DebugView @JvmOverloads constructor(
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
override fun setMiddleAngle() {
|
||||
tv_map_visual.text = "中视角"
|
||||
}
|
||||
|
||||
override fun setLongAngle() {
|
||||
tv_map_visual.text = "远视角"
|
||||
}
|
||||
|
||||
override fun setUnableChange() {
|
||||
tv_map_visual.text = "路口视角"
|
||||
}
|
||||
|
||||
override fun setSkyboxAngle() {
|
||||
tv_map_visual.text = "天空盒子视角"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.mogo.och.unmanned.passenger.ui.debug
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.eagle.core.function.angle.scenes.CrossRoad
|
||||
import com.mogo.eagle.core.function.angle.scenes.LongSight
|
||||
import com.mogo.eagle.core.function.api.map.angle.IMoGoVisualAngleChangeProvider
|
||||
import com.mogo.eagle.core.function.api.map.angle.Scene
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.mogo.eagle.core.function.angle.scenes.Default
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
|
||||
class DebugViewModel : ViewModel(),
|
||||
IMoGoVisualAngleChangeProvider.OnMoGoVisualAngleSceneChangeListener {
|
||||
|
||||
private val TAG = DebugViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IVisualCallback? = null
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
CallerVisualAngleManager.removeListener(TAG)
|
||||
this.viewCallback = null
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IVisualCallback) {
|
||||
CallerVisualAngleManager.addListener(TAG, this)
|
||||
this.viewCallback = viewCallback
|
||||
}
|
||||
|
||||
override fun onSceneChanged(scene: Scene) {
|
||||
if (scene.isCanSwitch) {// 可切换
|
||||
when (scene.angle) {
|
||||
VisualAngleMode.MODE_MEDIUM_SIGHT -> {
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setMiddleAngle()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
VisualAngleMode.MODE_LONG_SIGHT -> {
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setLongAngle()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
VisualAngleMode.MAP_STYLE_VR_SKY_BOX -> {
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(true)
|
||||
this.viewCallback?.setSkyboxAngle()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
else -> {
|
||||
// 不可切换
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(false)
|
||||
this.viewCallback?.setUnableChange()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
} else {// 不可切换
|
||||
UiThreadHandler.post({
|
||||
this.viewCallback?.setViewShow(false)
|
||||
this.viewCallback?.setUnableChange()
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
}
|
||||
|
||||
fun changeVisualView() {
|
||||
CallerVisualAngleManager.getCurrentScene().let {
|
||||
val default = Default(0)
|
||||
|
||||
when (it.angle) {
|
||||
VisualAngleMode.MODE_MEDIUM_SIGHT -> {
|
||||
if(default.angle==VisualAngleMode.MODE_MEDIUM_SIGHT){
|
||||
CallerVisualAngleManager.changeScene(LongSight(0))
|
||||
}
|
||||
}
|
||||
|
||||
VisualAngleMode.MODE_LONG_SIGHT -> {
|
||||
CallerVisualAngleManager.changeScene(Default(0))
|
||||
}
|
||||
VisualAngleMode.MAP_STYLE_VR_SKY_BOX -> {
|
||||
if(default.angle==VisualAngleMode.MAP_STYLE_VR_SKY_BOX){
|
||||
CallerVisualAngleManager.changeScene(LongSight(0))
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
CallerVisualAngleManager.changeScene(Default(0))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun changeVisualView2Cro() {
|
||||
CallerVisualAngleManager.changeScene(CrossRoad(0))
|
||||
}
|
||||
|
||||
interface IVisualCallback {
|
||||
fun setViewShow(boolean: Boolean) {}
|
||||
|
||||
fun setMiddleAngle() {}
|
||||
|
||||
fun setLongAngle() {}
|
||||
|
||||
fun setSkyboxAngle() {}
|
||||
|
||||
fun setUnableChange() {}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -121,10 +121,10 @@
|
||||
android:id="@+id/lbv_go2_center"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_58"
|
||||
android:layout_marginBottom="@dimen/dp_607"
|
||||
android:layout_width="@dimen/dp_78"
|
||||
android:layout_height="@dimen/dp_78"/>
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
<com.mogo.och.taxi.passenger.ui.music.MusicView
|
||||
@@ -222,11 +222,10 @@
|
||||
android:layout_marginBottom="-80dp"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
|
||||
|
||||
<com.mogo.och.unmanned.passenger.ui.debug.DebugView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
@@ -39,13 +39,25 @@
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_show_overmap_debug"
|
||||
android:text="overmap"
|
||||
android:text="高精地图轨迹点展示"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_show_evaluate"
|
||||
android:text="overmap"
|
||||
android:text="结束评论"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_map_visual"
|
||||
android:text="角度变更"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_map_visual_cro"
|
||||
android:text="变更为路口视角"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user