[charter]

[3.2.0]
[debugview]
This commit is contained in:
yangyakun
2023-05-10 11:29:18 +08:00
parent 0d6ec28599
commit 630f2b76e4
10 changed files with 230 additions and 84 deletions

View File

@@ -5,8 +5,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import com.amap.api.maps.model.LatLng
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.mvp.MvpFragment
@@ -17,10 +15,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
import com.mogo.eagle.core.function.view.SiteMarkerBean
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.mogo.eagle.core.utilcode.util.ClickUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.map.uicontroller.VisualAngleMode
@@ -29,17 +24,16 @@ import com.mogo.och.bus.passenger.bean.event.DebugView
import com.mogo.och.bus.passenger.bean.event.EventLineSites
import com.mogo.och.bus.passenger.model.CharterPassengerModel
import com.mogo.och.bus.passenger.presenter.BusPassengerPresenter
import com.mogo.och.bus.passenger.ui.dialogfragment.DebugViewWatchDogFragment
import com.mogo.och.bus.passenger.ui.dialogfragment.M1CarUserNoOrderFragment
import com.mogo.och.bus.passenger.ui.dialogfragment.M1ContainFragment
import com.mogo.och.bus.passenger.view.statusbar.StatusBarView
import com.mogo.och.common.module.biz.constant.LoginStatusManager
import com.mogo.och.common.module.voice.VoiceManager
import kotlinx.android.synthetic.main.m1_main_fragment.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import java.lang.ref.WeakReference
import java.util.*
/**
* @author: wangmingjun
@@ -49,6 +43,7 @@ class MainFragment :
MvpFragment<MainFragment?, BusPassengerPresenter?>() {
private var bpFunctionGroupDialogFragment: WeakReference<M1ContainFragment>? = null
private var debugViewWatchDogFragment: WeakReference<DebugViewWatchDogFragment>? = null
private var m1CarUserNoOrderFragment: WeakReference<M1CarUserNoOrderFragment>? = null
private val endStation =
@@ -134,42 +129,19 @@ class MainFragment :
}
private fun openSettingPage(tab: String) {
val fragmentByTag: Fragment? = childFragmentManager.findFragmentByTag(M1ContainFragment.TAG)
if (fragmentByTag is DialogFragment) {
if (fragmentByTag.dialog != null && fragmentByTag.dialog!!.isShowing) {
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "正在展示")
return
}
if (fragmentByTag.dialog != null && fragmentByTag.isAdded) {
if (AppStateManager.currentActivity() == null) { // 没有在当前应用内 在启动页面关闭应用
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "权限验证")
return
}
}
}
if (bpFunctionGroupDialogFragment?.get() == null) {
bpFunctionGroupDialogFragment = WeakReference(M1ContainFragment.newInstance())
}
val bpFunctionGroup = bpFunctionGroupDialogFragment?.get()
bpFunctionGroup?.arguments?.putString(M1ContainFragment.SELECTTAB, tab)
if (bpFunctionGroup != null) {
if (bpFunctionGroup.dialog != null && bpFunctionGroup.dialog!!.isShowing) {
return
}
if (bpFunctionGroup.isAdded) { //解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
parentFragmentManager.beginTransaction().remove(bpFunctionGroup)
.commitAllowingStateLoss()
}
if (ClickUtils.isFastClick()) {
bpFunctionGroup.show(parentFragmentManager, TAG)
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "展示$tab")
} else {
CallerLogger.d(
SceneConstant.M_BUS_P + TAG, "dialog 1s内执行一次"
)
}
M1ContainFragment.openSettingPage(childFragmentManager,parentFragmentManager,bpFunctionGroup,tab)
}
private fun showDebugView() {
if (debugViewWatchDogFragment?.get() == null) {
debugViewWatchDogFragment = WeakReference(DebugViewWatchDogFragment.newInstance())
}
val debugViewFragment = debugViewWatchDogFragment?.get()
DebugViewWatchDogFragment.showDebugView(childFragmentManager,parentFragmentManager,debugViewFragment)
}
@@ -245,42 +217,11 @@ class MainFragment :
fun showOpenAndCloseDoor() {
val bpFunctionGroup = bpFunctionGroupDialogFragment?.get()
bpFunctionGroup?.dismissAllowingStateLoss()
val fragmentByTag: Fragment? = childFragmentManager.findFragmentByTag(M1ContainFragment.TAG)
if (fragmentByTag is DialogFragment) {
if (fragmentByTag.dialog != null && fragmentByTag.dialog!!.isShowing) {
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "正在展示")
return
}
if (fragmentByTag.dialog != null && fragmentByTag.isAdded) {
if (AppStateManager.currentActivity() == null) { // 没有在当前应用内 在启动页面关闭应用
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "权限验证")
return
}
}
}
if (m1CarUserNoOrderFragment?.get() == null) {
m1CarUserNoOrderFragment = WeakReference(M1CarUserNoOrderFragment.newInstance())
}
val m1CarUserNoOrderFragment = m1CarUserNoOrderFragment?.get()
if (m1CarUserNoOrderFragment != null) {
if (m1CarUserNoOrderFragment.dialog != null && m1CarUserNoOrderFragment.dialog!!.isShowing) {
return
}
if (m1CarUserNoOrderFragment.isAdded) { //解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
parentFragmentManager.beginTransaction().remove(m1CarUserNoOrderFragment)
.commitAllowingStateLoss()
}
if (ClickUtils.isFastClick()) {
m1CarUserNoOrderFragment.show(parentFragmentManager, TAG)
VoiceManager.endOrder()
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "展示开关门")
} else {
CallerLogger.d(
SceneConstant.M_BUS_P + TAG, "dialog 1s内执行一次"
)
}
}
M1CarUserNoOrderFragment.showOpenAndCloseDoor(childFragmentManager,parentFragmentManager,m1CarUserNoOrderFragment)
}
fun closeOpenAndCloseDoor(){
val bpFunctionGroup = m1CarUserNoOrderFragment?.get()
@@ -324,7 +265,11 @@ class MainFragment :
}
}
else -> {
ToggleDebugView.toggleDebugView.toggle(requireContext())
if (ToggleDebugView.toggleDebugView.isShowIng()) {
ToggleDebugView.toggleDebugView.dismiss()
}else {
showDebugView()
}
}
}

View File

@@ -1,22 +1,26 @@
package com.mogo.och.bus.passenger.ui.dialogfragment
import android.content.DialogInterface
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.WindowManager
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.mogo.commons.mvp.MvpDialogFragment
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.ClickUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.presenter.BusPassengerCarUseAndNoOrderPresenter
import com.mogo.och.bus.passenger.presenter.DebugWatchDogPresenter
import com.mogo.och.common.module.manager.devicemanage.LightAirconditionDoorManager
import kotlinx.android.synthetic.main.m1_order_end.*
import com.mogo.och.bus.passenger.ui.MainFragment
import kotlinx.android.synthetic.main.m1_debugview_pass.*
/**
* @author: yangyakun
@@ -31,19 +35,34 @@ class DebugViewWatchDogFragment :
setStyle(STYLE_NO_TITLE, R.style.DialogFullScreen) //dialog全屏
}
private fun initFragment() {
}
override fun getLayoutId(): Int = R.layout.m1_debugview_pass
override fun getTagName(): String = TAG
override fun initViews() {
dialog?.setCancelable(false)
actv_password_submit.setOnClickListener {
val text = acet_close.text
if(text==null||text.isEmpty()){
ToastUtils.showShort("请输入密码")
}else{
if(text.toString() == "123987"){
dismissAllowingStateLoss()
ToggleDebugView.toggleDebugView.toggle(requireContext())
}else{
ToastUtils.showShort("请输入正确密码")
}
}
}
actv_cancle.setOnClickListener {
dismissAllowingStateLoss()
}
}
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
acet_close.text?.clear()
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
@@ -111,6 +130,41 @@ class DebugViewWatchDogFragment :
fragment.arguments = args
return fragment
}
fun showDebugView(
childFragmentManager: FragmentManager,
parentFragmentManager: FragmentManager,
debugViewWatchDogFragment: DebugViewWatchDogFragment?
) {
val fragmentByTag: Fragment? = childFragmentManager.findFragmentByTag(M1ContainFragment.TAG)
if (fragmentByTag is DialogFragment) {
if (fragmentByTag.dialog != null && fragmentByTag.dialog!!.isShowing) {
CallerLogger.d(M_BUS_P + MainFragment.TAG, "正在展示")
return
}
if (fragmentByTag.dialog != null && fragmentByTag.isAdded) {
if (AppStateManager.currentActivity() == null) { // 没有在当前应用内 在启动页面关闭应用
CallerLogger.d(M_BUS_P + MainFragment.TAG, "权限验证")
return
}
}
}
if (debugViewWatchDogFragment != null) {
if (debugViewWatchDogFragment.dialog != null && debugViewWatchDogFragment.dialog!!.isShowing) {
return
}
if (debugViewWatchDogFragment.isAdded) { //解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
parentFragmentManager.beginTransaction().remove(debugViewWatchDogFragment)
.commitAllowingStateLoss()
}
if (ClickUtils.isFastClick()) {
debugViewWatchDogFragment.show(parentFragmentManager, MainFragment.TAG)
CallerLogger.d(M_BUS_P + MainFragment.TAG, "展示开关门")
} else {
CallerLogger.d(M_BUS_P + MainFragment.TAG, "dialog 1s内执行一次")
}
}
}
}
}

View File

@@ -5,16 +5,22 @@ import android.util.Log
import android.view.View
import android.view.WindowManager
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.mogo.commons.mvp.MvpDialogFragment
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.eagle.core.utilcode.util.AppStateManager
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.ClickUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.presenter.BusPassengerCarUseAndNoOrderPresenter
import com.mogo.och.bus.passenger.ui.MainFragment
import com.mogo.och.common.module.manager.devicemanage.LightAirconditionDoorManager
import com.mogo.och.common.module.voice.VoiceManager
import kotlinx.android.synthetic.main.m1_order_end.*
/**
@@ -115,6 +121,44 @@ class M1CarUserNoOrderFragment :
fragment.arguments = args
return fragment
}
fun showOpenAndCloseDoor(
childFragmentManager: FragmentManager,
parentFragmentManager: FragmentManager,
m1CarUserNoOrderFragment: M1CarUserNoOrderFragment?
) {
val fragmentByTag: Fragment? = childFragmentManager.findFragmentByTag(M1ContainFragment.TAG)
if (fragmentByTag is DialogFragment) {
if (fragmentByTag.dialog != null && fragmentByTag.dialog!!.isShowing) {
CallerLogger.d(SceneConstant.M_BUS_P + MainFragment.TAG, "正在展示")
return
}
if (fragmentByTag.dialog != null && fragmentByTag.isAdded) {
if (AppStateManager.currentActivity() == null) { // 没有在当前应用内 在启动页面关闭应用
CallerLogger.d(SceneConstant.M_BUS_P + MainFragment.TAG, "权限验证")
return
}
}
}
if (m1CarUserNoOrderFragment != null) {
if (m1CarUserNoOrderFragment.dialog != null && m1CarUserNoOrderFragment.dialog!!.isShowing) {
return
}
if (m1CarUserNoOrderFragment.isAdded) { //解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
parentFragmentManager.beginTransaction().remove(m1CarUserNoOrderFragment)
.commitAllowingStateLoss()
}
if (ClickUtils.isFastClick()) {
m1CarUserNoOrderFragment.show(parentFragmentManager, MainFragment.TAG)
VoiceManager.endOrder()
CallerLogger.d(M_BUS_P + MainFragment.TAG, "展示开关门")
} else {
CallerLogger.d(M_BUS_P + MainFragment.TAG, "dialog 1s内执行一次")
}
}
}
}
}

View File

@@ -12,12 +12,11 @@ import androidx.fragment.app.FragmentTransaction
import com.mogo.commons.mvp.MvpDialogFragment
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.SharedPrefs
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.*
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.event.EventLineSites
import com.mogo.och.bus.passenger.presenter.BusPassengerFunctionPresenter
import com.mogo.och.bus.passenger.ui.MainFragment
import com.mogo.och.bus.passenger.ui.dialogfragment.fragment.M1OrderLineFragment
import com.mogo.och.bus.passenger.ui.dialogfragment.fragment.M1SoftFragment
import com.mogo.och.bus.passenger.ui.dialogfragment.fragment.M1VideoFragment
@@ -257,6 +256,45 @@ class M1ContainFragment :
fragment.arguments = args
return fragment
}
fun openSettingPage(
childFragmentManager: FragmentManager,
parentFragmentManager: FragmentManager,
bpFunctionGroup: M1ContainFragment?,
tab: String
) {
val fragmentByTag: Fragment? = childFragmentManager.findFragmentByTag(M1ContainFragment.TAG)
if (fragmentByTag is DialogFragment) {
if (fragmentByTag.dialog != null && fragmentByTag.dialog!!.isShowing) {
CallerLogger.d(M_BUS_P + MainFragment.TAG, "正在展示")
return
}
if (fragmentByTag.dialog != null && fragmentByTag.isAdded) {
if (AppStateManager.currentActivity() == null) { // 没有在当前应用内 在启动页面关闭应用
CallerLogger.d(M_BUS_P + MainFragment.TAG, "权限验证")
return
}
}
}
bpFunctionGroup?.arguments?.putString(SELECTTAB, tab)
if (bpFunctionGroup != null) {
if (bpFunctionGroup.dialog != null && bpFunctionGroup.dialog!!.isShowing) {
return
}
if (bpFunctionGroup.isAdded) {
//解决方法就是添加这行代码如果已经添加了就移除掉然后再show就不会出现Fragment already added的错误了。
parentFragmentManager.beginTransaction().remove(bpFunctionGroup)
.commitAllowingStateLoss()
}
if (ClickUtils.isFastClick()) {
bpFunctionGroup.show(parentFragmentManager, MainFragment.TAG)
CallerLogger.d(M_BUS_P + MainFragment.TAG, "展示$tab")
} else {
CallerLogger.d(M_BUS_P + MainFragment.TAG, "dialog 1s内执行一次")
}
}
}
}
interface ContainDismiss{

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_16"/>
<solid android:color="@color/bus_p_m1_b8c2d7"/>
</shape>

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_22"/>
<solid android:color="@color/bus_p_m1_b8c2d8"/>
</shape>

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_16"/>
<solid android:color="@color/bus_p_m1_1466FB"/>
</shape>

View File

@@ -27,5 +27,46 @@
android:clickable="true">
<!-- 结束包车 后展示的界面 根据车辆状态来显示 -->
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/acet_close"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:inputType="numberPassword"
android:gravity="center"
android:textSize="@dimen/dp_32"
android:textColor="@android:color/white"
android:background="@drawable/charter_p_debugview_edit_bg"
android:layout_marginTop="@dimen/dp_54"
android:layout_width="@dimen/dp_424"
android:layout_height="@dimen/dp_84"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_cancle"
android:text="关闭"
app:layout_constraintTop_toBottomOf="@+id/acet_close"
app:layout_constraintStart_toStartOf="@+id/acet_close"
android:gravity="center"
android:textSize="@dimen/dp_32"
android:textColor="@android:color/white"
android:layout_marginTop="@dimen/dp_51"
android:background="@drawable/charter_p_debugview_cancle"
android:layout_width="@dimen/dp_180"
android:layout_height="@dimen/dp_68"/>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/actv_password_submit"
android:text="确认"
app:layout_constraintTop_toBottomOf="@+id/acet_close"
app:layout_constraintEnd_toEndOf="@+id/acet_close"
android:gravity="center"
android:layout_marginTop="@dimen/dp_51"
android:textSize="@dimen/dp_32"
android:textColor="@android:color/white"
android:background="@drawable/charter_p_debugview_submit"
android:layout_width="@dimen/dp_180"
android:layout_height="@dimen/dp_68"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -31,6 +31,8 @@
<color name="bus_p_m1_090f28">#090F28</color>
<color name="bus_p_m1_5F7096">#5F7096</color>
<color name="bus_p_m1_9aabd2">#9AABD2</color>
<color name="bus_p_m1_b8c2d7">#B8C2D7</color>
<color name="bus_p_m1_b8c2d8">#B8C2D8</color>
<color name="bus_p_m1_d7e5f5">#D7E5F5</color>
<color name="bus_p_m1_e0efff">#E0EFFF</color>
<color name="bus_p_m1_662C2D31">#662C2D31</color>

View File

@@ -28,6 +28,10 @@ class ToggleDebugView private constructor() : IMoGoAutopilotStatusListener {
private var mDebugSettingViewFloat: WarningFloat.Builder? = null
private var mDebugSettingView: DebugSettingView? = null
fun isShowIng():Boolean{
return mDebugSettingViewFloat != null
}
/**
* 开关DebugView
*/
@@ -85,7 +89,7 @@ class ToggleDebugView private constructor() : IMoGoAutopilotStatusListener {
}
}
private fun dismiss() {
fun dismiss() {
mDebugSettingViewFloat?.let {
WarningFloat.dismiss(it.config.floatTag, false)
mDebugSettingViewFloat = null