[3.2.0] 司机端增加魔方功能UI

This commit is contained in:
wangmingjun
2023-04-23 10:40:26 +08:00
parent bee5ce2222
commit 56eedeb144
16 changed files with 91 additions and 13 deletions

View File

@@ -19,19 +19,9 @@ class DriverMoFangFunctionManager private constructor() {
}
}
private var mContext: Context? = null
private val TAG = "DriverMoFangFunctionManager"
private var startPressTime: Long = 0 //开始按键时间
private var isPressEnd = false //按键是否结束
private var timerHorn: Timer? = null
private var timerAcc: Timer? = null
fun init(context: Context) {
mContext = context
}
/**
* 发送加速和减速复位的时候isSend为false其他都是trueacc就是具体的值
*/

View File

@@ -4,7 +4,10 @@ import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.och.common.module.R
import com.mogo.och.common.module.manager.DriverMoFangFunctionManager
import kotlinx.android.synthetic.main.driver_mofang_function_view.view.*
/**
* @author: wangmingjun
@@ -14,6 +17,26 @@ class DriverMoFangFunctionView @JvmOverloads constructor(
context: Context, attrs: AttributeSet? = null
) : ConstraintLayout(context, attrs) {
init {
// LayoutInflater.from(context).inflate(R.layout.driver_mofang_function_view)
LayoutInflater.from(context).inflate(R.layout.driver_mofang_function_view,null)
initView()
}
private fun initView() {
moderateIv.onClick {
DriverMoFangFunctionManager.driverMoFangFunctionManager.sendAcc(true,0.1)
}
brakeStopIv.onClick {
DriverMoFangFunctionManager.driverMoFangFunctionManager.sendAcc(true,0.2)
}
resetIv.onClick {
DriverMoFangFunctionManager.driverMoFangFunctionManager.reset()
}
whistleIv.onClick {
DriverMoFangFunctionManager.driverMoFangFunctionManager.sendOperatorSetHornByDriver()
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

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/brake_stop" android:state_pressed="true" />
<item android:drawable="@drawable/brake_stop" android:state_focused="true" />
<item android:drawable="@drawable/brake_stop_un" />
</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/moderate" android:state_pressed="true" />
<item android:drawable="@drawable/moderate" android:state_focused="true" />
<item android:drawable="@drawable/moderate_un" />
</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/reset_icon" android:state_pressed="true" />
<item android:drawable="@drawable/reset_icon" android:state_focused="true" />
<item android:drawable="@drawable/reset_un_icon" />
</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/whistle" android:state_pressed="true" />
<item android:drawable="@drawable/whistle" android:state_focused="true" />
<item android:drawable="@drawable/whistle_un" />
</selector>

View File

@@ -1,8 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="1012px"
android:layout_height="@dimen/dp_277"
android:background="@drawable/driver_mofang_function_bg">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/moderateIv"
android:layout_width="@dimen/dp_182"
android:layout_height="@dimen/dp_182"
android:layout_marginLeft="@dimen/dp_104"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/moderate_btn_selector"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/brakeStopIv"
android:layout_width="@dimen/dp_182"
android:layout_height="@dimen/dp_182"
android:layout_marginLeft="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@+id/moderateIv"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/brake_stop_btn_selector"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/resetIv"
android:layout_width="@dimen/dp_182"
android:layout_height="@dimen/dp_182"
android:layout_marginLeft="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@+id/brakeStopIv"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/reset_btn_selector"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/whistleIv"
android:layout_width="@dimen/dp_182"
android:layout_height="@dimen/dp_182"
android:layout_marginLeft="@dimen/dp_24"
app:layout_constraintLeft_toRightOf="@+id/resetIv"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/whistle_btn_selector"/>
</androidx.constraintlayout.widget.ConstraintLayout>