@@ -12,7 +12,6 @@ import com.mogo.module.v2x.V2XServiceManager
|
||||
import com.mogo.module.v2x.adapter.V2XEventPagerAdapter
|
||||
import com.mogo.module.v2x.presenter.EventPanelPresenter
|
||||
import com.mogo.module.v2x.utils.TrackUtils
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils
|
||||
import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView
|
||||
import com.mogo.utils.logger.Logger
|
||||
import kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_event_panel.*
|
||||
@@ -46,51 +45,52 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(MODULE_NAME, "事件面板初始化……")
|
||||
fragments = arrayOf(
|
||||
V2XScenarioHistoryFragment(),
|
||||
V2XSurroundingFragment(),
|
||||
V2XShareEventsFragment()
|
||||
)
|
||||
//禁用预加载
|
||||
vpEventPanel.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
|
||||
vpEventPanel.adapter = V2XEventPagerAdapter(this, fragments!!)
|
||||
vpEventPanel.isUserInputEnabled = false; //true:滑动,false:禁止滑动
|
||||
try {
|
||||
fragments = arrayOf(
|
||||
V2XScenarioHistoryFragment(),
|
||||
V2XSurroundingFragment(),
|
||||
V2XShareEventsFragment()
|
||||
)
|
||||
//禁用预加载
|
||||
vpEventPanel.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
|
||||
vpEventPanel.adapter = V2XEventPagerAdapter(this, fragments!!)
|
||||
vpEventPanel.isUserInputEnabled = false; //true:滑动,false:禁止滑动
|
||||
|
||||
val radioGroup = findViewById<View>(R.id.rgTabSelect) as RadioGroup?
|
||||
radioGroup!!.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rbScenarioHistory -> {
|
||||
TrackUtils.trackV2xHistoryEvent(2)
|
||||
vpEventPanel.setCurrentItem(0, false)
|
||||
}
|
||||
R.id.rbSurroundingEvent -> {
|
||||
TrackUtils.trackV2xHistoryEvent(3)
|
||||
vpEventPanel.setCurrentItem(1, false)
|
||||
}
|
||||
R.id.rbShareEvents -> {
|
||||
TrackUtils.trackV2xHistoryEvent(4)
|
||||
vpEventPanel.setCurrentItem(2, false)
|
||||
val radioGroup = findViewById<View>(R.id.rgTabSelect) as RadioGroup?
|
||||
radioGroup!!.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.rbScenarioHistory -> {
|
||||
TrackUtils.trackV2xHistoryEvent(2)
|
||||
vpEventPanel.setCurrentItem(0, false)
|
||||
}
|
||||
R.id.rbSurroundingEvent -> {
|
||||
TrackUtils.trackV2xHistoryEvent(3)
|
||||
vpEventPanel.setCurrentItem(1, false)
|
||||
}
|
||||
R.id.rbShareEvents -> {
|
||||
TrackUtils.trackV2xHistoryEvent(4)
|
||||
vpEventPanel.setCurrentItem(2, false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
btnHidePanels.setOnClickListener {
|
||||
TrackUtils.trackV2xHistoryEvent(5)
|
||||
hidePanel()
|
||||
}
|
||||
|
||||
mV2XEventPanelHistoryCountView = V2XEventPanelHistoryCountView(context)
|
||||
mV2XEventPanelHistoryCountView!!.setOnClickListener {
|
||||
TrackUtils.trackV2xHistoryEvent(1)
|
||||
if (!isPanelShow()) {
|
||||
showPanel()
|
||||
} else {
|
||||
btnHidePanels.setOnClickListener {
|
||||
TrackUtils.trackV2xHistoryEvent(5)
|
||||
hidePanel()
|
||||
}
|
||||
}
|
||||
V2XServiceManager.getMogoEntranceButtonController().addBottomLayerView(mV2XEventPanelHistoryCountView)
|
||||
|
||||
changeEventCount()
|
||||
mV2XEventPanelHistoryCountView = V2XEventPanelHistoryCountView(context)
|
||||
mV2XEventPanelHistoryCountView!!.setOnClickListener {
|
||||
if (!isPanelShow()) {
|
||||
TrackUtils.trackV2xHistoryEvent(1)
|
||||
showPanel()
|
||||
}
|
||||
}
|
||||
V2XServiceManager.getMogoEntranceButtonController().addBottomLayerView(mV2XEventPanelHistoryCountView)
|
||||
changeEventCount()
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
@@ -105,13 +105,13 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
fun showPanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment show panel")
|
||||
clPanelContainer.visibility = View.VISIBLE
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, true)
|
||||
// V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, true)
|
||||
}
|
||||
|
||||
fun hidePanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment hide panel")
|
||||
clPanelContainer.visibility = View.GONE
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, false)
|
||||
// V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, false)
|
||||
}
|
||||
|
||||
fun isPanelShow(): Boolean {
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.mogo.module.v2x.adapter.V2XScenarioHistoryAdapter;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener;
|
||||
import com.mogo.module.v2x.manager.V2XStatusDescriptor;
|
||||
import com.mogo.module.v2x.presenter.ScenarioHistoryPresenter;
|
||||
import com.mogo.module.v2x.utils.ThreadUtils;
|
||||
import com.mogo.module.v2x.view.V2XListEmptyView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -108,16 +109,21 @@ public class V2XScenarioHistoryFragment
|
||||
*/
|
||||
public void loadHistory(List<V2XHistoryScenarioData> v2XHistoryScenarioData) {
|
||||
Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData));
|
||||
mV2XHistoryScenarioData.clear();
|
||||
if (v2XHistoryScenarioData.size() > 0) {
|
||||
mEmptyView.setVisibility(View.GONE);
|
||||
mClHistoryList.setVisibility(View.VISIBLE);
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
|
||||
} else {
|
||||
mEmptyView.setVisibility(View.VISIBLE);
|
||||
mClHistoryList.setVisibility(View.GONE);
|
||||
}
|
||||
mV2XScenarioHistoryAdapter.notifyDataSetChanged();
|
||||
ThreadUtils.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mV2XHistoryScenarioData.clear();
|
||||
if (v2XHistoryScenarioData.size() > 0) {
|
||||
mEmptyView.setVisibility(View.GONE);
|
||||
mClHistoryList.setVisibility(View.VISIBLE);
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
|
||||
} else {
|
||||
mEmptyView.setVisibility(View.VISIBLE);
|
||||
mClHistoryList.setVisibility(View.GONE);
|
||||
}
|
||||
mV2XScenarioHistoryAdapter.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,9 @@ package com.mogo.module.v2x.presenter;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.v2x.fragment.V2XScenarioHistoryFragment;
|
||||
import com.mogo.module.v2x.utils.ThreadUtils;
|
||||
import com.mogo.module.v2x.utils.V2XSQLiteUtils;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,7 +20,9 @@ public class ScenarioHistoryPresenter extends Presenter<V2XScenarioHistoryFragme
|
||||
}
|
||||
|
||||
public void loadHistory() {
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData();
|
||||
mView.loadHistory(v2XHistoryScenarioData);
|
||||
WorkThreadHandler.getInstance().post(() -> {
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData();
|
||||
mView.loadHistory(v2XHistoryScenarioData);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user