rc
This commit is contained in:
@@ -20,13 +20,6 @@ public class SpacesItemDecoration extends RecyclerView.ItemDecoration {
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view,
|
||||
RecyclerView parent, RecyclerView.State state) {
|
||||
outRect.left = space;
|
||||
outRect.right = space;
|
||||
outRect.bottom = space;
|
||||
|
||||
// Add top margin only for the first item to avoid double space between items
|
||||
if (parent.getChildPosition(view) == 0) {
|
||||
outRect.top = space;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,16 +87,16 @@ public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingVi
|
||||
// .into(mBgImageView);
|
||||
|
||||
mBgImageView.setBackgroundResource(getTypeRes(surroundingConstruction.getPoiType()));
|
||||
|
||||
RequestOptions requestOptions = new RequestOptions()
|
||||
.placeholder(R.drawable.v2x_icon_live_logo)
|
||||
.error(R.drawable.v2x_icon_live_logo)
|
||||
.fallback(R.drawable.v2x_icon_live_logo);
|
||||
Glide.with(mContext)
|
||||
.asBitmap()
|
||||
.load(getTypeSmallRes(surroundingConstruction.getPoiType()))
|
||||
.apply(requestOptions)
|
||||
.into(new SkinAbleBitmapTarget(mTypeImageView, requestOptions));
|
||||
mTypeImageView.setBackgroundResource(getTypeSmallRes(surroundingConstruction.getPoiType()));
|
||||
// RequestOptions requestOptions = new RequestOptions()
|
||||
// .placeholder(R.drawable.v2x_icon_live_logo)
|
||||
// .error(R.drawable.v2x_icon_live_logo)
|
||||
// .fallback(R.drawable.v2x_icon_live_logo);
|
||||
// Glide.with(mContext)
|
||||
// .asBitmap()
|
||||
// .load(getTypeSmallRes(surroundingConstruction.getPoiType()))
|
||||
// .apply(requestOptions)
|
||||
// .into(new SkinAbleBitmapTarget(mTypeImageView, requestOptions));
|
||||
|
||||
}
|
||||
|
||||
@@ -191,10 +191,10 @@ public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingVi
|
||||
typeName = "封路";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
typeName = "路面结冰";
|
||||
typeName = "道路结冰";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
typeName = "出现浓雾";
|
||||
typeName = "浓雾";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
typeName = "交通检查";
|
||||
@@ -203,10 +203,10 @@ public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingVi
|
||||
typeName = "交通事故";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
typeName = "道路拥堵";
|
||||
typeName = "拥堵";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
typeName = "道路施工";
|
||||
typeName = "施工";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PONDING:
|
||||
typeName = "道路积水";
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.mogo.module.v2x.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.Typeface
|
||||
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 +16,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 +41,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 +62,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 +71,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 +80,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 +103,75 @@ 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 -> {
|
||||
// 更改选中是否加粗
|
||||
mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
||||
mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
|
||||
TrackUtils.trackV2xHistoryEvent(2)
|
||||
vpEventPanel.setCurrentItem(0, false)
|
||||
mVpEventPanel?.setCurrentItem(0, false)
|
||||
}
|
||||
R.id.rbSurroundingEvent -> {
|
||||
// 更改选中是否加粗
|
||||
mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
||||
mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
|
||||
TrackUtils.trackV2xHistoryEvent(3)
|
||||
vpEventPanel.setCurrentItem(1, false)
|
||||
mVpEventPanel?.setCurrentItem(1, false)
|
||||
}
|
||||
R.id.rbShareEvents -> {
|
||||
// 更改选中是否加粗
|
||||
mRbScenarioHistory?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbSurroundingEvent?.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||
mRbShareEvents?.typeface = Typeface.defaultFromStyle(Typeface.BOLD)
|
||||
|
||||
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 +189,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 +209,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 +218,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
|
||||
fun isPanelShow(): Boolean {
|
||||
return clPanelContainer.visibility == View.VISIBLE
|
||||
return mClPanelContainer?.visibility == View.VISIBLE
|
||||
}
|
||||
|
||||
// 修改未处理消息
|
||||
|
||||
@@ -55,6 +55,7 @@ public class V2XScenarioHistoryFragment
|
||||
mEmptyView = findViewById(R.id.viewEmpty);
|
||||
mClHistoryList = findViewById(R.id.clHistoryList);
|
||||
mRecyclerView = findViewById(R.id.recyclerView);
|
||||
mRecyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.share_item_padding)));
|
||||
mV2XScenarioHistoryAdapter = new V2XScenarioHistoryAdapter(mV2XHistoryScenarioData);
|
||||
mRecyclerView.setAdapter(mV2XScenarioHistoryAdapter);
|
||||
mRecyclerView.addItemDecoration(new SpacesItemDecoration(14));
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.SpacesItemDecoration;
|
||||
import com.mogo.module.v2x.adapter.V2XShareEventAdapter;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventDescription;
|
||||
import com.mogo.module.v2x.entity.panel.V2XShareEventItem;
|
||||
@@ -61,6 +62,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
|
||||
private void initRecyclerView() {
|
||||
recyclerView = mRootView.findViewById(R.id.road_case_share_list);
|
||||
recyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.share_item_padding)));
|
||||
adapter = new V2XShareEventAdapter(getActivity(), dataArrayList, this);
|
||||
recyclerView.setAdapter(adapter);
|
||||
LinearLayoutManager linearLayoutManager =
|
||||
@@ -141,10 +143,11 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
//空白
|
||||
item.setViewType(V2XShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY);
|
||||
dataArrayList.add(item);
|
||||
int len = dataArrayList.size();
|
||||
} else {
|
||||
if (dataArrayList.size() > 0) {
|
||||
Object data = dataArrayList.get(dataArrayList.size() - 1);
|
||||
if (data instanceof V2XShareEventLoadMoreItem || data instanceof V2XShareEventLoadMoreItem) {
|
||||
if (data instanceof V2XShareEventLoadMoreItem) {
|
||||
dataArrayList.remove(dataArrayList.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,11 +106,11 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
mShareTv.setOnClickListener(this);
|
||||
mFreshTv.setOnClickListener(this);
|
||||
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
// mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2);
|
||||
int spacingInPixels = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_bottom_right_textsize);
|
||||
mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels));
|
||||
// int spacingInPixels = getContext().getResources().getDimensionPixelSize(R.dimen.module_v2x_surrounding_item_bottom_right_textsize);
|
||||
// mRecyclerView.addItemDecoration(new SurroundingMarginDecoration(spacingInPixels));
|
||||
mRecyclerView.setLayoutManager(layoutManage);
|
||||
|
||||
mAdapter = new V2XSurroundingAdapter(getActivity(), poiInfosList, this);
|
||||
|
||||
@@ -47,11 +47,6 @@ public class V2XShareNetworkModel {
|
||||
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
try {
|
||||
getShareIndex(callback);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
emitter.onNext("1");
|
||||
emitter.onComplete();
|
||||
}
|
||||
@@ -60,16 +55,10 @@ public class V2XShareNetworkModel {
|
||||
Observable<String> listObservable = Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override
|
||||
public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
try {
|
||||
getShareEventList(page, size, callback);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
emitter.onNext("2");
|
||||
emitter.onComplete();
|
||||
}
|
||||
});
|
||||
|
||||
indexObservable.flatMap(new Function<String, ObservableSource<?>>() {
|
||||
@Override
|
||||
public ObservableSource<?> apply(String s) throws Exception {
|
||||
@@ -82,12 +71,20 @@ public class V2XShareNetworkModel {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(Disposable d) {
|
||||
|
||||
try {
|
||||
getShareIndex(callback);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(Object o) {
|
||||
|
||||
try {
|
||||
getShareEventList(page, size, callback);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -135,7 +132,7 @@ public class V2XShareNetworkModel {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
if (callback != null){
|
||||
if (callback != null) {
|
||||
callback.onFail("网络异常,点击刷新重试");
|
||||
}
|
||||
}
|
||||
@@ -179,7 +176,7 @@ public class V2XShareNetworkModel {
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
if (callback != null){
|
||||
if (callback != null) {
|
||||
callback.onFail("网络异常,点击刷新重试");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,32 +5,32 @@ import com.mogo.module.v2x.R;
|
||||
|
||||
public class AnimationResources {
|
||||
public static final int loadingRes[] = {
|
||||
R.drawable.v_to_x_loading_car0000,
|
||||
R.drawable.v_to_x_loading_car0002,
|
||||
R.drawable.v_to_x_loading_car0004,
|
||||
R.drawable.v_to_x_loading_car0006,
|
||||
R.drawable.v_to_x_loading_car0008,
|
||||
R.drawable.v_to_x_loading_car0010,
|
||||
R.drawable.v_to_x_loading_car0012,
|
||||
R.drawable.v_to_x_loading_car0014,
|
||||
R.drawable.v_to_x_loading_car0016,
|
||||
R.drawable.v_to_x_loading_car0018,
|
||||
R.drawable.v_to_x_loading_car0020,
|
||||
R.drawable.v_to_x_loading_car0022,
|
||||
R.drawable.v_to_x_loading_car0024,
|
||||
R.drawable.v_to_x_loading_car0025,
|
||||
R.drawable.v_to_x_loading_car0027,
|
||||
R.drawable.v_to_x_loading_car0029,
|
||||
R.drawable.v_to_x_loading_car0031,
|
||||
R.drawable.v_to_x_loading_car0033,
|
||||
R.drawable.v_to_x_loading_car0035,
|
||||
R.drawable.v_to_x_loading_car0037,
|
||||
R.drawable.v_to_x_loading_car0039,
|
||||
R.drawable.v_to_x_loading_car0041,
|
||||
R.drawable.v_to_x_loading_car0043,
|
||||
R.drawable.v_to_x_loading_car0045,
|
||||
R.drawable.v_to_x_loading_car0047,
|
||||
R.drawable.v_to_x_loading_car0048,
|
||||
// R.drawable.v_to_x_loading_car0000,
|
||||
// R.drawable.v_to_x_loading_car0002,
|
||||
// R.drawable.v_to_x_loading_car0004,
|
||||
// R.drawable.v_to_x_loading_car0006,
|
||||
// R.drawable.v_to_x_loading_car0008,
|
||||
// R.drawable.v_to_x_loading_car0010,
|
||||
// R.drawable.v_to_x_loading_car0012,
|
||||
// R.drawable.v_to_x_loading_car0014,
|
||||
// R.drawable.v_to_x_loading_car0016,
|
||||
// R.drawable.v_to_x_loading_car0018,
|
||||
// R.drawable.v_to_x_loading_car0020,
|
||||
// R.drawable.v_to_x_loading_car0022,
|
||||
// R.drawable.v_to_x_loading_car0024,
|
||||
// R.drawable.v_to_x_loading_car0025,
|
||||
// R.drawable.v_to_x_loading_car0027,
|
||||
// R.drawable.v_to_x_loading_car0029,
|
||||
// R.drawable.v_to_x_loading_car0031,
|
||||
// R.drawable.v_to_x_loading_car0033,
|
||||
// R.drawable.v_to_x_loading_car0035,
|
||||
// R.drawable.v_to_x_loading_car0037,
|
||||
// R.drawable.v_to_x_loading_car0039,
|
||||
// R.drawable.v_to_x_loading_car0041,
|
||||
// R.drawable.v_to_x_loading_car0043,
|
||||
// R.drawable.v_to_x_loading_car0045,
|
||||
// R.drawable.v_to_x_loading_car0047,
|
||||
// R.drawable.v_to_x_loading_car0048,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -1,63 +1,71 @@
|
||||
package com.mogo.module.v2x.utils.animation;
|
||||
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.util.Log;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
public class V2XAnimationManager implements Animation {
|
||||
|
||||
private static final String TAG = "V2XAnimationManager";
|
||||
private ImageView targetImageView;
|
||||
private Animation delegate;
|
||||
private ProgressBar targetImageView;
|
||||
private boolean isStarted = false;
|
||||
|
||||
public void animationWithTarget(ImageView imageView, int[] resources, int duration) {
|
||||
targetImageView = imageView;
|
||||
ThreadPoolService.execute(() -> {
|
||||
final AnimationDrawable drawable = new AnimationDrawable();
|
||||
for (int i = 0; i < resources.length; i++) {
|
||||
drawable.setOneShot(false);
|
||||
drawable.addFrame(targetImageView.getResources().getDrawable(resources[i]), duration);
|
||||
private int mStartIndex = 0;
|
||||
|
||||
private final static int MSG_LOOP = 3004;
|
||||
private long INTERVAL = 100L;
|
||||
|
||||
private Handler mHandler = new Handler(Looper.getMainLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
switch (msg.what) {
|
||||
case MSG_LOOP:
|
||||
if (isStarted) {
|
||||
// targetImageView.setImageResource( AnimationResources.loadingRes[mStartIndex++ % AnimationResources.loadingRes.length] );
|
||||
mHandler.sendEmptyMessageDelayed(MSG_LOOP, INTERVAL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
UiThreadHandler.post(() -> {
|
||||
targetImageView.setBackground(drawable);
|
||||
delegate = new DelegateDrawable(drawable);
|
||||
start();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
public void animationWithTarget(ProgressBar imageView, int[] resources, int duration) {
|
||||
targetImageView = imageView;
|
||||
INTERVAL = duration;
|
||||
start();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void start() {
|
||||
if (delegate != null && !isStarted) {
|
||||
isStarted = true;
|
||||
mHandler.sendEmptyMessage(MSG_LOOP);
|
||||
if (targetImageView != null) {
|
||||
targetImageView.setVisibility(View.VISIBLE);
|
||||
isStarted = true;
|
||||
delegate.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
synchronized public void stop() {
|
||||
if (delegate != null && isStarted) {
|
||||
isStarted = false;
|
||||
delegate.stop();
|
||||
isStarted = false;
|
||||
mHandler.removeMessages(MSG_LOOP);
|
||||
if (targetImageView != null) {
|
||||
targetImageView.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void soptWithError(){
|
||||
if (delegate != null && isStarted) {
|
||||
isStarted = false;
|
||||
delegate.stop();
|
||||
public void soptWithError() {
|
||||
stop();
|
||||
if (targetImageView != null) {
|
||||
targetImageView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
delegate = null;
|
||||
stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -17,7 +18,7 @@ import com.mogo.module.v2x.utils.animation.V2XAnimationManager;
|
||||
|
||||
public class V2XNetworkLoadingView extends RelativeLayout {
|
||||
|
||||
private ImageView loadView;
|
||||
private ProgressBar loadView;
|
||||
private TextView textView;
|
||||
private V2XAnimationManager v2XAnimationManager;
|
||||
public Button refresButton;
|
||||
@@ -32,6 +33,9 @@ public class V2XNetworkLoadingView extends RelativeLayout {
|
||||
super(context, attrs);
|
||||
LayoutInflater.from(context).inflate(R.layout.v2x_network_loading_item, this);
|
||||
initView();
|
||||
/*
|
||||
添加动画图片资源
|
||||
* */
|
||||
setLoadingImage(AnimationResources.loadingRes);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user