Merge branch 'jo' into dev
This commit is contained in:
@@ -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<String, Object> 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<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 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
/**
|
||||
* 唤醒词查询热心指数
|
||||
*/
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -55,6 +55,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
|
||||
private val mV2XScenarioHistoryFragment = V2XScenarioHistoryFragment()
|
||||
private val mV2XShareEventsFragment = V2XShareEventsFragment()
|
||||
private val mV2XSurroundingFragment = V2XSurroundingFragment()
|
||||
|
||||
companion object {
|
||||
private var fragment: V2XEventPanelFragment? = null
|
||||
@@ -124,7 +125,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
|
||||
fragments = arrayOf(
|
||||
mV2XScenarioHistoryFragment,
|
||||
V2XSurroundingFragment(),
|
||||
mV2XSurroundingFragment,
|
||||
mV2XShareEventsFragment
|
||||
)
|
||||
//禁用预加载
|
||||
@@ -214,10 +215,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()
|
||||
@@ -225,6 +230,7 @@ class V2XEventPanelFragment : MvpFragment<V2XEventPanelFragment, EventPanelPrese
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun selectWithItem(item: Int) {
|
||||
when (item) {
|
||||
0 -> {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -224,7 +224,7 @@ public class V2XSurroundingFragment extends MvpFragment<SurroundingEventView, Su
|
||||
}
|
||||
|
||||
/*
|
||||
* 出行动态 TTS播报
|
||||
* 手动点击周边事件 TTS播报
|
||||
* */
|
||||
private void ttsForSurroundingFirstToday() {
|
||||
boolean hasBroadTts = V2XUtils.isFirstTodayWithKey("TTS_FOR_SURROUNDING_SELECTED");
|
||||
@@ -237,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++) {
|
||||
|
||||
Reference in New Issue
Block a user