This commit is contained in:
unknown
2020-12-01 15:35:25 +08:00
27 changed files with 112 additions and 36 deletions

View File

@@ -2,6 +2,7 @@ package com.zhidao.roadcondition.service
import com.mogo.commons.AbsMogoApplication
import com.zhidao.auto.platform.voice.VoiceClient
import java.lang.Exception
/**
* @description 声音控制类
@@ -45,7 +46,11 @@ object VoiceController {
* @param customType 命令
*/
fun unRegisterCustomWakeupCmd(customType: String) {
voiceClient.unRegisterCustomWakeupCmd(customType)
try {
voiceClient.unRegisterCustomWakeupCmd(customType)
} catch (e:Exception){
}
}
/**

View File

@@ -4,11 +4,9 @@ import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import com.mogo.module.service.ServiceConst;
import com.mogo.utils.LaunchUtils;
import com.mogo.utils.TipToast;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
@@ -25,7 +23,7 @@ public class AppOperationIntentHandler implements IntentHandler {
public final Map< String, String > sAppPackages = new HashMap<>();
public AppOperationIntentHandler() {
sAppPackages.put( "车聊聊", "com.zhidao.imdemo" );
// sAppPackages.put( "车聊聊", "com.zhidao.imdemo" );
}
@Override

View File

@@ -189,13 +189,13 @@ public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.View
public shareEmptyViewHolder(@NonNull View itemView) {
super(itemView);
Button shareBtn = itemView.findViewById(R.id.share_event_button);
shareBtn.setOnClickListener(view -> {
TextView share = itemView.findViewById(R.id.share_event_button);
share.setOnClickListener(view -> {
V2XEventPanelFragment.Companion.getInstance().hidePanel();
mApis.getShareManager().showShareDialog();
});
Button refresh = itemView.findViewById(R.id.refresh_button);
TextView refresh = itemView.findViewById(R.id.refresh_button);
refresh.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View File

@@ -16,6 +16,7 @@ import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.adapter.holder.V2XSurroundingDetailVH;
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
import com.mogo.module.v2x.listener.SurroundingDetailItemListener;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.view.HeartLikeView;
import com.mogo.module.v2x.view.HeartUnLikeView;
@@ -39,10 +40,12 @@ public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroun
private HeartLikeView mHeartLikeView;
private HeartUnLikeView mUnHeartLikeView;
private SurroundingDetailItemListener mListener;
public V2XSurroundingDetailAdapter(Context context, List<MarkerExploreWay> list) {
public V2XSurroundingDetailAdapter(Context context, List<MarkerExploreWay> list, SurroundingDetailItemListener listener) {
mContext = context;
markerExploreWays = list;
mListener = listener;
}
@Override
@@ -77,18 +80,19 @@ public class V2XSurroundingDetailAdapter extends RecyclerView.Adapter<V2XSurroun
mAddressTv.setText(exploreWay.getAddr());
mTimeTv.setText(DateTimeUtils.getTimeText(exploreWay.getGenerateTime(), DateTimeUtils.MM_Yue_dd_Ri_HH_mm));
Logger.d(V2XConst.MODULE_NAME, "exploreWay.isFabulous() = " + exploreWay.isFabulous());
showView(exploreWay.isFabulous());
mHeartLikeView.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用 position = " + position);
roadReportTrue(exploreWay);
showView(true);
mListener.onItemClickListener(v, position, exploreWay);
});
mUnHeartLikeView.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用 position = " + position);
roadReportErr(exploreWay);
showView(true);
mListener.onItemClickListener(v, position, exploreWay);
});
}

View File

@@ -32,6 +32,7 @@ import com.mogo.module.v2x.adapter.V2XEventPagerAdapter
import com.mogo.module.v2x.adapter.V2XSurroundingDetailAdapter
import com.mogo.module.v2x.entity.panel.BackRefreshInfo
import com.mogo.module.v2x.entity.panel.SurroundingConstruction
import com.mogo.module.v2x.listener.SurroundingDetailItemListener
import com.mogo.module.v2x.presenter.EventPanelPresenter
import com.mogo.module.v2x.utils.TrackUtils
import com.mogo.module.v2x.view.V2XEventPanelHistoryCountView
@@ -49,7 +50,7 @@ import org.greenrobot.eventbus.ThreadMode
*
* @author tongchenfei
*/
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>() {
class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPresenter>() , SurroundingDetailItemListener {
private val TAG = "EventPanelFragment"
@@ -267,10 +268,14 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
selectWithItem(item)
}
override fun onItemClickListener(v: View?, position: Int, exploreWay: MarkerExploreWay?) {
markerExploreWays[position].isFabulous = true
mSurroundingDetailAdapter.notifyItemChanged(position)
}
private fun initDetail() {
mDetailRecyclerView!!.addItemDecoration(SpacesItemDecoration(resources.getDimension(R.dimen.share_item_padding).toInt()))
mSurroundingDetailAdapter = V2XSurroundingDetailAdapter(activity, markerExploreWays)
mSurroundingDetailAdapter = V2XSurroundingDetailAdapter(activity, markerExploreWays, this)
mDetailRecyclerView!!.adapter = mSurroundingDetailAdapter
val linearLayoutManager = LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false)
mDetailRecyclerView!!.layoutManager = linearLayoutManager

View File

@@ -198,6 +198,8 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
spannableString.setSpan(new StyleSpan(Typeface.BOLD), 7,
originStr.length() - 5, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTotalTv.setText(spannableString);
ttsForSurroundingFirstToday(exploreWayList.size());
} else {
mTopLayout.setVisibility(View.GONE);
mRecyclerView.setVisibility(View.GONE);
@@ -207,19 +209,19 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
ttsForVoiceCheckout();
fromVoice = false;
}
ttsForSurroundingFirstToday();
}
/*
/**
* 手动点击周边事件 TTS播报
* */
private void ttsForSurroundingFirstToday() {
*/
private void ttsForSurroundingFirstToday(int eventCount) {
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SURROUNDING_SELECTED");
if (hasBroadTts == false) {
if (poiInfosList.size() > 0) {
if (!hasBroadTts) {
if (eventCount > 0) {
AIAssist.getInstance(V2XUtils.getApp()).
speakTTSVoice("发现周边" + poiInfosList.size() + "条交通信息", null);
speakTTSVoice("发现周边" + eventCount + "条交通信息", null);
} else {
Logger.e(TAG,"周边没有发现交通信息");
}
}
}

View File

@@ -0,0 +1,15 @@
package com.mogo.module.v2x.listener;
import android.view.View;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.v2x.entity.panel.SurroundingConstruction;
/**
* @author lixiaopeng
* @description
* @since 2020/8/10
*/
public interface SurroundingDetailItemListener {
void onItemClickListener(View v, int position, MarkerExploreWay exploreWay);
}

View File

@@ -21,8 +21,8 @@ public class V2XListEmptyView extends LinearLayout {
private ImageView mIvEmptyView;
private TextView mTvTrip;
private Button mBtnShear;
private Button mBtnRefresh;
private TextView mBtnShear;
private TextView mBtnRefresh;
private OnControlListener mOnControlListener;

View File

@@ -31,7 +31,7 @@
android:layout_marginTop="@dimen/share_empty_btn_padding"
android:paddingBottom="@dimen/dp_10">
<Button
<TextView
android:id="@+id/share_event_button"
android:layout_width="@dimen/v2x_share_btn_width"
android:layout_height="@dimen/v2x_share_btn_height"
@@ -51,7 +51,7 @@
android:layout_height="@dimen/share_btn_middle_padding"
android:layout_centerInParent="true" />
<Button
<TextView
android:id="@+id/refresh_button"
android:layout_width="@dimen/v2x_share_btn_width"
android:layout_height="@dimen/v2x_share_btn_height"

View File

@@ -30,7 +30,7 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivEmptyView" />
<Button
<TextView
android:id="@+id/btnShear"
android:layout_width="@dimen/v2x_share_btn_width"
android:layout_height="@dimen/v2x_share_btn_height"
@@ -38,13 +38,13 @@
android:background="@drawable/bg_v2x_go_to_share"
android:gravity="center"
android:text="去分享"
android:textColor="#FFFFFF"
android:textColor="@color/v2x_FFF_333"
android:textSize="@dimen/dp_36"
app:layout_constraintEnd_toStartOf="@+id/btnRefresh"
app:layout_constraintStart_toStartOf="@+id/ivEmptyView"
app:layout_constraintTop_toBottomOf="@+id/tvTrip" />
<Button
<TextView
android:id="@+id/btnRefresh"
android:layout_width="@dimen/v2x_share_btn_width"
android:layout_height="@dimen/v2x_share_btn_height"

View File

@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="45"
android:endColor="#E6E6E6"
android:startColor="#DDDDDD" />
<corners android:radius="@dimen/dp_16" />
</shape>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/module_callchatting_user_pop_call_bg_normal_light" android:state_pressed="false" />
<item android:drawable="@drawable/module_callchatting_user_pop_call_bg_pressed_light" android:state_pressed="true" />
</selector>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_16" />
<gradient
android:angle="0"
android:endColor="#E6E6E6"
android:startColor="#DDDDDD" />
</shape>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_16" />
<gradient
android:angle="0"
android:endColor="#CBCBCB"
android:startColor="#C0C0C0" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_30" />
<solid android:color="#F5F5F5" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/module_carchatting_team_fragment_close_normal_light" android:state_pressed="false" />
<item android:drawable="@drawable/module_carchatting_team_fragment_close_pressed_light" android:state_pressed="true" />
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_30" />
<gradient
android:angle="180"
android:endColor="#F5F5F5"
android:startColor="#FFFFFF" />
</shape>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/dp_23" />
<solid android:color="#DADADA" />
</shape>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -45,7 +45,10 @@ class ZhiTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
Logger.d( TAG, "release" );
if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
for ( String cmd : mCmdMap.keySet() ) {
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
try {
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
} catch ( Exception e ) {
}
}
}
mQAndAMap.clear();
@@ -314,7 +317,10 @@ class ZhiTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
*/
public synchronized void unregisterUnWakeupCommand( String cmd ) {
mCmdMap.remove( cmd );
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
try {
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
} catch ( Exception e ) {
}
mCacheUnWakeupCommands.remove( cmd );
}
@@ -331,7 +337,10 @@ class ZhiTTS implements IMogoTTS, VoiceClient.VoiceCmdCallBack, OnTtsListener {
}
if ( callBacks.isEmpty() ) {
mCmdMap.remove( cmd );
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
try {
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
} catch ( Exception e ) {
}
mCacheUnWakeupCommands.remove( cmd );
}
}