diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java index 91948e0e15..f34de46914 100644 --- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java +++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/SchemeIntent.java @@ -39,6 +39,8 @@ public class SchemeIntent implements IMogoStatusChangedListener { public static final String TYPE_SHOW_ONLINE_CAR_PANEL = "showOnlineCarPanel"; public static final String TYPE_SHOW_SHARE_PANEL = "showSharePanel"; + public static final String TYPE_SHOW_HISTORY_PANEL = "showHistoryPanel"; + public static final String TYPE_SHOW_SURROUNDING_PANEL = "showSurroundingPanel"; private IMogoServiceApis mApis; private Context mContext; @@ -49,7 +51,7 @@ public class SchemeIntent implements IMogoStatusChangedListener { public Intent mIntent; public long mDelay = 0L; - public IntentWrapper( Intent intent, long delay ) { + public IntentWrapper(Intent intent, long delay) { this.mIntent = intent; this.mDelay = delay; } @@ -61,9 +63,9 @@ public class SchemeIntent implements IMogoStatusChangedListener { } public static SchemeIntent getInstance() { - if ( sInstance == null ) { - synchronized ( SchemeIntent.class ) { - if ( sInstance == null ) { + if (sInstance == null) { + synchronized (SchemeIntent.class) { + if (sInstance == null) { sInstance = new SchemeIntent(); } } @@ -75,14 +77,14 @@ public class SchemeIntent implements IMogoStatusChangedListener { sInstance = null; } - public void init( Context context, IMogoServiceApis apis ) { + public void init(Context context, IMogoServiceApis apis) { mContext = context; mApis = apis; - mApis.getStatusManagerApi().registerStatusChangedListener( TAG, StatusDescriptor.MAIN_PAGE_RESUME, this ); + mApis.getStatusManagerApi().registerStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this); } public void clear() { - mApis.getStatusManagerApi().unregisterStatusChangedListener( TAG, StatusDescriptor.MAIN_PAGE_RESUME, this ); + mApis.getStatusManagerApi().unregisterStatusChangedListener(TAG, StatusDescriptor.MAIN_PAGE_RESUME, this); mContext = null; mApis = null; @@ -90,38 +92,39 @@ public class SchemeIntent implements IMogoStatusChangedListener { /** * 处理scheme - * @param intent 跳转的intent + * + * @param intent 跳转的intent * @param isOnNewIntent 根据这个参数判断是从onCreate过来还是从onNewIntent过来,从而可以在{@link #isDelay(Intent, boolean)}里面确定延时逻辑,如果是从onNewIntent过来是不需要延时的 */ - public void handle( Intent intent, boolean isOnNewIntent ) { - if ( intent == null || intent.getData() == null ) { + public void handle(Intent intent, boolean isOnNewIntent) { + if (intent == null || intent.getData() == null) { return; } Uri target = intent.getData(); String path = target.getPath(); - if ( path == null || path.isEmpty() ) { + if (path == null || path.isEmpty()) { return; } - if ( !mApis.getStatusManagerApi().isMainPageOnResume() ) { + if (!mApis.getStatusManagerApi().isMainPageOnResume()) { long delay = 0L; - if ( isDelay( intent, isOnNewIntent ) ) { + if (isDelay(intent, isOnNewIntent)) { delay = 5_000L; } - mNextIntent = new IntentWrapper( intent, delay ); - mApis.getLauncherApi().backToLauncher( mContext ); + mNextIntent = new IntentWrapper(intent, delay); + mApis.getLauncherApi().backToLauncher(mContext); return; } - switch ( path ) { + switch (path) { case "/main/switch2": - handleSwitch2Action( target ); + handleSwitch2Action(target); break; case "/main/share": - Logger.d( TAG, "收到打开分享框的scheme,准备打开分享框" ); - Map< String, Object > properties = new HashMap<>(); - properties.put( "from", "1" ); - mApis.getAnalyticsApi().track( "v2x_share_click", properties ); + Logger.d(TAG, "收到打开分享框的scheme,准备打开分享框"); + Map properties = new HashMap<>(); + properties.put("from", "1"); + mApis.getAnalyticsApi().track("v2x_share_click", properties); mApis.getShareManager().showShareDialog(); break; default: @@ -132,34 +135,38 @@ public class SchemeIntent implements IMogoStatusChangedListener { mNextIntent = null; } - private boolean isDelay(Intent intent, boolean isOnNewIntent ) { - if ( isOnNewIntent || intent == null || intent.getData() == null ) { + private boolean isDelay(Intent intent, boolean isOnNewIntent) { + if (isOnNewIntent || intent == null || intent.getData() == null) { return false; } Uri target = intent.getData(); - String type = target.getQueryParameter( "type" ); + String type = target.getQueryParameter("type"); return TextUtils.equals(TYPE_NAVI, type) || TextUtils.equals(TYPE_SHOW_SHARE_PANEL, type); } - private void handleSwitch2Action( Uri target ) { - String type = target.getQueryParameter( "type" ); - if ( TextUtils.isEmpty( type ) ) { + private void handleSwitch2Action(Uri target) { + String type = target.getQueryParameter("type"); + if (TextUtils.isEmpty(type)) { return; } - switch ( type ) { + switch (type) { case TYPE_NAVI: - handleNaviIntent( target ); + handleNaviIntent(target); break; case TYPE_LAUNCH: - handleLaunchIntent( target ); + handleLaunchIntent(target); break; case TYPE_SEARCH_ROAD_CONDITION: - handleSearchRoadCondition( target ); + handleSearchRoadCondition(target); break; case TYPE_SHOW_ONLINE_CAR_PANEL: - handleShowOnlineCarPanel( target ); + handleShowOnlineCarPanel(target); + case TYPE_SHOW_HISTORY_PANEL: + handleShowSharePanel(0); + case TYPE_SHOW_SURROUNDING_PANEL: + handleShowSharePanel(1); case TYPE_SHOW_SHARE_PANEL: - handleShowSharePanel(); + handleShowSharePanel(2); break; default: break; @@ -167,71 +174,71 @@ public class SchemeIntent implements IMogoStatusChangedListener { } } - private void handleSearchRoadCondition( Uri target ) { - if ( mApis == null ) { + private void handleSearchRoadCondition(Uri target) { + if (mApis == null) { return; } - Log.d("TanluManager", "handleSearchRoadCondition intentStr =" + target.getQueryParameter( "intentStr" ) + ">> data = " + target.getQueryParameter( "data" ) - + "-----city = " + target.getQueryParameter( "city" ) + "----keywords = " + target.getQueryParameter( "keywords" )); - mApis.getTanluUiApi().searchRoadCondition( target.getQueryParameter( "intentStr" ), - target.getQueryParameter( "data" ), target.getQueryParameter( "city" ), - target.getQueryParameter( "keywords" ) ); + Log.d("TanluManager", "handleSearchRoadCondition intentStr =" + target.getQueryParameter("intentStr") + ">> data = " + target.getQueryParameter("data") + + "-----city = " + target.getQueryParameter("city") + "----keywords = " + target.getQueryParameter("keywords")); + mApis.getTanluUiApi().searchRoadCondition(target.getQueryParameter("intentStr"), + target.getQueryParameter("data"), target.getQueryParameter("city"), + target.getQueryParameter("keywords")); } - private void handleNaviIntent( Uri naviUri ) { - if ( mApis == null ) { + private void handleNaviIntent(Uri naviUri) { + if (mApis == null) { return; } - String lon = naviUri.getQueryParameter( "lon" ); - String lat = naviUri.getQueryParameter( "lat" ); + String lon = naviUri.getQueryParameter("lon"); + String lat = naviUri.getQueryParameter("lat"); try { - double dlon = Double.valueOf( lon ); - double dlat = Double.valueOf( lat ); - if ( mApis.getMapServiceApi().getNavi( mContext ).isNaviing() ) { - mApis.getMapServiceApi().getNavi( mContext ).naviTo( new MogoLatLng( dlat, dlon ) ); + double dlon = Double.valueOf(lon); + double dlat = Double.valueOf(lat); + if (mApis.getMapServiceApi().getNavi(mContext).isNaviing()) { + mApis.getMapServiceApi().getNavi(mContext).naviTo(new MogoLatLng(dlat, dlon)); } else { - mApis.getSearchManagerApi().calculatePath( new MogoLatLng( dlat, dlon ) ); + mApis.getSearchManagerApi().calculatePath(new MogoLatLng(dlat, dlon)); } - } catch ( Exception e ) { - TipToast.shortTip( "目的地异常,不能导航" ); - Logger.e( TAG, e, "error." ); + } catch (Exception e) { + TipToast.shortTip("目的地异常,不能导航"); + Logger.e(TAG, e, "error."); } } - private void handleLaunchIntent( Uri uri ) { - String type = uri.getQueryParameter( "channelType" ); - Map< String, Object > properties = new HashMap<>(); - properties.put( "appname", CommonUtils.getAppName( mContext ) ); - properties.put( "appversion", CommonUtils.getVersionName( mContext ) ); - properties.put( "from", type ); - mApis.getAnalyticsApi().track( "appenterfront", properties ); + private void handleLaunchIntent(Uri uri) { + String type = uri.getQueryParameter("channelType"); + Map properties = new HashMap<>(); + properties.put("appname", CommonUtils.getAppName(mContext)); + properties.put("appversion", CommonUtils.getVersionName(mContext)); + properties.put("from", type); + mApis.getAnalyticsApi().track("appenterfront", properties); } - private void handleShowOnlineCarPanel( Uri uri ) { + private void handleShowOnlineCarPanel(Uri uri) { mApis.getOnlineCarPanelApi().showPanel(); } - private void handleShowSharePanel() { + private void handleShowSharePanel(int item) { Logger.d(TAG, "handleShowSharePanel"); // todo 跳转到热心指数 - mApis.getEventPanelManager().showPanelWithSelectedItem(2); + mApis.getEventPanelManager().showPanelWithSelectedItem(item); } @Override - public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) { - if ( descriptor == StatusDescriptor.MAIN_PAGE_RESUME ) { - if ( mNextIntent == null ) { + public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) { + if (descriptor == StatusDescriptor.MAIN_PAGE_RESUME) { + if (mNextIntent == null) { return; } - if ( isTrue ) { + if (isTrue) { // 保证回到桌面后在开始该规划路线。 - UiThreadHandler.postDelayed( () -> { - if ( mNextIntent == null ) { + UiThreadHandler.postDelayed(() -> { + if (mNextIntent == null) { return; } - handle( mNextIntent.mIntent, false ); - }, mNextIntent.mDelay ); + handle(mNextIntent.mIntent, false); + }, mNextIntent.mDelay); } } } diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeConst.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeConst.java index fd85c4e3f7..bf9e1b2643 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeConst.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeConst.java @@ -37,6 +37,14 @@ public class GlobalUnwakeConst { */ public static final String UNWAKE_UPLOAD_REAL_TIME_TRAFFIC = "command_upload_real_time_traffic"; + /** + * 唤醒词查询出行动态 + */ + public static final String VOICE_QUERY_HISTORY_INDEX = "com.zhidao.query.history"; + /** + * 唤醒词查询周边事件 + */ + public static final String VOICE_QUERY_SURROUNDING_INDEX = "com.zhidao.query.surrounding"; /** * 唤醒词查询热心指数 */ diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeManager.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeManager.java index 97c26a9ab8..f392b4bbce 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeManager.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/unwake/GlobalUnwakeManager.java @@ -23,6 +23,8 @@ import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_PUB_ROA import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_PUB_TROUBLE_HELP; import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_CMD_SHARE_DIALOG_CLOSE; import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HEART_INDEX; +import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_HISTORY_INDEX; +import static com.mogo.module.service.unwake.GlobalUnwakeConst.VOICE_QUERY_SURROUNDING_INDEX; /** * 全局免唤醒管理 @@ -48,6 +50,8 @@ public class GlobalUnwakeManager implements IProvider, IMogoIntentListener, IMog intentManager.registerIntentListener(VOICE_CMD_NO_REPLY_SHARE_DIALOG_CLOSE, this); intentManager.registerIntentListener(UNWAKE_UPLOAD_ROAD_CONDITION, this); intentManager.registerIntentListener(VOICE_QUERY_HEART_INDEX, this); + intentManager.registerIntentListener(VOICE_QUERY_HISTORY_INDEX, this); + intentManager.registerIntentListener(VOICE_QUERY_SURROUNDING_INDEX, this); // 免唤醒词注册,全局免唤醒 AIAssist.getInstance(context).registerUnWakeupCommand(UNWAKE_UPLOAD_REAL_TIME_TRAFFIC, diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt index bfac68cca6..b2119ea018 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt @@ -55,6 +55,7 @@ class V2XEventPanelFragment : MvpFragment { diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java index 525c4de03a..aa47d302ef 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java @@ -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(); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java index 066ed9fba2..9e0574e707 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java @@ -138,7 +138,7 @@ public class V2XShareEventsFragment extends MvpFragment 0) { + AIAssist.getInstance(V2XUtils.getApp()). + speakTTSVoice("为您找到周边以下事件请查看", null); + } else { + AIAssist.getInstance(V2XUtils.getApp()). + speakTTSVoice("周边5公里内无事件,试试对我说分享路况给其他车友吧", null); + } + } + + private Map getPoiTypeMap(List list) { Map mPoiTypeMarkers = new HashMap<>(); for (int i = 0; i < list.size(); i++) {