[m1 1.0.0]

[车辆控制灯光控制]
This commit is contained in:
yangyakun
2023-01-31 19:43:25 +08:00
parent 94c6f2696c
commit 9d599bfe1b
37 changed files with 371 additions and 22 deletions

View File

@@ -1,9 +1,11 @@
package com.mogo.och.bus.passenger.ui
import android.os.Bundle
import android.view.View
import com.mogo.commons.mvp.MvpFragment
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionSoftPresenter
import kotlinx.android.synthetic.m1.bus_p_function_setting_soft_fragment.*
/**
* @author: yangyakun
@@ -17,7 +19,56 @@ class BusPassengerFunctionSoftFragment :
override fun getTagName(): String = TAG
override fun initViews() {
rg_select_function.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) {
R.id.tv_setting_aircondition -> {
g_aircondition_setting.visibility = View.VISIBLE
g_light_setting.visibility = View.GONE
g_voice_setting.visibility = View.GONE
}
R.id.tv_setting_lighting -> {
g_light_setting.visibility = View.VISIBLE
g_voice_setting.visibility = View.GONE
g_aircondition_setting.visibility = View.GONE
}
R.id.tv_setting_voice -> {
g_voice_setting.visibility = View.VISIBLE
g_aircondition_setting.visibility = View.GONE
g_light_setting.visibility = View.GONE
}
else -> {}
}
}
rg_select_function.check(R.id.tv_setting_aircondition)
tv_light_top_01.setOnCheckedChangeListener { buttonView, isChecked ->
setLightImage(isChecked,tv_light_top_02.isChecked,tv_light_atmosphere.isChecked)
}
tv_light_top_02.setOnCheckedChangeListener { buttonView, isChecked ->
setLightImage(tv_light_top_01.isChecked,isChecked,tv_light_atmosphere.isChecked)
}
tv_light_atmosphere.setOnCheckedChangeListener { buttonView, isChecked ->
setLightImage(tv_light_top_01.isChecked,tv_light_top_02.isChecked,isChecked)
}
}
private fun setLightImage(leftLight:Boolean, rightLight:Boolean, atmosphereLight:Boolean){
if(leftLight&&rightLight){
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_middle_selected)// 都打开
}else if(!leftLight&&!rightLight){
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_nor)// 都关闭
}else {
if(leftLight){
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_select_left)// 左面开
}
if(rightLight){
iv_top_light_setting.setImageResource(R.drawable.bus_p_function_light_select_right)// 左面开
}
}
if(atmosphereLight){
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_select)
}else{
iv_bottom_light_setting.setImageResource(R.drawable.bus_p_function_atmosphere_nor)
}
}
override fun createPresenter(): BusPassengerFunctionSoftPresenter =

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 258 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 760 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 517 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_aircondition_select" android:gravity="center"
android:left="@dimen/dp_28"
android:top="@dimen/dp_2"
android:width="@dimen/dp_19"
android:height="@dimen/dp_14"/>
</layer-list >

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_aircondition_selected"
android:left="@dimen/dp_28"
android:top="@dimen/dp_2"
android:width="@dimen/dp_19"
android:height="@dimen/dp_14"/>
</layer-list >

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_p_function_left_bg_selected" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_left_bg_select" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_left_bg_select"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_p_function_aircondition_left_selected" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_aircondition_left_select" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_aircondition_left_select"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@android:color/white" android:state_checked="true"/>
<item android:color="#374968" android:state_checked="false"/>
<item android:color="#374968" />
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@android:color/transparent"/>
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_light_select" android:gravity="center"
android:left="@dimen/dp_27"
android:top="@dimen/dp_2"
android:width="@dimen/dp_23"
android:height="@dimen/dp_22"/>
</layer-list >

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_light_selected"
android:left="@dimen/dp_27"
android:top="@dimen/dp_2"
android:width="@dimen/dp_23"
android:height="@dimen/dp_22"/>
</layer-list >

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_p_function_light_left_selected" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_light_left_select" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_light_left_select"/>
</selector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_38"/>
<solid android:color="@android:color/white"/>
</shape>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_p_function_light_switch_bg_selected" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_light_switch_bg_select" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_light_switch_bg_select"/>
</selector>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="@dimen/dp_26"/>
<solid android:color="#B3EFF6FF"/>
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_light_check_select" android:gravity="center"
android:left="@dimen/dp_31"
android:top="@dimen/dp_2"
android:width="@dimen/dp_28"
android:height="@dimen/dp_28"/>
</layer-list >

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_light_check_selected"
android:left="@dimen/dp_31"
android:top="@dimen/dp_2"
android:width="@dimen/dp_28"
android:height="@dimen/dp_28"/>
</layer-list >

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_p_function_switch_left_selected" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_switch_left_select" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_switch_left_select"/>
</selector>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_voice_select" android:gravity="center"
android:left="@dimen/dp_31"
android:top="@dimen/dp_2"
android:width="@dimen/dp_17"
android:height="@dimen/dp_15"/>
</layer-list >

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/bus_p_function_voice_selected"
android:left="@dimen/dp_31"
android:top="@dimen/dp_2"
android:width="@dimen/dp_17"
android:height="@dimen/dp_15"/>
</layer-list >

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_p_function_voice_left_selected" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_voice_left_select" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_voice_left_select"/>
</selector>

View File

@@ -1,6 +1,7 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
@@ -14,33 +15,204 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintWidth_percent="0.78125">
<TextView
android:id="@+id/tv_setting_aircondition"
<!--region 调整空调、灯光、声音-->
<RadioGroup
android:id="@+id/rg_select_function"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="空调"
app:layout_constraintBottom_toTopOf="@+id/tv_setting_lighting"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/gl_left"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RadioButton
android:id="@+id/tv_setting_aircondition"
android:layout_width="@dimen/dp_160"
android:layout_height="50dp"
android:background="@drawable/bus_p_function_airconditon_bg_selector"
android:button="@null"
android:layout_marginBottom="@dimen/dp_26"
android:drawableLeft="@drawable/bus_p_function_airconditon_left_selector"
android:drawablePadding="-20dp"
android:gravity="center"
android:text="空 调"
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
android:textSize="@dimen/dp_24" />
<RadioButton
android:id="@+id/tv_setting_lighting"
android:layout_width="@dimen/dp_160"
android:layout_height="50dp"
android:background="@drawable/bus_p_function_airconditon_bg_selector"
android:button="@null"
android:layout_marginBottom="@dimen/dp_26"
android:drawableLeft="@drawable/bus_p_function_light_left_selector"
android:drawablePadding="-20dp"
android:gravity="center"
android:text="灯 光"
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
android:textSize="@dimen/dp_24" />
<RadioButton
android:id="@+id/tv_setting_voice"
android:layout_width="@dimen/dp_160"
android:layout_height="50dp"
android:background="@drawable/bus_p_function_airconditon_bg_selector"
android:button="@null"
android:drawableLeft="@drawable/bus_p_function_voice_left_selector"
android:drawablePadding="-20dp"
android:gravity="center"
android:text="声 音"
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
android:textSize="@dimen/dp_24" />
</RadioGroup>
<!--endregion-->
<!--region 空调调整-->
<ImageView
android:id="@+id/iv_aircondition"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitXY"
android:src="@drawable/bus_p_function_aircondition_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/gl_right"
app:layout_constraintStart_toStartOf="@+id/gl_left"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/g_aircondition_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="visible"
app:constraint_referenced_ids="iv_aircondition" />
<!--endregion-->
<!--region 灯光调整-->
<ImageView
android:id="@+id/iv_top_light_setting"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/bus_p_function_light_middle_selected"
app:layout_constraintEnd_toStartOf="@+id/gl_right"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintStart_toEndOf="@+id/gl_left"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/iv_bottom_light_setting"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="centerCrop"
android:src="@drawable/bus_p_function_atmosphere_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/gl_right"
app:layout_constraintHeight_percent="0.5"
app:layout_constraintStart_toEndOf="@+id/gl_left" />
<!--顶部灯01-->
<CheckBox
android:id="@+id/tv_light_top_01"
android:text="关闭顶灯1"
android:layout_width="@dimen/dp_220"
android:layout_height="@dimen/dp_76"
android:background="@drawable/bus_p_function_light_switch_bg_selector"
android:button="@null"
android:layout_marginBottom="@dimen/dp_17"
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
android:drawablePadding="-20dp"
android:gravity="center"
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
android:textSize="@dimen/dp_24"
app:layout_constraintBottom_toTopOf="@+id/tv_light_top_02"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/gl_right"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed" />
<TextView
android:id="@+id/tv_setting_lighting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="灯光"
app:layout_constraintBottom_toTopOf="@+id/tv_setting_voice"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_setting_aircondition" />
<TextView
android:id="@+id/tv_setting_voice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="声音"
<!--顶部灯02-->
<CheckBox
android:id="@+id/tv_light_top_02"
android:text="关闭顶灯2"
android:layout_width="@dimen/dp_220"
android:layout_height="@dimen/dp_76"
android:background="@drawable/bus_p_function_light_switch_bg_selector"
android:button="@null"
android:layout_marginBottom="@dimen/dp_17"
android:layout_marginTop="@dimen/dp_17"
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
android:drawablePadding="-20dp"
android:gravity="center"
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
android:textSize="@dimen/dp_24"
app:layout_constraintBottom_toTopOf="@+id/tv_light_atmosphere"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/gl_right"
app:layout_constraintTop_toBottomOf="@+id/tv_light_top_01" />
<!--氛围灯-->
<CheckBox
android:id="@+id/tv_light_atmosphere"
android:text="关闭氛围灯"
android:layout_width="@dimen/dp_220"
android:layout_height="@dimen/dp_76"
android:background="@drawable/bus_p_function_light_switch_bg_selector"
android:button="@null"
android:checked="true"
android:layout_marginTop="@dimen/dp_17"
android:drawableLeft="@drawable/bus_p_function_switch_left_selector"
android:drawablePadding="-20dp"
android:gravity="center"
android:textColor="@drawable/bus_p_function_airconditon_text_color_selector"
android:textSize="@dimen/dp_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_setting_lighting" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="@+id/gl_right"
app:layout_constraintTop_toBottomOf="@+id/tv_light_top_02" />
<androidx.constraintlayout.widget.Group
android:id="@+id/g_light_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="tv_light_top_01,tv_light_top_02,tv_light_atmosphere,iv_top_light_setting,iv_bottom_light_setting" />
<!--endregion-->
<!--region 空调调整-->
<ImageView
android:id="@+id/iv_voice"
android:layout_width="0dp"
android:layout_height="0dp"
android:scaleType="fitXY"
android:src="@drawable/bus_p_function_aircondition_nor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/gl_right"
app:layout_constraintStart_toStartOf="@+id/gl_left"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Group
android:id="@+id/g_voice_setting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:constraint_referenced_ids="iv_voice" />
<!--endregion-->
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.186" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/gl_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintGuide_percent="0.63" />
</androidx.constraintlayout.widget.ConstraintLayout>