[6.4.0]
[恢复代码]
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
package com.mogo.och.facade
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.och.charter.passenger.ui.MainFragment
|
||||
import com.mogo.och.charter.passenger.ui.overmapview.MakerWithSiteNamewithCheck
|
||||
import com.mogo.och.common.module.manager.autopilotmanager.OCHAdasAbilityManager
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class BusPassengerPresenter(view: MainFragment?) :
|
||||
Presenter<MainFragment?>(view) {
|
||||
|
||||
private val lindIdAndView = ConcurrentHashMap<Long, MakerWithSiteNamewithCheck?>()
|
||||
|
||||
companion object {
|
||||
private const val TAG = "BusPassengerPresenter"
|
||||
const val KEY4SHOWNOVICEGUIDANCE = "showNoviceGuidanceOrderNor"
|
||||
|
||||
}
|
||||
|
||||
init {
|
||||
OCHAdasAbilityManager.getInstance().init(AbsMogoApplication.getApp())
|
||||
}
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,359 +0,0 @@
|
||||
package com.mogo.och.facade
|
||||
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.function.api.hmi.view.IStatusViewLayout
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getMapUIController
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.MMsgBoxButtonView
|
||||
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.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.listener.MogoMapListenerHandler
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.mogo.och.charter.passenger.R
|
||||
import com.mogo.och.charter.passenger.bean.event.EventLineSites
|
||||
import com.mogo.och.charter.passenger.callback.IClearViewCallback
|
||||
import com.mogo.och.charter.passenger.presenter.BusPassengerPresenter
|
||||
import com.mogo.och.charter.passenger.ui.bottom.BottomBar
|
||||
import com.mogo.och.charter.passenger.ui.bottom.BottomClickView
|
||||
import com.mogo.och.charter.passenger.ui.dialogfragment.M1CarUserNoOrderFragment
|
||||
import com.mogo.och.charter.passenger.ui.dialogfragment.NoviceGuidanceFragment
|
||||
import com.mogo.och.charter.passenger.ui.lockview.LockManager
|
||||
import com.mogo.och.charter.passenger.ui.statusbar.StatusBarView
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.aciv_enter_video
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.aciv_map_2_default
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.bb_boorombar
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_orderinfo
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_selectline
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_softcontrol
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.biz_video
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.mapBizView
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.mcv_play_music
|
||||
import kotlinx.android.synthetic.main.charter_p_main_fragment.omvOverMap
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxBubble
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxButton
|
||||
//import kotlinx.android.synthetic.main.charter_p_main_fragment.viewBusPM1MsgBoxList
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/4/12
|
||||
*/
|
||||
class MainFragment : MvpFragment<MainFragment?, BusPassengerPresenter?>(), IMogoMapListener {
|
||||
|
||||
private var m1CarUserNoOrderFragment: WeakReference<M1CarUserNoOrderFragment>? = null
|
||||
private var noviceGuidanceFragment: WeakReference<NoviceGuidanceFragment>? = null
|
||||
|
||||
private val endStation =
|
||||
BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.charter_p_small_map_view_dir_end
|
||||
)
|
||||
private val lineTrajectory =
|
||||
BitmapFactory.decodeResource(
|
||||
AbsMogoApplication.getApp().resources,
|
||||
R.drawable.charter_p_trajectory_line
|
||||
)
|
||||
|
||||
private val goneView = object : IClearViewCallback {
|
||||
override fun goneAllView() {
|
||||
bb_boorombar.setCheckIndex(BottomBar.SelectView.NONE)
|
||||
}
|
||||
}
|
||||
|
||||
private var statusBarView: StatusBarView? = null
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
(ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_VIEW_MANAGER)
|
||||
.navigation() as? IStatusViewLayout)?.apply {
|
||||
val statusView = getStatusView(requireContext())
|
||||
if (statusView is StatusBarView) {
|
||||
statusBarView = statusView
|
||||
}
|
||||
}
|
||||
return R.layout.charter_p_main_fragment
|
||||
}
|
||||
|
||||
override fun getTagName(): String {
|
||||
return TAG
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
EventBus.getDefault().register(this)
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
omvOverMap.hideResetView()
|
||||
// viewBusPM1MsgBoxButton.setClickListener(object : MMsgBoxButtonView.ClickListener {
|
||||
// override fun showMsgBoxList(show: Boolean) {
|
||||
// if (show) {
|
||||
// viewBusPM1MsgBoxList.visibility = View.VISIBLE
|
||||
// viewBusPM1MsgBoxBubble.visibility = View.GONE
|
||||
// viewBusPM1MsgBoxBubble.isShowData(false)
|
||||
// } else {
|
||||
// viewBusPM1MsgBoxList.visibility = View.GONE
|
||||
// viewBusPM1MsgBoxBubble.visibility = View.VISIBLE
|
||||
// viewBusPM1MsgBoxBubble.isShowData(true)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// })
|
||||
|
||||
bb_boorombar.setCheckChangeListener(object : BottomBar.ApplyClickLintener {
|
||||
override fun onApplyClick(selectItem: BottomBar.SelectView): Boolean {
|
||||
when (selectItem) {
|
||||
BottomBar.SelectView.ORDERINFO -> {
|
||||
if (LoginStatusManager.isLogin()) {
|
||||
if (mPresenter?.haveOrder() == true) {
|
||||
|
||||
} else {
|
||||
ToastCharterUtils.showToastShort("请确认订单")
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
mPresenter?.querLogin()
|
||||
ToastCharterUtils.showToastShort(requireContext().getString(R.string.charter_p_please_login_driver))
|
||||
return true
|
||||
}
|
||||
showBizView(orderinfo = true)
|
||||
}
|
||||
BottomBar.SelectView.SETTING -> showBizView(softControl = true)
|
||||
BottomBar.SelectView.LINE -> showBizView(selectLine = true)
|
||||
BottomBar.SelectView.VIDEO -> showBizView(showVideo = true)
|
||||
BottomBar.SelectView.MUSIC -> showBizView(showMusic = true)
|
||||
else -> {
|
||||
showBizView()
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_80ffffff)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
})
|
||||
bb_boorombar.setApplyClickListener(object : BottomClickView.ApplyClickLintener {
|
||||
override fun onApplyClick() {
|
||||
bb_boorombar.setCheckIndex(BottomBar.SelectView.NONE)
|
||||
}
|
||||
})
|
||||
biz_orderinfo.goneViewListener = goneView
|
||||
biz_softcontrol.goneViewListener = goneView
|
||||
biz_selectline.goneViewListener = goneView
|
||||
biz_video.goneViewListener = goneView
|
||||
|
||||
aciv_enter_video.setOnClickListener {
|
||||
bb_boorombar.setCheckIndex(BottomBar.SelectView.VIDEO)
|
||||
}
|
||||
aciv_map_2_default.setOnClickListener {
|
||||
omvOverMap.displayCustomOverView()
|
||||
mapBizView.getUI()?.let {
|
||||
it.changeMapVisualAngle(it.getVrAngleDefaultMode(), null)
|
||||
}
|
||||
}
|
||||
MogoMapListenerHandler.mogoMapListenerHandler.registerHostMapListener(TAG, this)
|
||||
}
|
||||
|
||||
fun setCarMode(type: Int) {
|
||||
mPresenter?.setCarChangeListener(type)
|
||||
}
|
||||
|
||||
private fun showBizView(
|
||||
orderinfo: Boolean = false,
|
||||
softControl: Boolean = false,
|
||||
selectLine: Boolean = false,
|
||||
showVideo: Boolean = false,
|
||||
showMusic: Boolean = false
|
||||
) {
|
||||
if (orderinfo) {
|
||||
biz_orderinfo.visibility = View.VISIBLE
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_80ffffff)
|
||||
} else {
|
||||
biz_orderinfo.visibility = View.GONE
|
||||
}
|
||||
if (softControl) {
|
||||
biz_softcontrol.visibility = View.VISIBLE
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_40ffffff)
|
||||
} else {
|
||||
biz_softcontrol.visibility = View.GONE
|
||||
}
|
||||
if (selectLine) {
|
||||
biz_selectline.visibility = View.VISIBLE
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_80ffffff)
|
||||
} else {
|
||||
biz_selectline.visibility = View.GONE
|
||||
}
|
||||
if (showVideo) {
|
||||
biz_video.visibility = View.VISIBLE
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_40ffffff)
|
||||
} else {
|
||||
biz_video.visibility = View.GONE
|
||||
}
|
||||
if(showMusic) {
|
||||
mcv_play_music.visibility = View.VISIBLE
|
||||
statusBarView?.setBackgroudColor(R.color.charter_p_40ffffff)
|
||||
}else{
|
||||
mcv_play_music.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
fun setCarModel(rawInfo: Int) {
|
||||
getMapUIController()?.changeCurrentIcon(rawInfo)
|
||||
HdMapBuildConfig.currentCarVrIconRes = rawInfo
|
||||
}
|
||||
|
||||
override fun createPresenter(): BusPassengerPresenter {
|
||||
return BusPassengerPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView.onCreate(savedInstanceState)
|
||||
omvOverMap.onCreateView(savedInstanceState)
|
||||
}
|
||||
|
||||
fun drawEndStation(latLng: LatLng) {
|
||||
val listOf = listOf(latLng)
|
||||
omvOverMap.drawSiteMarkers(listOf, endStation, 0.5f, 1f)
|
||||
includePoint(listOf)
|
||||
}
|
||||
|
||||
fun cleanEndStation() {
|
||||
omvOverMap.clearSiteMarkers()
|
||||
omvOverMap.clearCustomPolyline()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
mapBizView.onResume()
|
||||
omvOverMap.onResume()
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapBizView.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
super.onLowMemory()
|
||||
mapBizView.onLowMemory()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mapBizView.onPause()
|
||||
omvOverMap.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
mapBizView.onDestroy()
|
||||
omvOverMap.onDestroy()
|
||||
super.onDestroyView()
|
||||
EventBus.getDefault().unregister(this)
|
||||
}
|
||||
|
||||
override fun onMapLoaded() {
|
||||
super.onMapLoaded()
|
||||
getMapUIController()?.setAllGesturesEnabled(false)
|
||||
}
|
||||
|
||||
fun showOpenAndCloseDoor() {
|
||||
val noviceGuidanceFragment = noviceGuidanceFragment?.get()
|
||||
noviceGuidanceFragment?.dismissAllowingStateLoss()
|
||||
|
||||
if (m1CarUserNoOrderFragment?.get() == null) {
|
||||
m1CarUserNoOrderFragment = WeakReference(M1CarUserNoOrderFragment.newInstance())
|
||||
}
|
||||
val m1CarUserNoOrderFragment = m1CarUserNoOrderFragment?.get()
|
||||
M1CarUserNoOrderFragment.showOpenAndCloseDoor(
|
||||
childFragmentManager,
|
||||
parentFragmentManager,
|
||||
m1CarUserNoOrderFragment
|
||||
)
|
||||
}
|
||||
|
||||
fun showOvermapPoint(){
|
||||
omvOverMap.setDebugMode(true)
|
||||
}
|
||||
|
||||
fun showNoviceGuidanceFragment() {
|
||||
if (noviceGuidanceFragment?.get() == null) {
|
||||
noviceGuidanceFragment = WeakReference(NoviceGuidanceFragment.newInstance())
|
||||
}
|
||||
val noviceGuidanceFragmentWeak = noviceGuidanceFragment?.get()
|
||||
NoviceGuidanceFragment.showNoviceGuidance(
|
||||
childFragmentManager,
|
||||
parentFragmentManager,
|
||||
noviceGuidanceFragmentWeak
|
||||
)
|
||||
LockManager.setLock(LockManager.LockStatus.UNLOCK)
|
||||
}
|
||||
|
||||
fun closeOpenAndCloseDoor() {
|
||||
val bpFunctionGroup = m1CarUserNoOrderFragment?.get()
|
||||
bpFunctionGroup?.let {
|
||||
bpFunctionGroup.dismissAllowingStateLoss()
|
||||
}
|
||||
UiThreadHandler.postDelayed({
|
||||
cleanEndStation()
|
||||
}, 2_000)
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun changeOverview(eventLineSites: EventLineSites) {
|
||||
CallerLogger.d(M_BUS_P + TAG, "eventLineSites:${eventLineSites.lineInfo?.lineId}")
|
||||
if (eventLineSites.clear) {
|
||||
omvOverMap?.clearSitePolyline()
|
||||
omvOverMap?.clearSiteMarkers()
|
||||
omvOverMap?.clearSiteNameViews()
|
||||
mPresenter?.drawEndStation()
|
||||
} else {
|
||||
if (eventLineSites.lineInfo == null) {//更新站点
|
||||
mPresenter?.drawStationInfo(eventLineSites.sites!!)
|
||||
} else {// 更新轨迹和站点
|
||||
mPresenter?.getLineTrajectory(eventLineSites.lineInfo, eventLineSites.sites!!)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun drawOverMapViewStation(
|
||||
stationsList: MutableList<SiteMarkerBean>,
|
||||
siteMarkers: List<SiteMarkerBean>?
|
||||
) {
|
||||
omvOverMap?.clearSiteMarkers()
|
||||
omvOverMap?.clearSiteNameViews()
|
||||
omvOverMap?.drawSiteMarkers(stationsList)
|
||||
omvOverMap?.drawSiteNameViews(siteMarkers)
|
||||
}
|
||||
|
||||
fun drawOverMapViewTrajectory(coordinates: List<LatLng>) {
|
||||
omvOverMap?.drawSitePolyline(coordinates, lineTrajectory)
|
||||
}
|
||||
|
||||
fun includePoint(coordinates: List<LatLng>){
|
||||
omvOverMap?.includeSitePointsAndUpdateCamera(coordinates)
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "BusPassengerRouteFragment"
|
||||
}
|
||||
|
||||
}
|
||||
@@ -49,12 +49,11 @@ class FacadeDriverProvider : IMoGoFunctionProvider, ILoginCallback {
|
||||
private fun showFragment() {
|
||||
val supportFragmentManager: FragmentManager? = activity?.supportFragmentManager
|
||||
|
||||
// val fragment= if(LoginStatusManager.isLogin()){
|
||||
// getFragment()
|
||||
// }else{
|
||||
// LoginStatusManager.getFragment()
|
||||
// }
|
||||
val fragment = SimpleFragment()
|
||||
val fragment= if(LoginStatusManager.isLogin()){
|
||||
getFragment()
|
||||
}else{
|
||||
LoginStatusManager.getFragment()
|
||||
}
|
||||
d(SceneConstant.M_TAXI_P + TAG, "准备add fragment======")
|
||||
|
||||
if(supportFragmentManager!=null){
|
||||
|
||||
Reference in New Issue
Block a user