[3.2.0]调整漫游UI

This commit is contained in:
xuxinchao
2023-05-18 18:33:36 +08:00
parent 21bda05fc8
commit dc29c847eb
5 changed files with 71 additions and 29 deletions

View File

@@ -3,6 +3,7 @@ package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.appcompat.content.res.AppCompatResources
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.api.map.roma.IMoGoRomaListener
import com.mogo.eagle.core.function.call.map.CallerMapIdentifyManager.romaTrigger
@@ -26,8 +27,30 @@ class RomaView @JvmOverloads constructor(
@Volatile
private var click = true
private val normalRes: Int
private val openRes: Int
init {
LayoutInflater.from(context).inflate(R.layout.view_roma_bg, this, true)
val a = context.obtainStyledAttributes(
attrs,
R.styleable.RomaView,
defStyleAttr,
0
)
normalRes = a.getResourceId(
R.styleable.RomaView_roma_close_bg,
R.drawable.romabg_normal_select
)
openRes = a.getResourceId(
R.styleable.RomaView_roma_open_bg,
R.drawable.romabg_press_select_bg
)
a.recycle()
if(normalRes!=0){
ll_roma_bg.background = AppCompatResources.getDrawable(context, normalRes)
}
setOnClickListener {
if(!click){
return@setOnClickListener
@@ -44,11 +67,19 @@ class RomaView @JvmOverloads constructor(
click = true
if (status) {
romaMode = true
ll_roma_bg.setBackgroundResource(R.drawable.romabg_press_select_bg)
if(openRes!=0){
ll_roma_bg.setBackgroundResource(openRes)
}else{
ll_roma_bg.setBackgroundResource(R.drawable.romabg_press_select_bg)
}
ivRomaView.setBackgroundResource(R.drawable.roma_press_select_bg)
} else {
romaMode = false
ll_roma_bg.setBackgroundResource(R.drawable.roma_bg_selector)
if(normalRes!=0){
ll_roma_bg.setBackgroundResource(normalRes)
}else{
ll_roma_bg.setBackgroundResource(R.drawable.roma_bg_selector)
}
ivRomaView.setBackgroundResource(R.drawable.romafront_select_bg)
}
}

View File

@@ -1,28 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ll_roma_bg"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@drawable/roma_bg_selector"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:id="@+id/ll_roma_bg"
android:layout_width="@dimen/dp_102"
android:layout_height="@dimen/dp_102"
android:layout_marginStart="40dp"
android:layout_marginBottom="@dimen/dp_46"
android:background="@drawable/roma_bg_selector"
android:elevation="@dimen/dp_10"
android:gravity="center"
android:orientation="vertical"
<ImageView
android:id="@+id/ivRomaView"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_gravity="center"
android:background="@drawable/romafront_select_bg"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
app:layout_constraintRight_toRightOf="parent"
/>
<ImageView
android:id="@+id/ivRomaView"
android:layout_width="@dimen/dp_80"
android:layout_height="@dimen/dp_80"
android:layout_gravity="center"
android:background="@drawable/romafront_select_bg" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -88,4 +88,10 @@
<attr name="roma_open" format="reference"/>
<attr name="roma_close" format="reference"/>
</declare-styleable>
<declare-styleable name="RomaView">
<attr name="roma_open_bg" format="reference"/>
<attr name="roma_close_bg" format="reference"/>
</declare-styleable>
</resources>