[fea]
[首页样式调整]
This commit is contained in:
yangyakun
2025-05-08 10:21:01 +08:00
parent 39bd33a9ca
commit 81995e5c40
7 changed files with 278 additions and 116 deletions

View File

@@ -40,13 +40,11 @@ import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.cb_setting_voice
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.chekAndStartAutopilotView
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.infoVideoView
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.itinerary
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.lbv_go2_center
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.light_setting
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.mHomeView
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.musicBarView
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.mv_music_info
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.overMapView
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.speedView
import kotlinx.android.synthetic.main.taxt_u_p_base_fragment.voice_setting
/**
@@ -114,25 +112,7 @@ class TaxiPassengerBaseFragment :
}
}
}
lbv_go2_center.setOrderIdCallback(object : LeftBarView.LeftBarCallback{
override fun setGo2CenterClick() {
when (bottom.getCurrentPage()) {
BottomBar.SelectView.PRECISIONMAP -> {
//切换到地图中间
// mapBizView.getUI()?.let {
// val wgs02Location = OchLocationManager.getWgs02Location()
// it.moveToCenter(MogoLatLng(wgs02Location.latitude,wgs02Location.longitude))
// }
}
BottomBar.SelectView.OVERMAPVIEW -> {
//overMapView.displayCustomOverView()
}
else -> {}
}
}
})
}
private fun initListener() {
@@ -156,9 +136,6 @@ class TaxiPassengerBaseFragment :
overMapView.visibility = View.GONE
mHomeView.visibility = View.VISIBLE
presenter?.setItineraryVisibility()
speedView.visibility = View.VISIBLE
lbv_go2_center.visibility = View.VISIBLE
lbv_go2_center.showAngle()
CallerHmiManager.showTrafficLightView()
infoVideoView.visibility = View.GONE
mv_music_info.visibility = View.GONE
@@ -169,8 +146,6 @@ class TaxiPassengerBaseFragment :
overMapView.visibility = View.VISIBLE
mHomeView.visibility = View.GONE
presenter?.setItineraryVisibility()
speedView.visibility = View.VISIBLE
lbv_go2_center.visibility = View.GONE
//lbv_go2_center.showOnlyCenter()
CallerHmiManager.showTrafficLightView()
infoVideoView.visibility = View.GONE
@@ -182,8 +157,6 @@ class TaxiPassengerBaseFragment :
overMapView.visibility = View.GONE
mHomeView.visibility = View.GONE
presenter?.setItineraryVisibility()
speedView.visibility = View.GONE
lbv_go2_center.visibility = View.GONE
CallerHmiManager.hideTrafficLightView()
infoVideoView.visibility = View.VISIBLE
mv_music_info.visibility = View.GONE
@@ -194,8 +167,6 @@ class TaxiPassengerBaseFragment :
overMapView.visibility = View.GONE
mHomeView.visibility = View.GONE
presenter?.setItineraryVisibility()
speedView.visibility = View.GONE
lbv_go2_center.visibility = View.GONE
CallerHmiManager.hideTrafficLightView()
infoVideoView.visibility = View.GONE
mv_music_info.visibility = View.VISIBLE
@@ -394,7 +365,7 @@ class TaxiPassengerBaseFragment :
allAnimator.addAll(aniStatusBar(isShow))
allAnimator.addAll(aniBottomBar(isShow))
allAnimator.addAll(aniSpeedSettingRow(isShow,speedView))
//allAnimator.addAll(aniSpeedSettingRow(isShow,speedView))
allAnimator.addAll(aniOrderInfo(isShow))
animatorSet.playTogether(allAnimator)

View File

@@ -1,12 +1,26 @@
package com.mogo.och.unmanned.passenger.ui.homepage
import android.animation.Animator
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.constraintlayout.widget.Guideline
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.och.unmanned.passenger.ui.bar.LeftBarView
import com.mogo.och.unmanned.taxi.passenger.R
import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_all
import kotlinx.android.synthetic.main.taxi_p_home.view.acbtn_show_hdmap
import kotlinx.android.synthetic.main.taxi_p_home.view.hdMapView
import kotlinx.android.synthetic.main.taxi_p_home.view.lbv_go2_center
import kotlinx.android.synthetic.main.taxi_p_home.view.leftContainer
import kotlinx.android.synthetic.main.taxi_p_home.view.leftEndGuideline
import kotlinx.android.synthetic.main.taxi_p_home.view.midContainer
import kotlinx.android.synthetic.main.taxi_p_home.view.midStartGuideline
class HomeView @JvmOverloads constructor(
context: Context,
@@ -15,9 +29,47 @@ class HomeView @JvmOverloads constructor(
) : ConstraintLayout(context, attrs, defStyleAttr){
private var isAMapShow = true
private var isHDMapShow = false
private var isReadyForShowHDMap = false
private var currentAnimator: ValueAnimator? = null
private var TAG = "HomeView"
private fun initView() {
LayoutInflater.from(context).inflate(R.layout.taxi_p_home, this, true)
initlistener()
}
private fun initlistener() {
lbv_go2_center.setOrderIdCallback(object : LeftBarView.LeftBarCallback{
override fun setGo2CenterClick() {
//切换到地图中间
// mapBizView.getUI()?.let {
// val wgs02Location = OchLocationManager.getWgs02Location()
// it.moveToCenter(MogoLatLng(wgs02Location.latitude,wgs02Location.longitude))
// }
//overMapView.displayCustomOverView()
}
})
acbtn_show_hdmap.onClick {
showHdMap()
}
acbtn_show_all.onClick {
showAmapAndHdMap()
}
}
fun showHdMap(){
updateViewState(true,false,true)
}
fun showAmapAndHdMap(){
updateViewState(true,true,false)
}
fun onCreate(savedInstanceState: Bundle?) {
@@ -45,6 +97,111 @@ class HomeView @JvmOverloads constructor(
}
private fun updateViewState(
showHDMapView: Boolean,
showAMapView: Boolean,
animate: Boolean = true
) {
// 展示高德地图和高精地图
if (showHDMapView && showAMapView) {
CallerLogger.d(TAG,"展示高德地图和高精地图${showHDMapView}_$showAMapView")
midStartGuideline.setGuidelinePercent(0.333f)
if (animate) {
animateGuidelinePercent(
leftEndGuideline,
0.333f,
1000
) {
lbv_go2_center.visibility = GONE
}
} else {
leftEndGuideline.setGuidelinePercent(0.333f)
lbv_go2_center.visibility = GONE
}
}
// 不展示高德 展示高精
if (showHDMapView && !showAMapView) {
CallerLogger.d(TAG,"展示高德 不展示高精${showHDMapView}_$showAMapView")
if (animate) {
animateGuidelinePercent(
leftEndGuideline,
0.666f,
1000,
end = {
lbv_go2_center.visibility = VISIBLE
}
)
} else {
leftEndGuideline.setGuidelinePercent(0.666f)
lbv_go2_center.visibility = VISIBLE
}
}
// 不展示高精 展示高德
if (!showHDMapView && showAMapView) {
CallerLogger.d(TAG,"展示高精 不展示高德${showHDMapView}_$showAMapView")
if (animate) {
midStartGuideline.setGuidelinePercent(0.0f)
animateGuidelinePercent(
leftEndGuideline,
0.0f,
1000
) {
lbv_go2_center.visibility = GONE
}
}
else {
leftEndGuideline.setGuidelinePercent(0.0f)
midStartGuideline.setGuidelinePercent(0.0f)
lbv_go2_center.visibility = GONE
}
}
}
private fun animateGuidelinePercent(
guideline: Guideline,
endPercent: Float,
duration: Long,
start: (() -> Unit)? = null,
end: (() -> Unit)? = null
) {
// 如果当前已有动画在运行,先取消它
if (currentAnimator?.isRunning == true) {
currentAnimator?.cancel()
}
val startPercent = (guideline.layoutParams as ConstraintLayout.LayoutParams).guidePercent
// 创建新的 ObjectAnimator
currentAnimator = ObjectAnimator.ofFloat(
guideline,
"guidelinePercent",
startPercent,
endPercent
)
// 设置动画时长
currentAnimator?.setDuration(duration)
// 设置动画回调监听器
currentAnimator?.addListener(object : Animator.AnimatorListener {
override fun onAnimationStart(animation: Animator) {
start?.invoke()
}
override fun onAnimationEnd(animation: Animator) {
end?.invoke()
}
override fun onAnimationCancel(animation: Animator) {
}
override fun onAnimationRepeat(animation: Animator) {
}
})
// 启动新的动画
currentAnimator?.start()
}
init {
try {
initView()

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -6,27 +6,6 @@
android:layout_height="match_parent"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/leftContainer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/taxi_p_home_map_bg_1"
android:layout_marginBottom="@dimen/dp_10"
app:layout_constraintEnd_toEndOf="@id/leftEndGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/hdMapView"
app:styleMode="MAP_STYLE_DAY_VR_TAXI"
app:default_perspective="MAP_STYLE_VR_SKY_BOX"
app:isWeatherEnable="true"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Guideline
android:id="@+id/leftEndGuideline"
android:layout_width="wrap_content"
@@ -43,21 +22,104 @@
app:layout_constraintGuide_percent="0.333" />
<androidx.cardview.widget.CardView
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/midContainer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/dp_6"
android:layout_marginTop="24dp"
android:layout_marginRight="10dp"
app:cardElevation="4dp"
android:layout_marginBottom="24dp"
app:cardCornerRadius="20.0dp"
app:layout_constraintEnd_toEndOf="@id/rightStartGuideline"
app:layout_constraintStart_toStartOf="@id/midStartGuideline">
android:layout_marginBottom="@dimen/dp_10"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="-6.5dp"
android:layout_marginEnd="-6.5dp"
app:layout_constraintStart_toEndOf="@+id/midStartGuideline"
app:layout_constraintEnd_toStartOf="@id/rightStartGuideline">
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/taxi_p_home_middle_top_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_676">
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:background="@drawable/taxi_p_home_middle_bottom_bg"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_676">
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/leftContainer"
android:layout_width="0dp"
android:layout_height="match_parent"
android:background="@drawable/taxi_p_home_map_bg_1"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginEnd="-6.5dp"
app:layout_constraintEnd_toStartOf="@id/leftEndGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.mogo.eagle.core.function.view.MapBizView
android:id="@+id/hdMapView"
app:styleMode="MAP_STYLE_DAY_VR_TAXI"
app:default_perspective="MAP_STYLE_VR_SKY_BOX"
app:isWeatherEnable="true"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.mogo.och.unmanned.passenger.ui.speed.SpeedView
android:id="@+id/speedView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- 红绿灯 -->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/traffic_light_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_40"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="gone"
app:traffic_light_user="traffic_light_taxi_p" />
<!--融合红绿灯-->
<com.mogo.eagle.core.function.hmi.ui.widget.FusionTrafficLightView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_150"
android:visibility="gone"
app:fusionLightUser="passenger"
/>
<com.mogo.och.unmanned.passenger.ui.bar.LeftBarView
android:id="@+id/lbv_go2_center"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginEnd="@dimen/dp_33"
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Guideline
@@ -73,8 +135,9 @@
android:layout_height="match_parent"
android:background="@drawable/taxi_p_home_map_bg_1"
android:layout_marginBottom="@dimen/dp_10"
android:layout_marginStart="-6.5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@id/rightStartGuideline">
app:layout_constraintStart_toEndOf="@id/rightStartGuideline">
<com.mogo.och.unmanned.passenger.ui.aiview.AiView
android:id="@+id/aiView"
@@ -83,17 +146,19 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/naviInfoView"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toBottomOf="@id/leftContainer"
app:layout_constraintEnd_toEndOf="@id/midContainer"
app:layout_constraintStart_toStartOf="@id/leftContainer"
app:layout_constraintTop_toTopOf="@id/leftContainer">
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.appcompat.widget.AppCompatButton
android:elevation="6dp"
android:id="@+id/acbtn_show_hdmap"
android:text="展示高精"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<androidx.appcompat.widget.AppCompatButton
app:layout_constraintTop_toBottomOf="@+id/acbtn_show_hdmap"
android:id="@+id/acbtn_show_all"
android:elevation="6dp"
android:text="都展示"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</merge>

View File

@@ -40,15 +40,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.unmanned.passenger.ui.speed.SpeedView
android:id="@+id/speedView"
android:layout_width="@dimen/dp_240"
android:layout_height="@dimen/dp_120"
android:layout_marginTop="@dimen/dp_110"
android:layout_marginStart="@dimen/dp_50"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<!-- 红绿灯 -->
<com.mogo.eagle.core.function.hmi.ui.widget.SingleTrafficLightView
android:id="@+id/traffic_light_view"
@@ -107,16 +98,6 @@
app:user="taxi_p" />
<com.mogo.och.unmanned.passenger.ui.bar.LeftBarView
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_width="wrap_content"
android:layout_height="wrap_content"/>
<!-- 路程信息 -->
<com.mogo.och.unmanned.passenger.ui.orderinfo.ItineraryView
android:id="@+id/itinerary"

View File

@@ -2,47 +2,35 @@
<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_240"
android:layout_height="@dimen/dp_120"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<View
android:id="@+id/v_bottom_bg"
android:layout_width="@dimen/dp_240"
android:layout_height="@dimen/dp_120"
android:background="@drawable/taxi_u_p_speed_bg"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_speed_value"
app:layout_constraintHorizontal_chainStyle="packed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/taxi_p_203555"
android:textSize="@dimen/dp_78"
android:textColor="@color/taxi_p_303C52"
android:textSize="@dimen/dp_85"
android:layout_marginEnd="@dimen/dp_6"
android:fontFamily="@font/taxt_u_p_din"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@+id/actv_speed_unit"
app:layout_constraintEnd_toEndOf="parent"
tools:text="66"
android:text="--" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_speed_unit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/taxi_p_203555"
android:layout_marginStart="@dimen/dp_6"
android:textSize="@dimen/dp_32"
app:layout_constraintBaseline_toBaselineOf="@+id/actv_speed_value"
android:textColor="@color/taxi_p_303C52"
android:textSize="@dimen/dp_24"
android:fontFamily="@font/taxt_u_p_din"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@+id/actv_speed_value"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/actv_speed_value"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/actv_speed_value"
app:layout_constraintEnd_toEndOf="@+id/actv_speed_value"
android:text="KM/H" />
</merge>