Merge branch 'dev_1.1.2' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into dev_1.1.2
* 'dev_1.1.2' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher: 增加了选定 晚上了Tab的样式 bugfix 按虚拟home键无法销毁消息列表的问题。 增加了Tab的数据填充以及与ViewPager的交互 opt 完成了出行动态的展示 1. 定位按钮加入设置地图中心点的功能。 将推送代码接入主工程 opt 1. 解决push推送相关问题。 融合高德广播和语音指令控制地图的逻辑 升级passport相关sdk、修改地图"继续导航"指令问题
This commit is contained in:
@@ -44,6 +44,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.material
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -52,7 +52,6 @@ class EventPanelModuleProvider : IEventPanelProvider {
|
||||
return EventPanelFragment.getInstance().isPanelShow()
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 隐藏面板
|
||||
*/
|
||||
|
||||
@@ -2,17 +2,15 @@ package com.zhidao.mogo.module.event.panel.adapter
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.zhidao.mogo.module.event.panel.fragment.ShareEventsFragment
|
||||
import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment
|
||||
import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
|
||||
|
||||
/**
|
||||
* 事件面板viewpager2的adapter
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class EventPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
|
||||
private val fragments:Array<Fragment> = arrayOf(TripRecordFragment(), SurroundingEventFragment(), ShareEventsFragment())
|
||||
class EventPagerAdapter(fragment: Fragment,
|
||||
private val fragments: Array<Fragment>) :
|
||||
FragmentStateAdapter(fragment) {
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.zhidao.mogo.module.event.panel.adapter;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.zhidao.mogo.module.event.panel.adapter.holder.ScenarioHistoryIllegalParkVH;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class ScenarioHistoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData;
|
||||
|
||||
public ScenarioHistoryAdapter(ArrayList<V2XHistoryScenarioData> v2XHistoryScenarioData) {
|
||||
if (v2XHistoryScenarioData != null) {
|
||||
this.mV2XHistoryScenarioData = v2XHistoryScenarioData;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
RecyclerView.ViewHolder holder;
|
||||
switch (viewType) {
|
||||
// 直播
|
||||
case V2XWindowTypeEnum.LIVE_CAR_WINDOW:
|
||||
holder = new ScenarioHistoryIllegalParkVH(parent);
|
||||
break;
|
||||
default:
|
||||
holder = new ScenarioHistoryIllegalParkVH(parent);
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
if (holder instanceof ScenarioHistoryIllegalParkVH) {
|
||||
((ScenarioHistoryIllegalParkVH) holder).initView(mV2XHistoryScenarioData.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mV2XHistoryScenarioData == null ? 0 : mV2XHistoryScenarioData.size();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.zhidao.mogo.module.event.panel.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.zhidao.mogo.module.event.panel.R;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class ScenarioHistoryIllegalParkVH extends V2XBaseViewHolder {
|
||||
public ScenarioHistoryIllegalParkVH(@NonNull ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.module_event_panel_share_item, viewGroup, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XHistoryScenarioData viewData) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delayedCloseWindow() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.zhidao.mogo.module.event.panel.adapter.holder;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* V2X展示视图公用的实现
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public abstract class V2XBaseViewHolder
|
||||
extends RecyclerView.ViewHolder
|
||||
implements IMogoNaviListener {
|
||||
|
||||
public V2XBaseViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
public abstract void initView(V2XHistoryScenarioData viewData);
|
||||
|
||||
/**
|
||||
* 延迟关闭窗体视图
|
||||
*/
|
||||
public abstract void delayedCloseWindow();
|
||||
|
||||
/**
|
||||
* 点赞
|
||||
*/
|
||||
public void triggerZan(MarkerExploreWay noveltyInfo) {
|
||||
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打电话
|
||||
*/
|
||||
public void triggerCallChart(MarkerExploreWay noveltyInfo) {
|
||||
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况错误
|
||||
*/
|
||||
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
|
||||
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 反馈路况正确
|
||||
*/
|
||||
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
|
||||
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导航规划路线
|
||||
*/
|
||||
public void triggerStartNavi(MarkerExploreWay noveltyInfo) {
|
||||
|
||||
delayedCloseWindow();
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示自定义 Toast
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public void showTip(String msg) {
|
||||
TipToast.tip(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
Logger.w("V2XBaseViewHolder", "onCalculateSuccess");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,15 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment
|
||||
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Typeface
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.google.android.material.tabs.TabLayoutMediator.TabConfigurationStrategy
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
|
||||
@@ -10,6 +18,7 @@ import com.zhidao.mogo.module.event.panel.adapter.EventPagerAdapter
|
||||
import com.zhidao.mogo.module.event.panel.presenter.EventPanelPresenter
|
||||
import kotlinx.android.synthetic.main.module_event_panel_fragment_event_panel.*
|
||||
|
||||
|
||||
/**
|
||||
* 事件面板主fragment
|
||||
*
|
||||
@@ -17,9 +26,28 @@ import kotlinx.android.synthetic.main.module_event_panel_fragment_event_panel.*
|
||||
*/
|
||||
class EventPanelFragment : MvpFragment<EventPanelFragment, EventPanelPresenter>() {
|
||||
|
||||
companion object{
|
||||
|
||||
private val tabsTitle = arrayOf("出行动态", "周边事件", "我的分享")
|
||||
private val fragments: Array<Fragment> =
|
||||
arrayOf(
|
||||
ScenarioHistoryFragment(),
|
||||
SurroundingEventFragment(),
|
||||
ShareEventsFragment()
|
||||
)
|
||||
|
||||
private var mediator: TabLayoutMediator? = null
|
||||
|
||||
private val activeColor: Int = android.graphics.Color.parseColor("#ff678f")
|
||||
private val normalColor: Int = android.graphics.Color.parseColor("#EE00FF")
|
||||
|
||||
private val activeSize = 40
|
||||
private val normalSize = 30
|
||||
|
||||
private var selectPosition = 1
|
||||
|
||||
companion object {
|
||||
private val fragment = EventPanelFragment()
|
||||
fun getInstance():EventPanelFragment{
|
||||
fun getInstance(): EventPanelFragment {
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
@@ -30,32 +58,83 @@ class EventPanelFragment : MvpFragment<EventPanelFragment, EventPanelPresenter>(
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(MODULE_NAME, "EventPanelFragment init view===")
|
||||
vpEventPanel.adapter = EventPagerAdapter(this)
|
||||
//禁用预加载
|
||||
vpEventPanel.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
|
||||
vpEventPanel.adapter = EventPagerAdapter(this, fragments)
|
||||
//viewPager 页面切换监听
|
||||
vpEventPanel.registerOnPageChangeCallback(changeCallback)
|
||||
|
||||
//这里可以自定义TabView
|
||||
mediator = TabLayoutMediator(tabLayout, vpEventPanel, TabConfigurationStrategy { tab, position ->
|
||||
val tabView = TextView(context)
|
||||
tabView.gravity = Gravity.CENTER
|
||||
val states = arrayOfNulls<IntArray>(2)
|
||||
states[0] = intArrayOf(android.R.attr.state_selected)
|
||||
states[1] = intArrayOf()
|
||||
val colors = intArrayOf(activeColor, normalColor)
|
||||
val colorStateList = ColorStateList(states, colors)
|
||||
tabView.text = tabsTitle[position]
|
||||
tabView.textSize = normalSize.toFloat()
|
||||
tabView.setTextColor(colorStateList)
|
||||
tab.customView = tabView
|
||||
})
|
||||
//要执行这一句才是真正将两者绑定起来
|
||||
mediator!!.attach()
|
||||
|
||||
btnShowOrHidePanels.setOnClickListener {
|
||||
if (vpEventPanel.visibility == View.GONE) {
|
||||
if (clPanelContainer.visibility == View.GONE) {
|
||||
showPanel()
|
||||
}else{
|
||||
// 选中指定的Tab
|
||||
tabLayout.getTabAt(selectPosition)?.select()
|
||||
vpEventPanel.currentItem = selectPosition
|
||||
} else {
|
||||
hidePanel()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val changeCallback: OnPageChangeCallback = object : OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
selectPosition = position
|
||||
//可以来设置选中时tab的大小
|
||||
val tabCount = tabLayout.tabCount
|
||||
for (i in 0 until tabCount) {
|
||||
val tab = tabLayout.getTabAt(i)
|
||||
val tabView = tab!!.customView as TextView?
|
||||
if (tab.position == position) {
|
||||
tabView!!.textSize = activeSize.toFloat()
|
||||
tabView.typeface = Typeface.DEFAULT_BOLD
|
||||
} else {
|
||||
tabView!!.textSize = normalSize.toFloat()
|
||||
tabView.typeface = Typeface.DEFAULT
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
mediator?.detach()
|
||||
vpEventPanel?.unregisterOnPageChangeCallback(changeCallback)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun createPresenter(): EventPanelPresenter {
|
||||
return EventPanelPresenter(this)
|
||||
}
|
||||
|
||||
fun showPanel(){
|
||||
Logger.d(MODULE_NAME,"in fragment show panel")
|
||||
vpEventPanel.visibility = View.VISIBLE
|
||||
fun showPanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment show panel")
|
||||
clPanelContainer.visibility = View.VISIBLE
|
||||
btnShowOrHidePanels.text = "隐藏面板"
|
||||
}
|
||||
|
||||
fun hidePanel(){
|
||||
Logger.d(MODULE_NAME,"in fragment hide panel")
|
||||
vpEventPanel.visibility = View.GONE
|
||||
fun hidePanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment hide panel")
|
||||
clPanelContainer.visibility = View.GONE
|
||||
btnShowOrHidePanels.text = "显示面板"
|
||||
}
|
||||
|
||||
fun isPanelShow():Boolean{
|
||||
return vpEventPanel.visibility == View.VISIBLE
|
||||
fun isPanelShow(): Boolean {
|
||||
return clPanelContainer.visibility == View.VISIBLE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.mogo.module.event.panel.R;
|
||||
import com.zhidao.mogo.module.event.panel.adapter.ScenarioHistoryAdapter;
|
||||
import com.zhidao.mogo.module.event.panel.presenter.ScenarioHistoryPresenter;
|
||||
import com.zhidao.mogo.module.event.panel.util.V2XSQLiteUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 出行动态,V2X 提示过的场景历史
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class ScenarioHistoryFragment
|
||||
extends MvpFragment<ScenarioHistoryFragment, ScenarioHistoryPresenter> {
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private ScenarioHistoryAdapter mScenarioHistoryAdapter;
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_event_panel_fragment_scenario_history;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
Log.d("ScenarioHistoryFragment", "initViews --------> ");
|
||||
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
mScenarioHistoryAdapter = new ScenarioHistoryAdapter(mV2XHistoryScenarioData);
|
||||
mRecyclerView.setAdapter(mScenarioHistoryAdapter);
|
||||
// 设置切换样式
|
||||
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
|
||||
// 配置列表朝向
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData(getActivity());
|
||||
Logger.d("ScenarioHistoryFragment", "查询到历史消息:" + v2XHistoryScenarioData);
|
||||
mV2XHistoryScenarioData.clear();
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
|
||||
mScenarioHistoryAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData(getActivity());
|
||||
Logger.d("ScenarioHistoryFragment", "查询到历史消息:" + v2XHistoryScenarioData);
|
||||
mV2XHistoryScenarioData.clear();
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
|
||||
mScenarioHistoryAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected ScenarioHistoryPresenter createPresenter() {
|
||||
return new ScenarioHistoryPresenter(this);
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel.fragment
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.common.entity.V2XMessageEntity
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
|
||||
import com.zhidao.mogo.module.event.panel.R
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
import com.zhidao.mogo.module.event.panel.presenter.TripRecordPresenter
|
||||
import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
|
||||
import kotlinx.android.synthetic.main.module_event_panel_fragment_trip_record.*
|
||||
import kotlin.random.Random
|
||||
|
||||
/**
|
||||
* 出行动态fragment
|
||||
*/
|
||||
class TripRecordFragment : MvpFragment<TripRecordFragment, TripRecordPresenter>() {
|
||||
private val tripRecordList = ArrayList<TripRecord>()
|
||||
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_trip_record
|
||||
|
||||
override fun initViews() {
|
||||
btnInsert.setOnClickListener {
|
||||
TripRecordDataManager.insertTripRecord(TripRecord(id = 456, eventType = 456,eventId = "456"))
|
||||
}
|
||||
btnUpdate.setOnClickListener {
|
||||
TripRecordDataManager.syncRoadEventModifyState(eventId = "456", modifyType = "2")
|
||||
}
|
||||
btnQuery.setOnClickListener {
|
||||
Log.d(MODULE_NAME, "local list: $tripRecordList")
|
||||
mPresenter.queryAllTripRecord()
|
||||
}
|
||||
}
|
||||
|
||||
override fun createPresenter(): TripRecordPresenter = TripRecordPresenter(this)
|
||||
|
||||
fun refreshTripRecordList(tripRecords: List<TripRecord>) {
|
||||
Logger.d(MODULE_NAME, "刷新出行动态列表:$tripRecords")
|
||||
tripRecordList.clear()
|
||||
tripRecordList.addAll(tripRecords)
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新单个出行动态,如果无此动态,新增动态
|
||||
*/
|
||||
fun refreshTripRecord(tripRecord: TripRecord) {
|
||||
Logger.d(MODULE_NAME, "刷新单个出行动态: $tripRecord")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zhidao.mogo.module.event.panel.presenter;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.zhidao.mogo.module.event.panel.fragment.ScenarioHistoryFragment;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class ScenarioHistoryPresenter extends Presenter<ScenarioHistoryFragment> {
|
||||
|
||||
public ScenarioHistoryPresenter(ScenarioHistoryFragment view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.zhidao.mogo.module.event.panel.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.zhidao.mogo.module.event.panel.bean.TripRecord
|
||||
import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
|
||||
import com.zhidao.mogo.module.event.panel.listener.ITripRecordCallback
|
||||
import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
|
||||
|
||||
class TripRecordPresenter(view: TripRecordFragment) : Presenter<TripRecordFragment>(view),ITripRecordCallback {
|
||||
|
||||
init {
|
||||
TripRecordDataManager.addTripRecordCallback(this)
|
||||
}
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
TripRecordDataManager.removeTripRecordCallback(this)
|
||||
}
|
||||
|
||||
fun queryAllTripRecord(){
|
||||
TripRecordDataManager.queryAllTripRecord()
|
||||
}
|
||||
|
||||
override fun queryTripRecordListSuccess(tripRecordList: List<TripRecord>) {
|
||||
mView.refreshTripRecordList(tripRecordList)
|
||||
}
|
||||
|
||||
override fun insertOrUpdateTripRecordSuccess(tripRecord: TripRecord) {
|
||||
mView.refreshTripRecord(tripRecord)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.zhidao.mogo.module.event.panel.util;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.utils.sqlite.BaseDaoFactory;
|
||||
import com.mogo.utils.sqlite.IBaseDao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据库操作工具类
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XSQLiteUtils {
|
||||
/**
|
||||
* 场景数据管理
|
||||
*/
|
||||
private static IBaseDao<V2XHistoryScenarioData> mScenarioHistoryDao;
|
||||
|
||||
/**
|
||||
* 场景数据管理
|
||||
*/
|
||||
public static IBaseDao<V2XHistoryScenarioData> getScenarioHistoryDao(Context context) {
|
||||
if (mScenarioHistoryDao == null) {
|
||||
synchronized (V2XSQLiteUtils.class) {
|
||||
if (mScenarioHistoryDao == null) {
|
||||
mScenarioHistoryDao = BaseDaoFactory.Companion.getInstance()
|
||||
.getBaseDao(context, V2XHistoryScenarioData.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mScenarioHistoryDao;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当天的V2X数据
|
||||
*/
|
||||
public static List<V2XHistoryScenarioData> getScenarioHistoryData(Context context) {
|
||||
|
||||
return getScenarioHistoryDao(context).query(new V2XHistoryScenarioData());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clPanelContainer"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/vpEventPanel"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
android:background="@color/cardview_dark_background"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_150"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tabGravity="fill"
|
||||
app:tabIndicatorColor="#ff678f"
|
||||
app:tabIndicatorFullWidth="false"
|
||||
app:tabIndicatorHeight="2dp"
|
||||
app:tabMode="fixed"
|
||||
app:tabSelectedTextColor="#ff678f"
|
||||
app:tabTextColor="#EE00FF"
|
||||
app:tabUnboundedRipple="true" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/vpEventPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/tabLayout" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnShowOrHidePanels"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#FFF">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recyclerView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/module_event_panel_share_item" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="Trip Record"
|
||||
android:textColor="#000"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnInsert"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Insert"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnUpdate"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnUpdate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Update"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnInsert"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnDelete"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDelete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Delete"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnUpdate"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnQuery"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQuery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Query"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnDelete"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGenerate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="GenerateLimitTime"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnInsert" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
Reference in New Issue
Block a user