diff --git a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java index 8e4970dc78..de819da7c8 100644 --- a/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java +++ b/OCH/taxi/driver/src/main/java/com/mogo/och/taxi/ui/BaseTaxiTabFragment.java @@ -36,6 +36,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView; import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView; import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView; import com.mogo.eagle.core.function.hmi.ui.setting.SeatPressureSettingView; +import com.mogo.eagle.core.function.hmi.ui.vehicle.TakeOverAutopilotView; import com.mogo.eagle.core.function.view.MapBizView; import com.mogo.eagle.core.function.smp.view.SmallMapView; import com.mogo.eagle.core.function.view.MapRoamView; @@ -90,6 +91,7 @@ public abstract class BaseTaxiTabFragment + tbAeb.isChecked = SPUtils.getInstance().getBoolean("aeb",false) + tbAeb.setOnCheckedChangeListener{ compoundButton, isChecked -> if(!compoundButton.isPressed){ return@setOnCheckedChangeListener } @@ -120,8 +169,8 @@ class TakeOverAutopilotView @JvmOverloads constructor( SPUtils.getInstance().put("aeb",isChecked) } //绕障开关 - tb_lane_change.isChecked = SPUtils.getInstance().getBoolean("lane_change",false) - tb_lane_change.setOnCheckedChangeListener{ compoundButton, isChecked -> + tbLaneChange.isChecked = SPUtils.getInstance().getBoolean("lane_change",false) + tbLaneChange.setOnCheckedChangeListener{ compoundButton, isChecked -> if(!compoundButton.isPressed){ return@setOnCheckedChangeListener } @@ -129,8 +178,8 @@ class TakeOverAutopilotView @JvmOverloads constructor( SPUtils.getInstance().put("lane_change",isChecked) } //停车让行开关 - tb_stop_yield.isChecked = SPUtils.getInstance().getBoolean("stop_yield",false) - tb_stop_yield.setOnCheckedChangeListener{ compoundButton, isChecked -> + tbStopYield.isChecked = SPUtils.getInstance().getBoolean("stop_yield",false) + tbStopYield.setOnCheckedChangeListener{ compoundButton, isChecked -> if(!compoundButton.isPressed){ return@setOnCheckedChangeListener } @@ -138,8 +187,8 @@ class TakeOverAutopilotView @JvmOverloads constructor( SPUtils.getInstance().put("stop_yield",isChecked) } //地图限速开关 - tb_map_speed.isChecked = SPUtils.getInstance().getBoolean("map_speed",false) - tb_map_speed.setOnCheckedChangeListener { compoundButton, isChecked -> + tbMapSpeed.isChecked = SPUtils.getInstance().getBoolean("map_speed",false) + tbMapSpeed.setOnCheckedChangeListener { compoundButton, isChecked -> if(!compoundButton.isPressed){ return@setOnCheckedChangeListener } @@ -147,14 +196,70 @@ class TakeOverAutopilotView @JvmOverloads constructor( SPUtils.getInstance().put("map_speed",isChecked) } //环岛模式 - tb_ramp.isChecked = SPUtils.getInstance().getBoolean("ramp",false) - tb_ramp.setOnCheckedChangeListener { compoundButton, isChecked -> + tbRamp.isChecked = SPUtils.getInstance().getBoolean("ramp",false) + tbRamp.setOnCheckedChangeListener { compoundButton, isChecked -> if(!compoundButton.isPressed){ return@setOnCheckedChangeListener } CallerAutoPilotControlManager.sendRampThetaValid(isChecked) SPUtils.getInstance().put("ramp",isChecked) } + + mWindowParams = WindowManager.LayoutParams() + mWindowManager = mActivity.windowManager + mWindowParams?.let { + it.format = PixelFormat.RGBA_8888 + it.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL + it.gravity = Gravity.START or Gravity.TOP + it.width = 700 + it.height = 900 + it.alpha = 1.0f + } + + } + + @SuppressLint("ClickableViewAccessibility") + override fun onTouch(v: View?, motionEvent: MotionEvent?): Boolean { + when (motionEvent?.action) { + MotionEvent.ACTION_DOWN -> { + // 获取相对View的坐标,即以此View左上角为原点 + mInViewX = motionEvent.x + mInViewY = motionEvent.y + // 获取相对屏幕的坐标,即以屏幕左上角为原点 + mInScreenX = motionEvent.rawX + mInScreenY = motionEvent.rawY + } + MotionEvent.ACTION_MOVE -> { + // 更新浮动窗口位置参数 + mInScreenX = motionEvent.rawX + mInScreenY = motionEvent.rawY + if(((mInScreenX - mInViewX)-mWindowParams!!.x).absoluteValue>150 || ((mInScreenY - mInViewY)-mWindowParams!!.y).absoluteValue>150){ + return true + } + mWindowParams!!.x = (mInScreenX - mInViewX).toInt() + mWindowParams!!.y = (mInScreenY - mInViewY).toInt() + // 手指移动的时候更新小悬浮窗的位置 + mWindowManager!!.updateViewLayout(mFloatLayout, mWindowParams) + } + } + return true + } + + fun showFloatWindow() { + if (mFloatLayout.parent == null) { + val metrics = DisplayMetrics() + // 默认固定位置,靠屏幕右边缘的中间 + mWindowManager!!.defaultDisplay.getMetrics(metrics) + mWindowParams!!.x = metrics.widthPixels + mWindowParams!!.y = metrics.heightPixels - BarUtils.getStatusBarHeight()-1140 + mWindowManager!!.addView(mFloatLayout, mWindowParams) + } + } + + fun hideFloatWindow() { + if (mFloatLayout.parent != null){ + mWindowManager!!.removeView(mFloatLayout) + } } } \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/remote_take_over_item_bg.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/remote_take_over_item_bg.xml new file mode 100644 index 0000000000..709e4ede62 --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/remote_take_over_item_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/remote_take_over_item_press_bg.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/remote_take_over_item_press_bg.xml new file mode 100644 index 0000000000..46f79035be --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/remote_take_over_item_press_bg.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_take_over_item.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_take_over_item.xml new file mode 100644 index 0000000000..5c06ad51dd --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/drawable/selector_take_over_item.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml index d9ab5f9bb6..76cce1dc94 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_exam_setting.xml @@ -52,14 +52,4 @@ android:layout_margin="@dimen/dp_20" /> - - - - \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_remote_take_over_autopilot.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_remote_take_over_autopilot.xml index 496654da77..87d43374c8 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_remote_take_over_autopilot.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_remote_take_over_autopilot.xml @@ -1,16 +1,17 @@