merge
This commit is contained in:
@@ -10,11 +10,9 @@ import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.common.glide.SkinAbleBitmapTarget;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XSurroundingViewHolder;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
import com.mogo.module.v2x.listener.SurroundingItemClickListener;
|
||||
|
||||
@@ -76,7 +74,7 @@ public class V2XSurroundingAdapter extends RecyclerView.Adapter<V2XSurroundingVi
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mClickListener != null) {
|
||||
mClickListener.onItemClickListener(v, position, surroundingConstruction);
|
||||
mClickListener.onItemClickListener(v, position, surroundingConstruction, getTypeName(surroundingConstruction.getPoiType()));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.mogo.module.v2x.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.MarkerPoiTypeEnum;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XSurroundingDetailVH;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
import com.mogo.utils.DateTimeUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 周边详情
|
||||
* @since 2020/11/18
|
||||
*/
|
||||
public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroundingDetailVH> {
|
||||
private List<MarkerExploreWay> markerExploreWays;
|
||||
private Context mContext;
|
||||
private ImageView mTypeImageView;
|
||||
private TextView mTypeTv;
|
||||
private TextView mAddressTv;
|
||||
private TextView mTimeTv;
|
||||
|
||||
|
||||
public V2XSurroundingDetailAdapter(Context context, List<MarkerExploreWay> list) {
|
||||
mContext = context;
|
||||
markerExploreWays = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return super.getItemViewType(position);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public V2XSurroundingDetailVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View inflate = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.module_v2x_event_surrounding_detail_item, parent, false);
|
||||
return new V2XSurroundingDetailVH(inflate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull V2XSurroundingDetailVH holder, final int position) {
|
||||
final MarkerExploreWay exploreWay = markerExploreWays.get(position);
|
||||
if (exploreWay == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// mTypeImageView = holder.itemView.findViewById(R.id.iv_event_type);
|
||||
mTypeTv = holder.itemView.findViewById(R.id.surrounding_road_type);
|
||||
mAddressTv = holder.itemView.findViewById(R.id.surrounding_road_type_address);
|
||||
mTimeTv = holder.itemView.findViewById(R.id.surrounding_time);
|
||||
|
||||
mTypeTv.setText(getTypeName(exploreWay.getPoiType()));
|
||||
mAddressTv.setText(exploreWay.getAddr());
|
||||
mTimeTv.setText(DateTimeUtils.getTimeText(exploreWay.getGenerateTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm));
|
||||
|
||||
// mTypeImageView.setBackgroundResource(getTypeSmallRes(surroundingConstruction.getPoiType()));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return markerExploreWays == null ? 0 : markerExploreWays.size();
|
||||
}
|
||||
|
||||
private String getTypeName(String type) {
|
||||
String typeName = "";
|
||||
switch (type) {
|
||||
case MarkerPoiTypeEnum.ROAD_CLOSED:
|
||||
typeName = "封路";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ICE:
|
||||
typeName = "道路结冰";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_FOG:
|
||||
typeName = "浓雾";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.TRAFFIC_CHECK:
|
||||
typeName = "交通检查";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ACCIDENT:
|
||||
typeName = "交通事故";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
typeName = "拥堵";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
typeName = "施工";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_PONDING:
|
||||
typeName = "道路积水";
|
||||
break;
|
||||
case MarkerPoiTypeEnum.FOURS_LIVING:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
default:
|
||||
typeName = "实时路况";
|
||||
break;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
SpanUtils.with(mTvAddressDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("m")
|
||||
.append("米")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
}
|
||||
|
||||
@@ -181,14 +181,14 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
SpanUtils.with(tvDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance() / 1000)
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("km")
|
||||
.append("公里")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
} else {
|
||||
SpanUtils.with(tvDistance)
|
||||
.append("" + (int) mV2XPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("m")
|
||||
.append("米")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
}
|
||||
|
||||
@@ -230,7 +230,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
tvEventTypeTitle.setBackgroundResource(EventTypeUtils.getPoiTypeBg(mNoveltyInfo.getPoiType()));
|
||||
}
|
||||
tvEventAddress.setText(mNoveltyInfo.getAddr());
|
||||
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "M");
|
||||
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "米");
|
||||
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTimeInMillis(mNoveltyInfo.getGenerateTime());
|
||||
|
||||
@@ -90,14 +90,14 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHist
|
||||
SpanUtils.with(mTvFaultHelpDistance)
|
||||
.append("" + (int) xPushMessageEntity.getDistance() / 1000)
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("km")
|
||||
.append("公里")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
} else {
|
||||
SpanUtils.with(mTvFaultHelpDistance)
|
||||
.append("" + (int) xPushMessageEntity.getDistance())
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
|
||||
.append("m")
|
||||
.append("米")
|
||||
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
|
||||
.create();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/11/16
|
||||
*/
|
||||
public class V2XSurroundingDetailVH extends RecyclerView.ViewHolder{
|
||||
|
||||
public V2XSurroundingDetailVH(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.module.v2x.adapter;
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
@@ -12,20 +12,17 @@ import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
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.V2XEventPagerAdapter
|
||||
import com.mogo.module.v2x.presenter.EventPanelPresenter
|
||||
import com.mogo.module.v2x.utils.TrackUtils
|
||||
import com.mogo.module.v2x.utils.V2XUtils
|
||||
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 com.mogo.utils.storage.SharedPrefsMgr
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,10 +49,10 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
private var mRbScenarioHistory: RadioButton? = null
|
||||
private var mRbSurroundingEvent: RadioButton? = null
|
||||
private var mRbShareEvents: RadioButton? = null
|
||||
private var todayFirstForShared: String? = ""
|
||||
|
||||
private val mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
|
||||
private val mV2XShareEventsFragment = V2XShareEventsFragment()
|
||||
private val mV2XSurroundingFragment = V2XSurroundingFragment()
|
||||
|
||||
companion object {
|
||||
private var fragment: V2XEventPanelFragment? = null
|
||||
@@ -123,9 +120,15 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
mRbSurroundingEvent = mRootView.findViewById(R.id.rbSurroundingEvent)
|
||||
mRbShareEvents = mRootView.findViewById(R.id.rbShareEvents)
|
||||
|
||||
// M1 不基于地图的版本直接展示事件面板,且不可关闭
|
||||
if (!DebugConfig.isMapBased()) {
|
||||
mClPanelContainer?.visibility = View.VISIBLE
|
||||
mBtnHidePanels?.visibility = View.GONE
|
||||
}
|
||||
|
||||
fragments = arrayOf(
|
||||
mV2XScenarioHistoryFragment,
|
||||
V2XSurroundingFragment(),
|
||||
mV2XSurroundingFragment,
|
||||
mV2XShareEventsFragment
|
||||
)
|
||||
//禁用预加载
|
||||
@@ -215,10 +218,14 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
public fun showPanelWithSelectedItem(item: Int) {
|
||||
mV2XShareEventsFragment.fromVoice = true
|
||||
if (isPanelShow()) {
|
||||
if (mRbScenarioHistory?.isChecked == true) {
|
||||
mV2XScenarioHistoryFragment.ttsForVoiceCheckout()
|
||||
}
|
||||
if (mRbSurroundingEvent?.isChecked == true) {
|
||||
mV2XSurroundingFragment.ttsForVoiceCheckout()
|
||||
}
|
||||
if (mRbShareEvents?.isChecked == true) {
|
||||
mV2XShareEventsFragment.ttsForVoiceCheck()
|
||||
} else {
|
||||
selectWithItem(item)
|
||||
}
|
||||
} else {
|
||||
showPanel()
|
||||
@@ -226,6 +233,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun selectWithItem(item: Int) {
|
||||
when (item) {
|
||||
0 -> {
|
||||
@@ -255,11 +263,13 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
fun showPanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment show panel")
|
||||
mClPanelContainer?.visibility = View.VISIBLE
|
||||
if (DebugConfig.isMapBased()) {
|
||||
V2XVoiceManager.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP, mCloeEventCb)
|
||||
}
|
||||
// 注册语音交互
|
||||
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()
|
||||
@@ -273,13 +283,15 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
|
||||
fun hidePanel() {
|
||||
Logger.d(MODULE_NAME, "in fragment hide panel")
|
||||
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)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
|
||||
if (DebugConfig.isMapBased()) {
|
||||
Logger.d(MODULE_NAME, "in fragment hide panel")
|
||||
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)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_SHEAR_EVENT_UN_WAKEUP)
|
||||
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
|
||||
}
|
||||
}
|
||||
|
||||
fun isPanelShow(): Boolean {
|
||||
|
||||
@@ -134,7 +134,7 @@ public class V2XScenarioHistoryFragment
|
||||
}
|
||||
|
||||
/*
|
||||
* 出行动态 TTS播报
|
||||
* 手动点击出行动态 TTS播报
|
||||
* */
|
||||
private void ttsForHistoryFirstToday() {
|
||||
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_HISTORY_SELECTED");
|
||||
@@ -150,6 +150,19 @@ public class V2XScenarioHistoryFragment
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音查询出行动态 TTS播报
|
||||
* */
|
||||
public void ttsForVoiceCheckout(){
|
||||
if (mV2XHistoryScenarioData.size() > 0) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).
|
||||
speakTTSVoice("为您找到以下动态请查看", null);
|
||||
} else {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).
|
||||
speakTTSVoice("今天暂无出行动态,试试对我说分享拥堵给其他车友吧", null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@@ -138,7 +138,7 @@ public class V2XShareEventsFragment extends MvpFragment<V2XShareEventsFragment,
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音打开我的分享,进行播报
|
||||
* 语音打开我的分享,TTS播报
|
||||
* */
|
||||
public void ttsForVoiceCheck() {
|
||||
int shareNum = resultData.getResult().getEnthusiasmIndex().getShareNum();
|
||||
|
||||
@@ -15,12 +15,14 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
@@ -34,8 +36,11 @@ import com.mogo.module.common.entity.MarkerLocation;
|
||||
import com.mogo.module.common.entity.MarkerShowEntity;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.SpacesItemDecoration;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.adapter.V2XShareEventAdapter;
|
||||
import com.mogo.module.v2x.adapter.V2XSurroundingAdapter;
|
||||
import com.mogo.module.v2x.adapter.V2XSurroundingDetailAdapter;
|
||||
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
import com.mogo.module.v2x.listener.SurroundingItemClickListener;
|
||||
import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
|
||||
@@ -63,6 +68,7 @@ import static android.view.View.OVER_SCROLL_NEVER;
|
||||
public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, SurroundingEventPresenter> implements SurroundingEventView,
|
||||
View.OnClickListener, SurroundingItemClickListener {
|
||||
private static final String TAG = "SurroundingFragment";
|
||||
private RelativeLayout mSurroundingLayout;
|
||||
private RecyclerView mRecyclerView;
|
||||
private TextView mTotalTv;
|
||||
private RelativeLayout mTopLayout;
|
||||
@@ -76,10 +82,17 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
private IMogoServiceApis mApis;
|
||||
private NetworkLoadingView mloadingImage;
|
||||
|
||||
private RelativeLayout mSurroundingDetailLayout;
|
||||
private RecyclerView mDetailRecyclerView;
|
||||
private ImageView mBackImage;
|
||||
private TextView mBriefTv;
|
||||
private V2XSurroundingDetailAdapter mDetailAdapter;
|
||||
private List<MarkerExploreWay> markerExploreWays = new ArrayList<>();
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
Log.d(TAG, "getLayoutId --------> ");
|
||||
return R.layout.module_event_panel_fragment_surrounding;
|
||||
}
|
||||
|
||||
@@ -92,7 +105,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
Log.d(TAG, "initViews --------> ");
|
||||
mSurroundingLayout = findViewById(R.id.layout_surrounding_event);
|
||||
mRecyclerView = findViewById(R.id.surrounding_recycleview);
|
||||
mTotalTv = findViewById(R.id.tv_brief);
|
||||
mTopLayout = findViewById(R.id.layout_top);
|
||||
@@ -105,6 +118,13 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
mShareTv.setOnClickListener(this);
|
||||
mFreshTv.setOnClickListener(this);
|
||||
|
||||
mSurroundingDetailLayout = findViewById(R.id.layout_surrounding_event_detail);
|
||||
mDetailRecyclerView = findViewById(R.id.surrounding_detail_recycleview);
|
||||
mSurroundingDetailLayout.setVisibility(View.GONE);
|
||||
mBackImage = findViewById(R.id.back_image);
|
||||
mBriefTv = findViewById(R.id.tv_brief_detail);
|
||||
mBackImage.setOnClickListener(this);
|
||||
|
||||
// mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
|
||||
GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 2);
|
||||
@@ -120,6 +140,15 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
|
||||
}
|
||||
|
||||
private void initDetail() {
|
||||
mDetailRecyclerView.addItemDecoration(new SpacesItemDecoration((int) getResources().getDimension(R.dimen.share_item_padding)));
|
||||
mDetailAdapter = new V2XSurroundingDetailAdapter(getActivity(), markerExploreWays);
|
||||
mDetailRecyclerView.setAdapter(mDetailAdapter);
|
||||
LinearLayoutManager linearLayoutManager =
|
||||
new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
|
||||
mDetailRecyclerView.setLayoutManager(linearLayoutManager);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected SurroundingEventPresenter createPresenter() {
|
||||
@@ -132,8 +161,6 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
surroundingEventPresenter = new SurroundingEventPresenter(getContext(), this);
|
||||
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(getContext());
|
||||
|
||||
Log.d(TAG, "onViewCreated --------->");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -147,6 +174,8 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
}
|
||||
} else if (id == R.id.tv_main_refresh || id == R.id.tv_top_refresh) { //刷新
|
||||
initData();
|
||||
} else if (id == R.id.back_image) {
|
||||
showDetail(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,7 +224,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
}
|
||||
|
||||
/*
|
||||
* 出行动态 TTS播报
|
||||
* 手动点击周边事件 TTS播报
|
||||
* */
|
||||
private void ttsForSurroundingFirstToday() {
|
||||
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SURROUNDING_SELECTED");
|
||||
@@ -208,6 +237,20 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 语音查询周边事件 TTS播报
|
||||
* */
|
||||
public void ttsForVoiceCheckout(){
|
||||
if (poiInfosList.size() > 0) {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).
|
||||
speakTTSVoice("为您找到周边以下事件请查看", null);
|
||||
} else {
|
||||
AIAssist.getInstance(V2XUtils.getApp()).
|
||||
speakTTSVoice("周边5公里内无事件,试试对我说分享路况给其他车友吧", null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Map<String, SurroundingConstruction> getPoiTypeMap(List<MarkerExploreWay> list) {
|
||||
Map<String, SurroundingConstruction> mPoiTypeMarkers = new HashMap<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@@ -278,71 +321,99 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
return poiTypes;
|
||||
}
|
||||
|
||||
private void showDetail(boolean isShow) {
|
||||
if (isShow) {
|
||||
mSurroundingLayout.setVisibility(View.GONE);
|
||||
mSurroundingDetailLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mSurroundingDetailLayout.setVisibility(View.GONE);
|
||||
mSurroundingLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理marker的显示
|
||||
* 处理marker的显示 TODO
|
||||
*
|
||||
* @param v
|
||||
* @param position
|
||||
* @param construction
|
||||
*/
|
||||
@Override
|
||||
public void onItemClickListener(View v, int position, SurroundingConstruction construction) {
|
||||
public void onItemClickListener(View v, int position, SurroundingConstruction construction, String poiType) {
|
||||
showDetail(true);
|
||||
initDetail();
|
||||
if (construction != null) {
|
||||
//卡片消失
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
//清除道路事件
|
||||
V2XServiceManager.getMarkerManager().removeMarkers(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
//处理 marker的显示
|
||||
markerExploreWays.clear();
|
||||
markerExploreWays.addAll(construction.getConstrutList());
|
||||
mDetailAdapter.notifyDataSetChanged();
|
||||
|
||||
try {
|
||||
//处理 marker的显示
|
||||
List<MarkerExploreWay> exploreWayList = construction.getConstrutList();
|
||||
Logger.d(TAG, "onItemClickListener exploreWayList.size() = " + exploreWayList.size());
|
||||
if (exploreWayList != null && exploreWayList.size() > 0) {
|
||||
for (int i = 0; i < exploreWayList.size(); i++) {
|
||||
MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
markerShowEntity.setBindObj(exploreWay);
|
||||
markerShowEntity.setChecked(false);
|
||||
markerShowEntity.setTextContent(exploreWay.getAddr());
|
||||
markerShowEntity.setMarkerLocation(exploreWay.getLocation());
|
||||
markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
|
||||
WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
IMogoMarker mogoMarker = V2XServiceManager.getIMogoMarkerService().drawMarker(markerShowEntity);
|
||||
// 点击监听,天际弹窗展示详情
|
||||
if (mogoMarker != null) {
|
||||
mogoMarker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() {
|
||||
@Override
|
||||
public void onAnimStart() {
|
||||
Logger.d(TAG, " onItemClickListener onAnimStart -----> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAnimEnd() {
|
||||
if (mogoMarker.isDestroyed()) {
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, " onItemClickListener onAnimEnd ------> ");
|
||||
mogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null);
|
||||
}
|
||||
});
|
||||
mogoMarker.setOwner(markerShowEntity.getMarkerType());
|
||||
mogoMarker.setObject(markerShowEntity);
|
||||
}
|
||||
}, i * 100L);
|
||||
}
|
||||
|
||||
//自适应显示
|
||||
showBonndsRoadtion(exploreWayList);
|
||||
} else {
|
||||
Logger.e(TAG, "onItemClickListener exploreWayList == null");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String brief = String.format(getContext().getResources().getString(R.string.v2x_surrounding_detail_top_brief), markerExploreWays.size());
|
||||
mBriefTv.setText(brief + poiType);
|
||||
Logger.d(TAG, "onItemClickListener markerExploreWays.size() = " + markerExploreWays.size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public void onItemClickListener(View v, int position, SurroundingConstruction construction) {
|
||||
// if (construction != null) {
|
||||
// //卡片消失
|
||||
// V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
// //清除道路事件
|
||||
// V2XServiceManager.getMarkerManager().removeMarkers(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
//
|
||||
// try {
|
||||
// //处理 marker的显示
|
||||
// List<MarkerExploreWay> exploreWayList = construction.getConstrutList();
|
||||
// Logger.d(TAG, "onItemClickListener exploreWayList.size() = " + exploreWayList.size());
|
||||
// if (exploreWayList != null && exploreWayList.size() > 0) {
|
||||
// for (int i = 0; i < exploreWayList.size(); i++) {
|
||||
// MarkerExploreWay exploreWay = exploreWayList.get(i);
|
||||
// MarkerShowEntity markerShowEntity = new MarkerShowEntity();
|
||||
// markerShowEntity.setBindObj(exploreWay);
|
||||
// markerShowEntity.setChecked(false);
|
||||
// markerShowEntity.setTextContent(exploreWay.getAddr());
|
||||
// markerShowEntity.setMarkerLocation(exploreWay.getLocation());
|
||||
// markerShowEntity.setMarkerType(ServiceConst.CARD_TYPE_ROAD_CONDITION);
|
||||
//
|
||||
// WorkThreadHandler.getInstance().postDelayed(() -> {
|
||||
// IMogoMarker mogoMarker = V2XServiceManager.getIMogoMarkerService().drawMarker(markerShowEntity);
|
||||
// // 点击监听,天际弹窗展示详情
|
||||
// if (mogoMarker != null) {
|
||||
// mogoMarker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() {
|
||||
// @Override
|
||||
// public void onAnimStart() {
|
||||
// Logger.d(TAG, " onItemClickListener onAnimStart -----> ");
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onAnimEnd() {
|
||||
// if (mogoMarker.isDestroyed()) {
|
||||
// return;
|
||||
// }
|
||||
// Logger.d(TAG, " onItemClickListener onAnimEnd ------> ");
|
||||
// mogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null);
|
||||
// }
|
||||
// });
|
||||
// mogoMarker.setOwner(markerShowEntity.getMarkerType());
|
||||
// mogoMarker.setObject(markerShowEntity);
|
||||
// }
|
||||
// }, i * 100L);
|
||||
// }
|
||||
//
|
||||
// //自适应显示
|
||||
// showBonndsRoadtion(exploreWayList);
|
||||
// } else {
|
||||
// Logger.e(TAG, "onItemClickListener exploreWayList == null");
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 自适应显示
|
||||
*
|
||||
|
||||
@@ -10,5 +10,5 @@ import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
|
||||
* @since 2020/8/10
|
||||
*/
|
||||
public interface SurroundingItemClickListener {
|
||||
void onItemClickListener(View v, int position, SurroundingConstruction construction);
|
||||
void onItemClickListener(View v, int position, SurroundingConstruction construction, String poiType);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ import com.mogo.commons.debug.DebugConfig
|
||||
class HttpConstant {
|
||||
|
||||
companion object {
|
||||
const val HOST_DEV = "http://dzt-test.zhidaohulian.com"
|
||||
const val HOST_TEST = "http://dzt-test.zhidaohulian.com"
|
||||
const val HOST_DEMO = "http://dzt-show.zhidaohulian.com"
|
||||
const val HOST_PRODUCT = "https://dzt.zhidaohulian.com"
|
||||
const val HOST_DEV = "http://dzt-test.zhidaozhixing.com"
|
||||
const val HOST_TEST = "http://dzt-test.zhidaozhixing.com"
|
||||
const val HOST_DEMO = "http://dzt-show.zhidaozhixing.com"
|
||||
const val HOST_PRODUCT = "http://dzt.zhidaozhixing.com"
|
||||
|
||||
fun getNetHost(): String {
|
||||
return when (DebugConfig.getNetMode()) {
|
||||
|
||||
Reference in New Issue
Block a user