修复了二次打开面板出行动态没有刷新问题

This commit is contained in:
董宏宇
2020-08-14 15:19:43 +08:00
parent 1797e34579
commit 8e262c320b
3 changed files with 97 additions and 92 deletions

View File

@@ -83,6 +83,10 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
@NonNull
protected abstract P createPresenter();
public P getPresenter() {
return mPresenter;
}
@Nullable
protected <T extends View> T findViewById(int id) {
if (mRootView == null) {

View File

@@ -29,12 +29,16 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
private val TAG = "EventPanelFragment"
private var isFirstLoad = false
private var fragments: Array<Fragment>? = null
private var mediator: TabLayoutMediator? = null
private var mV2XEventPanelHistoryCountView: V2XEventPanelHistoryCountView? = null
private val mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
companion object {
private val fragment = V2XEventPanelFragment()
fun getInstance(): V2XEventPanelFragment {
@@ -86,7 +90,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
Logger.d(MODULE_NAME, "事件面板初始化……")
try {
fragments = arrayOf(
V2XScenarioHistoryFragment(),
mV2XScenarioHistoryFragment,
V2XSurroundingFragment(),
V2XShareEventsFragment()
)
@@ -143,21 +147,24 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
fun showPanel() {
Logger.d(MODULE_NAME, "in fragment show panel")
clPanelContainer.visibility = View.VISIBLE
// V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, true)
// 注册语音交互
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
// 注册语音交互
V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP, mCheckHistoryEventCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP, mCheckSurroundingCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP, mCheckShearEventCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, mCloeEventCb)
try {
if (isFirstLoad) {
mV2XScenarioHistoryFragment.presenter.loadHistory()
}
} catch (e: Exception) {
e.printStackTrace()
}
isFirstLoad = true
}
fun hidePanel() {
Logger.d(MODULE_NAME, "in fragment hide panel")
clPanelContainer.visibility = View.GONE
// V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, false)
// 注册语音交互
V2XVoiceManager.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP)

View File

@@ -1,100 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<com.mogo.module.v2x.view.RoundConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/clPanelContainer"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="#10121E"
android:clickable="true"
android:paddingStart="@dimen/dp_30"
android:paddingEnd="@dimen/dp_30"
android:visibility="gone"
app:roundLayoutRadius="@dimen/dp_40"
tools:visibility="visible">
<com.mogo.module.v2x.view.RoundConstraintLayout
android:id="@+id/clPanelContainer"
<RadioGroup
android:id="@+id/rgTabSelect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#10121E"
android:clickable="true"
android:paddingStart="@dimen/dp_30"
android:paddingEnd="@dimen/dp_30"
android:visibility="gone"
app:roundLayoutRadius="@dimen/dp_40"
tools:visibility="visible">
android:layout_height="@dimen/dp_154"
android:gravity="center_vertical"
android:orientation="horizontal">
<RadioGroup
android:id="@+id/rgTabSelect"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_154"
android:gravity="center_vertical"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rbScenarioHistory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:checked="true"
android:gravity="center"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
android:text="出行动态"
android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/dp_40"
android:textStyle="bold" />
<RadioButton
android:id="@+id/rbScenarioHistory"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:checked="true"
android:gravity="center"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
android:text="出行动态"
android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/dp_40"
android:textStyle="bold" />
<View
android:layout_width="2dp"
android:layout_height="@dimen/dp_42"
android:background="#757575" />
<View
android:layout_width="2dp"
android:layout_height="@dimen/dp_42"
android:background="#757575" />
<RadioButton
android:id="@+id/rbSurroundingEvent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:gravity="center"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
android:text="周边事件"
android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/dp_40"
android:textStyle="bold" />
<RadioButton
android:id="@+id/rbSurroundingEvent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:gravity="center"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
android:text="周边事件"
android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/dp_40"
android:textStyle="bold" />
<View
android:layout_width="2dp"
android:layout_height="@dimen/dp_42"
android:background="#757575" />
<View
android:layout_width="2dp"
android:layout_height="@dimen/dp_42"
android:background="#757575" />
<RadioButton
android:id="@+id/rbShareEvents"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:gravity="center"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
android:text="我的分享"
android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/dp_40"
android:textStyle="bold" />
</RadioGroup>
<RadioButton
android:id="@+id/rbShareEvents"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:button="@null"
android:gravity="center"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
android:text="我的分享"
android:textColor="@color/radiobutton_textcolor"
android:textSize="@dimen/dp_40"
android:textStyle="bold" />
</RadioGroup>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vpEventPanel"
android:layout_width="match_parent"
android:layout_height="0dp"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rgTabSelect" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/vpEventPanel"
android:layout_width="match_parent"
android:layout_height="0dp"
android:nestedScrollingEnabled="false"
android:overScrollMode="never"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rgTabSelect" />
<ImageView
android:id="@+id/btnHidePanels"
android:layout_width="@dimen/dp_88"
android:layout_height="@dimen/dp_88"
android:background="@drawable/icon_window_close"
app:layout_constraintBottom_toBottomOf="@+id/rgTabSelect"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/rgTabSelect" />
<ImageView
android:id="@+id/btnHidePanels"
android:layout_width="@dimen/dp_88"
android:layout_height="@dimen/dp_88"
android:background="@drawable/icon_window_close"
app:layout_constraintBottom_toBottomOf="@+id/rgTabSelect"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@+id/rgTabSelect" />
</com.mogo.module.v2x.view.RoundConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.mogo.module.v2x.view.RoundConstraintLayout>