「优化」
增加了事件面板得状态同步
This commit is contained in:
@@ -13,6 +13,7 @@ import com.google.android.material.tabs.TabLayoutMediator.TabConfigurationStrate
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.module.v2x.R
|
||||
import com.mogo.module.v2x.V2XConst.MODULE_NAME
|
||||
import com.mogo.module.v2x.V2XServiceManager
|
||||
import com.mogo.module.v2x.adapter.EventPagerAdapter
|
||||
import com.mogo.module.v2x.presenter.EventPanelPresenter
|
||||
import com.mogo.utils.logger.Logger
|
||||
@@ -26,6 +27,7 @@ import kotlinx.android.synthetic.main.module_event_panel_fragment_event_panel.*
|
||||
*/
|
||||
class EventPanelFragment : MvpFragment<EventPanelFragment, EventPanelPresenter>() {
|
||||
|
||||
private val TAG = "EventPanelFragment"
|
||||
|
||||
private val tabsTitle = arrayOf("出行动态", "周边事件", "我的分享")
|
||||
private var fragments: Array<Fragment>? = null
|
||||
@@ -35,7 +37,7 @@ class EventPanelFragment : MvpFragment<EventPanelFragment, EventPanelPresenter>(
|
||||
private val activeColor: Int = android.graphics.Color.parseColor("#ff678f")
|
||||
private val normalColor: Int = android.graphics.Color.parseColor("#EE00FF")
|
||||
|
||||
private val activeSize = 40
|
||||
private val activeSize = 35
|
||||
private val normalSize = 30
|
||||
|
||||
private var selectPosition = 0
|
||||
@@ -126,12 +128,15 @@ class EventPanelFragment : MvpFragment<EventPanelFragment, EventPanelPresenter>(
|
||||
Logger.d(MODULE_NAME, "in fragment show panel")
|
||||
clPanelContainer.visibility = View.VISIBLE
|
||||
btnShowOrHidePanels.text = "隐藏面板"
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, true)
|
||||
}
|
||||
|
||||
fun hidePanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment hide panel")
|
||||
clPanelContainer.visibility = View.GONE
|
||||
btnShowOrHidePanels.text = "显示面板"
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, false)
|
||||
|
||||
}
|
||||
|
||||
fun isPanelShow(): Boolean {
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
package com.mogo.module.v2x.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
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.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.ScenarioHistoryAdapter;
|
||||
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.V2XSQLiteUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -26,6 +29,7 @@ import java.util.List;
|
||||
*/
|
||||
public class ScenarioHistoryFragment
|
||||
extends MvpFragment<ScenarioHistoryFragment, ScenarioHistoryPresenter> {
|
||||
private String TAG = "ScenarioHistoryFragment";
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private ScenarioHistoryAdapter mScenarioHistoryAdapter;
|
||||
@@ -38,7 +42,22 @@ public class ScenarioHistoryFragment
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
Log.d("ScenarioHistoryFragment", "initViews --------> ");
|
||||
Log.d(TAG, "initViews --------> ");
|
||||
V2XServiceManager.getMoGoV2XStatusManager()
|
||||
.registerStatusChangedListener(
|
||||
TAG,
|
||||
V2XStatusDescriptor.EventPanelWindow_UI,
|
||||
new IMoGoV2XStatusChangedListener() {
|
||||
@Override
|
||||
public void onStatusChanged(V2XStatusDescriptor descriptor, boolean isTrue) {
|
||||
Log.d(TAG, descriptor + " initViews --------> " + isTrue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
Log.d(TAG, "init --------> ");
|
||||
}
|
||||
});
|
||||
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
mScenarioHistoryAdapter = new ScenarioHistoryAdapter(mV2XHistoryScenarioData);
|
||||
@@ -48,7 +67,7 @@ public class ScenarioHistoryFragment
|
||||
mRecyclerView.setLayoutManager(layoutManager);
|
||||
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData();
|
||||
Logger.d("ScenarioHistoryFragment", "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData));
|
||||
Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData));
|
||||
mV2XHistoryScenarioData.clear();
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
|
||||
mScenarioHistoryAdapter.notifyDataSetChanged();
|
||||
@@ -58,7 +77,7 @@ public class ScenarioHistoryFragment
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
List<V2XHistoryScenarioData> v2XHistoryScenarioData = V2XSQLiteUtils.getScenarioHistoryData();
|
||||
Logger.d("ScenarioHistoryFragment", "查询到历史消息:" + v2XHistoryScenarioData);
|
||||
Logger.d(TAG, "查询到历史消息:" + v2XHistoryScenarioData);
|
||||
mV2XHistoryScenarioData.clear();
|
||||
mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
|
||||
mScenarioHistoryAdapter.notifyDataSetChanged();
|
||||
|
||||
@@ -72,6 +72,11 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
boolean isFatigueDrivingWindowShow();
|
||||
|
||||
/**
|
||||
* 事件面板状态 状态
|
||||
*/
|
||||
boolean isEventPanelWindowShow();
|
||||
|
||||
/**
|
||||
* 设置 V2X道路预警POI 是否在展示
|
||||
*
|
||||
@@ -168,6 +173,14 @@ public interface IMoGoV2XStatusManager extends IProvider {
|
||||
*/
|
||||
void setFatigueDrivingWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 事件面板状态 是否在展示
|
||||
*
|
||||
* @param tag
|
||||
* @param show
|
||||
*/
|
||||
void setEventPanelWindowShow(String tag, boolean show);
|
||||
|
||||
/**
|
||||
* 注册监听
|
||||
*
|
||||
|
||||
@@ -67,4 +67,9 @@ public enum V2XStatusDescriptor {
|
||||
* 疲劳驾驶弹窗
|
||||
*/
|
||||
FatigueDrivingWindow_UI,
|
||||
|
||||
/**
|
||||
* 事件面板状态
|
||||
*/
|
||||
EventPanelWindow_UI,
|
||||
}
|
||||
|
||||
@@ -107,6 +107,11 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
|
||||
return get_bool_val(V2XStatusDescriptor.FatigueDrivingWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEventPanelWindowShow() {
|
||||
return get_bool_val(V2XStatusDescriptor.EventPanelWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRoadEventPOIShow(String tag, boolean show) {
|
||||
V2XServiceManager.getMoGoStatusManager().setV2XUIShow(V2XConst.MODULE_NAME, show);
|
||||
@@ -194,6 +199,13 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.FatigueDrivingWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventPanelWindowShow(String tag, boolean show) {
|
||||
mStatus.put(V2XStatusDescriptor.EventPanelWindow_UI, show);
|
||||
invokeStatusChangedListener(V2XStatusDescriptor.EventPanelWindow_UI, show);
|
||||
recordStatusModifier(tag, V2XStatusDescriptor.EventPanelWindow_UI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) {
|
||||
if (listener == null || descriptor == null) {
|
||||
|
||||
Reference in New Issue
Block a user