[8.0.0]
[fea] [声音和亮度管理、地图变更]
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
package com.mogo.och.unmanned.passenger.ui.rootview
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.CheckBox
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.unmanned.taxi.passenger.R
|
||||
|
||||
class RootViewConstrainLayout : ConstraintLayout {
|
||||
|
||||
private val TAG = "LockView"
|
||||
|
||||
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 light_setting: View?=null
|
||||
private var voice_setting:View?=null
|
||||
private var cb_setting_light: CheckBox?=null
|
||||
private var cb_setting_voice:CheckBox?=null
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
light_setting = findViewById(R.id.light_setting)
|
||||
voice_setting = findViewById(R.id.voice_setting)
|
||||
|
||||
cb_setting_light = findViewById(R.id.cb_setting_light)
|
||||
cb_setting_voice = findViewById(R.id.cb_setting_voice)
|
||||
super.onAttachedToWindow()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
cb_setting_light = null
|
||||
cb_setting_voice = null
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
override fun onInterceptTouchEvent(event: MotionEvent?): Boolean {
|
||||
|
||||
event?.let {
|
||||
if (it.action==MotionEvent.ACTION_DOWN) {
|
||||
val needInterceptLight = needIntercept(it, light_setting)//
|
||||
|
||||
if(needInterceptLight){
|
||||
if(cb_setting_light?.isChecked==true){
|
||||
cb_setting_light?.isChecked = false
|
||||
}
|
||||
}
|
||||
|
||||
val needInterceptVoice = needIntercept(it, voice_setting)//
|
||||
if(needInterceptVoice){
|
||||
if(cb_setting_voice?.isChecked==true){
|
||||
cb_setting_voice?.isChecked = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CallerLogger.d("LockViewConstrainLayout", "是否拦截")
|
||||
return super.onInterceptTouchEvent(event)
|
||||
}
|
||||
|
||||
private fun needIntercept(event: MotionEvent,view: View?):Boolean {
|
||||
view?.apply {
|
||||
val location = IntArray(2)
|
||||
getLocationInWindow(location)
|
||||
CallerLogger.d(
|
||||
"LockViewConstrainLayout",
|
||||
"${location[0]}---${location[1]}--${location[0] + width}---${location[1] + height}---${event.rawX}----${event.rawY}"
|
||||
)
|
||||
val mleft = location[0]
|
||||
val mtop = location[1]
|
||||
val mright = location[0] + width
|
||||
val mbottom = location[1] + height
|
||||
if (event.rawX > mleft && event.rawX < mright && event.rawY > mtop && event.rawY < mbottom) {
|
||||
CallerLogger.d("LockViewConstrainLayout", "不拦截")
|
||||
// 不拦截
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -37,13 +37,7 @@ class LightSetting @JvmOverloads constructor(
|
||||
|
||||
override fun initLightAndVoice(){
|
||||
val percentaget = BrightnessUtils.getBrightness().toFloat() / 255
|
||||
val currentLight = percentaget * maxHeightValue
|
||||
ObjectAnimator.ofFloat(
|
||||
draggableButton, "translationY", draggableButton.translationY,
|
||||
currentLight
|
||||
).apply {
|
||||
duration = 500
|
||||
}.start()
|
||||
setHeightBar(percentaget)
|
||||
setTextValue(NumberFormatUtil.percentage(percentaget,0))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.och.unmanned.passenger.ui.setting
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
@@ -129,6 +130,16 @@ open class VerticalSeekBar @JvmOverloads constructor(
|
||||
tv_current_value.text = value
|
||||
}
|
||||
|
||||
fun setHeightBar(percentaget:Float){
|
||||
val currentLight = percentaget * maxHeightValue
|
||||
ObjectAnimator.ofFloat(
|
||||
draggableButton, "translationY", draggableButton.translationY,
|
||||
currentLight
|
||||
).apply {
|
||||
duration = 500
|
||||
}.start()
|
||||
}
|
||||
|
||||
override fun onWindowVisibilityChanged(visibility: Int) {
|
||||
super.onWindowVisibilityChanged(visibility)
|
||||
if (visibility == View.VISIBLE) {
|
||||
|
||||
@@ -26,7 +26,7 @@ class VoiceSetting @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : VerticalSeekBar(context, attrs, defStyleAttr), IMogoIntentListener {
|
||||
) : VerticalSeekBar(context, attrs, defStyleAttr) {
|
||||
|
||||
private val TAG = "VoiceSetting"
|
||||
|
||||
@@ -81,18 +81,4 @@ class VoiceSetting @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onIntentReceived(intentStr: String?, intent: Intent?) {
|
||||
// if (TextUtils.equals(ACTION_VOLUME_CHANGE, intentStr)) {
|
||||
// if (intent!!.getIntExtra(
|
||||
// MogoReceiver.EXTRA_VOLUME_STREAM_TYPE, -1
|
||||
// ) == AudioManager.STREAM_MUSIC
|
||||
// ) {
|
||||
// CallerLogger.d(TAG,"收到信息变更")
|
||||
// ThreadUtils.runOnUiThread {
|
||||
// initLightAndVoice()
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,11 +15,9 @@
|
||||
app:carDrawable="@drawable/taxt_u_p_map_car"
|
||||
app:compassDrawable="@drawable/taxt_u_p_map_car_light"
|
||||
app:endPointDrawable="@drawable/taxi_p_station_end"
|
||||
app:leftPadding="800"
|
||||
app:mapStyleExtraPath="style_extra.data"
|
||||
app:mapStylePath="style.data"
|
||||
app:resetDrawable="@null"
|
||||
app:rightPadding="580"
|
||||
app:startPointDrawable="@drawable/taxt_u_p_map_view_dir_start"
|
||||
app:topPadding="210"
|
||||
app:isOrderEnd="true"
|
||||
@@ -27,14 +25,13 @@
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/ovbv_bottom_icons"
|
||||
android:paddingStart="@dimen/dp_60"
|
||||
android:paddingEnd="@dimen/dp_60"
|
||||
android:paddingTop="@dimen/dp_4"
|
||||
android:paddingBottom="@dimen/dp_4"
|
||||
android:layout_width="@dimen/dp_690"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginEnd="@dimen/dp_46"
|
||||
android:layout_marginBottom="@dimen/dp_198"/>
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.mogo.och.unmanned.passenger.ui.rootview.RootViewConstrainLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/taxi_p_all_bg"
|
||||
android:layout_width="match_parent"
|
||||
@@ -303,4 +303,4 @@
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</com.mogo.och.unmanned.passenger.ui.rootview.RootViewConstrainLayout>
|
||||
Reference in New Issue
Block a user