解决bug

【Launcher二期】道路事件查看时偶从白天切换夜间模式,未适配
http://jira.zhidaohulian.com/browse/FX-448
This commit is contained in:
董宏宇
2020-09-15 18:46:41 +08:00
parent 28729b7659
commit 47bf186486
7 changed files with 110 additions and 71 deletions

View File

@@ -2,6 +2,10 @@ package com.mogo.module.v2x.fragment
import android.content.Intent
import android.view.View
import android.widget.ImageView
import android.widget.RadioButton
import android.widget.RadioGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.fragment.app.Fragment
import androidx.viewpager2.widget.ViewPager2
import com.google.android.material.tabs.TabLayoutMediator
@@ -11,14 +15,12 @@ import com.mogo.module.v2x.V2XConst.MODULE_NAME
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.presenter.ShareEventsPresenter
import com.mogo.module.v2x.utils.TrackUtils
import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener
import com.mogo.module.v2x.voice.V2XVoiceConstants
import com.mogo.module.v2x.voice.V2XVoiceManager
import com.mogo.utils.logger.Logger
import kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_event_panel.*
/**
@@ -38,6 +40,14 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
private var mV2XEventPanelHistoryCountView: V2XEventPanelHistoryCountView? = null
private var mClPanelContainer: ConstraintLayout? = null
private var mVpEventPanel: ViewPager2? = null
private var mRgTabSelect: RadioGroup? = null
private var mBtnHidePanels: ImageView? = null
private var mRbScenarioHistory: RadioButton? = null
private var mRbSurroundingEvent: RadioButton? = null
private var mRbShareEvents: RadioButton? = null
private val mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
private val mV2XShareEventsFragment = V2XShareEventsFragment()
@@ -51,7 +61,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
// 打开出行动态TAB
private val mCheckHistoryEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
try {
rbScenarioHistory?.isChecked = true
mRbScenarioHistory?.isChecked = true
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
@@ -60,7 +70,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
// 打开周边事件TAB
private val mCheckSurroundingCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
try {
rbSurroundingEvent?.isChecked = true
mRbSurroundingEvent?.isChecked = true
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
@@ -69,7 +79,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
// 打开我的分享TAB
private val mCheckShearEventCb = V2XVoiceCallbackListener { command: String?, intent: Intent? ->
try {
rbShareEvents?.isChecked = true
mRbShareEvents?.isChecked = true
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
@@ -92,48 +102,60 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
override fun initViews() {
Logger.d(MODULE_NAME, "事件面板初始化……")
try {
mClPanelContainer = mRootView.findViewById(R.id.clPanelContainer)
mVpEventPanel = mRootView.findViewById(R.id.vpEventPanel)
mRgTabSelect = mRootView.findViewById(R.id.rgTabSelect)
mBtnHidePanels = mRootView.findViewById(R.id.btnHidePanels)
mRbScenarioHistory = mRootView.findViewById(R.id.rbScenarioHistory)
mRbSurroundingEvent = mRootView.findViewById(R.id.rbSurroundingEvent)
mRbShareEvents = mRootView.findViewById(R.id.rbShareEvents)
fragments = arrayOf(
mV2XScenarioHistoryFragment,
V2XSurroundingFragment(),
mV2XShareEventsFragment
)
//禁用预加载
vpEventPanel.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
vpEventPanel.adapter = V2XEventPagerAdapter(this, fragments!!)
vpEventPanel.isUserInputEnabled = false; //true:滑动false禁止滑动
mVpEventPanel?.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
mVpEventPanel?.adapter = V2XEventPagerAdapter(this, fragments!!)
mVpEventPanel?.isUserInputEnabled = false; //true:滑动false禁止滑动
rgTabSelect?.setOnCheckedChangeListener { group, checkedId ->
mRgTabSelect?.setOnCheckedChangeListener { group, checkedId ->
when (checkedId) {
R.id.rbScenarioHistory -> {
TrackUtils.trackV2xHistoryEvent(2)
vpEventPanel.setCurrentItem(0, false)
mVpEventPanel?.setCurrentItem(0, false)
}
R.id.rbSurroundingEvent -> {
TrackUtils.trackV2xHistoryEvent(3)
vpEventPanel.setCurrentItem(1, false)
mVpEventPanel?.setCurrentItem(1, false)
}
R.id.rbShareEvents -> {
TrackUtils.trackV2xHistoryEvent(4)
vpEventPanel.setCurrentItem(2, false)
mVpEventPanel?.setCurrentItem(2, false)
}
}
}
btnHidePanels.setOnClickListener {
mBtnHidePanels?.setOnClickListener {
TrackUtils.trackV2xHistoryEvent(5)
hidePanel()
}
mV2XEventPanelHistoryCountView = V2XEventPanelHistoryCountView(context)
mV2XEventPanelHistoryCountView!!.setOnClickListener {
if (clPanelContainer != null) {
if (mClPanelContainer == null) {
mClPanelContainer = mRootView.findViewById(R.id.clPanelContainer);
}
if (mClPanelContainer != null) {
if (!isPanelShow()) {
TrackUtils.trackV2xHistoryEvent(1)
showPanel()
}
}
}
V2XServiceManager.getMogoEntranceButtonController().addBottomLayerView(mV2XEventPanelHistoryCountView)
V2XServiceManager.getMogoEntranceButtonController()
.addBottomLayerView(mV2XEventPanelHistoryCountView)
changeEventCount()
} catch (e: Exception) {
e.printStackTrace()
@@ -151,7 +173,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
fun showPanel() {
Logger.d(MODULE_NAME, "in fragment show panel")
clPanelContainer.visibility = View.VISIBLE
mClPanelContainer?.visibility = View.VISIBLE
// 注册语音交互
V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP, mCheckHistoryEventCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP, mCheckSurroundingCb)
@@ -171,7 +193,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
fun hidePanel() {
Logger.d(MODULE_NAME, "in fragment hide panel")
clPanelContainer.visibility = View.GONE
mClPanelContainer?.visibility = View.GONE
// 注册语音交互
V2XVoiceManager.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_HISTORY_EVENT_UN_WAKEUP)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SURROUNDING_EVENT_UN_WAKEUP)
@@ -180,7 +202,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
}
fun isPanelShow(): Boolean {
return clPanelContainer.visibility == View.VISIBLE
return mClPanelContainer?.visibility == View.VISIBLE
}
// 修改未处理消息

View File

@@ -9,6 +9,8 @@ import android.util.AttributeSet;
import android.widget.RelativeLayout;
import com.mogo.module.v2x.R;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
/**
* author : donghongyu
@@ -17,29 +19,34 @@ import com.mogo.module.v2x.R;
* desc :
* version: 1.0
*/
public class RoundLayout extends RelativeLayout {
public class RoundLayout extends RelativeLayout implements IMogoSkinCompatSupportable {
private float roundLayoutRadius = 14f;
private Path roundPath;
private RectF rectF;
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
public RoundLayout(Context context) {
this(context, null);
}
public RoundLayout(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs);
public RoundLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public RoundLayout(Context context, AttributeSet attrs) {
super(context, attrs);
public RoundLayout(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundLayout);
roundLayoutRadius = typedArray.getDimensionPixelSize(R.styleable.RoundLayout_roundLayoutRadius, (int) roundLayoutRadius);
typedArray.recycle();
init();
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
private void init() {
setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
roundPath = new Path();
@@ -72,5 +79,12 @@ public class RoundLayout extends RelativeLayout {
}
super.draw(canvas);
}
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}

View File

@@ -25,6 +25,7 @@ import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.skin.support.IMogoSkinCompatSupportable;
import com.mogo.skin.support.helper.MogoSkinCompatBackgroundHelperDelegate;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.tencent.rtmp.ITXLivePlayListener;
@@ -51,6 +52,8 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
private ConstraintLayout mClLoadError;
private TextView mTvRefreshButton;
private MogoSkinCompatBackgroundHelperDelegate mBackgroundTintHelper;
private MarkerCarInfo.CarLiveInfo mCarLiveInfo;
// 重新刷新直播流
private V2XVoiceCallbackListener v2XVoiceCallbackRefreshListener = new V2XVoiceCallbackListener() {
@@ -76,6 +79,9 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
public V2XLiveGSYVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
initView(context);
mBackgroundTintHelper = new MogoSkinCompatBackgroundHelperDelegate(this);
mBackgroundTintHelper.loadFromAttributes(attrs, defStyleAttr);
}
private void initView(Context context) {
@@ -282,6 +288,8 @@ public class V2XLiveGSYVideoView extends RoundLayout implements IMogoSkinCompatS
@Override
public void applySkin() {
if (mBackgroundTintHelper != null) {
mBackgroundTintHelper.applySkin();
}
}
}

View File

@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
android:background="@drawable/v2x_alert_window_bg">
<com.mogo.module.v2x.view.V2XLiveGSYVideoView
android:id="@+id/videoPlayer"

View File

@@ -6,52 +6,44 @@
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_event_window_height">
<androidx.cardview.widget.CardView
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvRoadEventList"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:cardBackgroundColor="#FFFFFF"
app:cardCornerRadius="12px"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="wrap_content"
android:orientation="horizontal"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_v2x_live_video" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvRoadEventList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:listitem="@layout/item_v2x_live_video" />
<TextView
android:id="@+id/tvEventStubClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_20"
android:background="@drawable/bg_count_down"
android:paddingLeft="@dimen/dp_12"
android:paddingTop="@dimen/dp_3"
android:paddingRight="@dimen/dp_12"
android:paddingBottom="@dimen/dp_3"
android:text="30s"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_30"
app:layout_constraintStart_toStartOf="@+id/rvRoadEventList"
app:layout_constraintTop_toTopOf="@+id/rvRoadEventList" />
<TextView
android:id="@+id/tvEventStubClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_20"
android:background="@drawable/bg_count_down"
android:paddingLeft="@dimen/dp_12"
android:paddingTop="@dimen/dp_3"
android:paddingRight="@dimen/dp_12"
android:paddingBottom="@dimen/dp_3"
android:text="30s"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_30"
app:layout_constraintStart_toStartOf="@+id/rvRoadEventList"
app:layout_constraintTop_toTopOf="@+id/rvRoadEventList" />
<ImageView
android:layout_width="@dimen/dp_130"
android:layout_height="@dimen/dp_46"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_28"
android:layout_marginEnd="@dimen/dp_28"
android:src="@drawable/v2x_icon_event_live_top"
app:layout_constraintEnd_toEndOf="@+id/rvRoadEventList"
app:layout_constraintTop_toTopOf="@+id/rvRoadEventList" />
</androidx.cardview.widget.CardView>
<ImageView
android:layout_width="@dimen/dp_130"
android:layout_height="@dimen/dp_46"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/dp_28"
android:layout_marginEnd="@dimen/dp_28"
android:src="@drawable/v2x_icon_event_live_top"
app:layout_constraintEnd_toEndOf="@+id/rvRoadEventList"
app:layout_constraintTop_toTopOf="@+id/rvRoadEventList" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -15,7 +15,10 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_154"
android:gravity="center_vertical"
android:orientation="horizontal">
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RadioButton
android:id="@+id/rbScenarioHistory"

View File

@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_event_window_height"
android:background="@drawable/v2x_alert_window_bg">
>
<com.tencent.rtmp.ui.TXCloudVideoView
android:id="@+id/txcVideoView"