From 67ead188c2fd0ebe3bb7c0206a1d2bcc1a42f2ca Mon Sep 17 00:00:00 2001 From: yangyakun Date: Thu, 24 Apr 2025 16:08:55 +0800 Subject: [PATCH] =?UTF-8?q?[8.0.0]=20[fea]=20[=E5=A3=B0=E9=9F=B3=E5=92=8C?= =?UTF-8?q?=E4=BA=AE=E5=BA=A6=E7=AE=A1=E7=90=86=E3=80=81=E5=9C=B0=E5=9B=BE?= =?UTF-8?q?=E5=8F=98=E6=9B=B4]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/rootview/RootViewConstrainLayout.kt | 94 +++++++++++++++++++ .../passenger/ui/setting/LightSetting.kt | 8 +- .../passenger/ui/setting/VerticalSeekBar.kt | 11 +++ .../passenger/ui/setting/VoiceSetting.kt | 16 +--- .../src/main/res/layout/taxi_p_overmap.xml | 9 +- .../res/layout/taxt_u_p_base_fragment.xml | 4 +- 6 files changed, 112 insertions(+), 30 deletions(-) create mode 100644 OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/rootview/RootViewConstrainLayout.kt diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/rootview/RootViewConstrainLayout.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/rootview/RootViewConstrainLayout.kt new file mode 100644 index 0000000000..eaa14c13c7 --- /dev/null +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/rootview/RootViewConstrainLayout.kt @@ -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 + } + + + +} \ No newline at end of file diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/LightSetting.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/LightSetting.kt index 78d8da0587..9942b1de1f 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/LightSetting.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/LightSetting.kt @@ -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)) } diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VerticalSeekBar.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VerticalSeekBar.kt index 0105325215..eaa8246fbe 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VerticalSeekBar.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VerticalSeekBar.kt @@ -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) { diff --git a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VoiceSetting.kt b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VoiceSetting.kt index 1677e0458f..434bd461b2 100644 --- a/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VoiceSetting.kt +++ b/OCH/taxi/unmanned-passenger/src/main/java/com/mogo/och/unmanned/passenger/ui/setting/VoiceSetting.kt @@ -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() -// } -// } -// } - } - } \ No newline at end of file diff --git a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_overmap.xml b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_overmap.xml index 96017b653f..e9d36ed565 100644 --- a/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_overmap.xml +++ b/OCH/taxi/unmanned-passenger/src/main/res/layout/taxi_p_overmap.xml @@ -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 @@ - - \ No newline at end of file + \ No newline at end of file