导航语音指令
This commit is contained in:
@@ -416,6 +416,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean checkAMapView() {
|
||||
if ( mMapView == null ) {
|
||||
Logger.e( TAG, "高德mapView实例为空,请检查" );
|
||||
|
||||
@@ -31,9 +31,9 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
public static AMapUIController getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( AMapUIController.class ) {
|
||||
if ( sInstance == null ) {
|
||||
if (sInstance == null) {
|
||||
synchronized (AMapUIController.class) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new AMapUIController();
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void initClient( IMogoMapUIController client ) {
|
||||
public void initClient(IMogoMapUIController client) {
|
||||
this.mClient = client;
|
||||
}
|
||||
|
||||
@@ -50,71 +50,71 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnabled( boolean visible ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setTrafficEnabled( visible );
|
||||
public void setTrafficEnabled(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.setTrafficEnabled(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom( boolean zoom ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeZoom( zoom );
|
||||
public void changeZoom(boolean zoom) {
|
||||
if (mClient != null) {
|
||||
mClient.changeZoom(zoom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeZoom( float zoom ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeZoom( zoom );
|
||||
public void changeZoom(float zoom) {
|
||||
if (mClient != null) {
|
||||
mClient.changeZoom(zoom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapMode( EnumMapUI mode ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.changeMapMode( mode );
|
||||
public void changeMapMode(EnumMapUI mode) {
|
||||
if (mClient != null) {
|
||||
mClient.changeMapMode(mode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter( MogoLatLng latLng ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.moveToCenter( latLng );
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
if (mClient != null) {
|
||||
mClient.moveToCenter(latLng);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation( boolean visible ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showMyLocation( visible );
|
||||
public void showMyLocation(boolean visible) {
|
||||
if (mClient != null) {
|
||||
mClient.showMyLocation(visible);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverLockMode() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.recoverLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.setLockZoom(var1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.displayOverview();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getScalePerPixel();
|
||||
}
|
||||
return 0;
|
||||
@@ -122,7 +122,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getZoomLevel();
|
||||
}
|
||||
return 0;
|
||||
@@ -130,7 +130,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraNorthEastPosition();
|
||||
}
|
||||
return null;
|
||||
@@ -138,66 +138,67 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getCameraSouthWestPosition();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public MogoLatLng getWindowCenterLocation() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
return mClient.getWindowCenterLocation();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setPointToCenter( mapCenterX, mapCenterY );
|
||||
public void setPointToCenter(double mapCenterX, double mapCenterY) {
|
||||
if (mClient != null) {
|
||||
mClient.setPointToCenter(mapCenterX, mapCenterY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getLocationPointInScreen( MogoLatLng latLng ) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getLocationPointInScreen( latLng );
|
||||
public Point getLocationPointInScreen(MogoLatLng latLng) {
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationPointInScreen(latLng);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getLocationMogoLatLngInScreen(Point point) {
|
||||
if ( mClient != null ) {
|
||||
return mClient.getLocationMogoLatLngInScreen( point );
|
||||
if (mClient != null) {
|
||||
return mClient.getLocationMogoLatLngInScreen(point);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator, long duration ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.startJumpAnimation( marker, high, interpolator, duration );
|
||||
public void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration) {
|
||||
if (mClient != null) {
|
||||
mClient.startJumpAnimation(marker, high, interpolator, duration);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderFps( int fps ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.setRenderFps( fps );
|
||||
public void setRenderFps(int fps) {
|
||||
if (mClient != null) {
|
||||
mClient.setRenderFps(fps);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds( List< MogoLatLng > lonLats, Rect bound ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showBounds( lonLats, bound );
|
||||
public void showBounds(List<MogoLatLng> lonLats, Rect bound) {
|
||||
if (mClient != null) {
|
||||
mClient.showBounds(lonLats, bound);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceRender() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.forceRender();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,43 +19,39 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 实时路况
|
||||
*
|
||||
* @param visible
|
||||
*/
|
||||
void setTrafficEnabled( boolean visible );
|
||||
void setTrafficEnabled(boolean visible);
|
||||
|
||||
/**
|
||||
* 地图缩放
|
||||
*
|
||||
* @param zoomIn true - 方法 false - 缩小
|
||||
*/
|
||||
void changeZoom( boolean zoomIn );
|
||||
void changeZoom(boolean zoomIn);
|
||||
|
||||
/**
|
||||
* 修改缩放级别
|
||||
*
|
||||
* @param zoom
|
||||
*/
|
||||
void changeZoom( float zoom );
|
||||
void changeZoom(float zoom);
|
||||
|
||||
/**
|
||||
* 切换2D/3D模式
|
||||
*
|
||||
* @param mode true - 3D模式 false - 2D模式
|
||||
*/
|
||||
void changeMapMode( EnumMapUI mode );
|
||||
void changeMapMode(EnumMapUI mode);
|
||||
|
||||
/**
|
||||
* 将地图移动至当前位置
|
||||
*/
|
||||
void moveToCenter( MogoLatLng latLng );
|
||||
void moveToCenter(MogoLatLng latLng);
|
||||
|
||||
/**
|
||||
* 显示我的位置
|
||||
*
|
||||
* @param visible true - 显示 false - 不显示
|
||||
*/
|
||||
void showMyLocation( boolean visible );
|
||||
void showMyLocation(boolean visible);
|
||||
|
||||
/**
|
||||
* 解锁锁车
|
||||
@@ -67,7 +63,7 @@ public interface IMogoMapUIController {
|
||||
*
|
||||
* @param var1 级别 3-20
|
||||
*/
|
||||
void setLockZoom( int var1 );
|
||||
void setLockZoom(int var1);
|
||||
|
||||
/**
|
||||
* 预览全程
|
||||
@@ -83,29 +79,21 @@ public interface IMogoMapUIController {
|
||||
|
||||
/**
|
||||
* 获取缩放比例
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getZoomLevel();
|
||||
|
||||
/**
|
||||
* 获取视图东北角坐标
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoLatLng getCameraNorthEastPosition();
|
||||
|
||||
/**
|
||||
* 获取视图西南角坐标
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoLatLng getCameraSouthWestPosition();
|
||||
|
||||
/**
|
||||
* 获取视图中心点坐标
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
MogoLatLng getWindowCenterLocation();
|
||||
|
||||
@@ -115,46 +103,39 @@ public interface IMogoMapUIController {
|
||||
* @param mapCenterX x 点位置x值与地图宽度的比例
|
||||
* @param mapCenterY y 点位置x值与地图高度的比例
|
||||
*/
|
||||
void setPointToCenter( double mapCenterX, double mapCenterY );
|
||||
void setPointToCenter(double mapCenterX, double mapCenterY);
|
||||
|
||||
/**
|
||||
* 获取经纬度对应的屏幕的位置
|
||||
*
|
||||
* @param latLng
|
||||
* @return
|
||||
*/
|
||||
Point getLocationPointInScreen( MogoLatLng latLng );
|
||||
Point getLocationPointInScreen(MogoLatLng latLng);
|
||||
|
||||
/**
|
||||
* 获取像素点对应的经纬度
|
||||
*
|
||||
* @param point
|
||||
* @return
|
||||
*/
|
||||
MogoLatLng getLocationMogoLatLngInScreen( Point point );
|
||||
MogoLatLng getLocationMogoLatLngInScreen(Point point);
|
||||
|
||||
/**
|
||||
* marker 跳跃动画
|
||||
*
|
||||
* @param marker 跳跃的 marker
|
||||
* @param high 跳跃的高度
|
||||
* @param marker 跳跃的 marker
|
||||
* @param high 跳跃的高度
|
||||
* @param interpolator 插值器
|
||||
* @param duration 动画时间
|
||||
* @param duration 动画时间
|
||||
*/
|
||||
void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator, long duration );
|
||||
void startJumpAnimation(IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration);
|
||||
|
||||
/**
|
||||
* 设置刷新帧率
|
||||
*
|
||||
* @param fps
|
||||
*/
|
||||
void setRenderFps( int fps );
|
||||
void setRenderFps(int fps);
|
||||
|
||||
/**
|
||||
* @param lonLats 经纬度围成的范围
|
||||
* @param bound 地图上可显示的范围
|
||||
* @param bound 地图上可显示的范围
|
||||
*/
|
||||
void showBounds( List< MogoLatLng > lonLats, Rect bound );
|
||||
void showBounds(List<MogoLatLng> lonLats, Rect bound);
|
||||
|
||||
/**
|
||||
* 强制刷新地图
|
||||
|
||||
@@ -70,6 +70,7 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void moveToCenter(MogoLatLng latLng) {
|
||||
if (mDelegate != null) {
|
||||
|
||||
@@ -91,7 +91,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
*/
|
||||
private IMogoModuleProvider mSearchProvider;
|
||||
private boolean mIsLock = true;
|
||||
private View ivMode;
|
||||
private TextView ivMode;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@@ -170,13 +170,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
ivMode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
if (ivMode.isSelected()) {
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
} else {
|
||||
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
|
||||
} else {
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
}
|
||||
ivMode.setSelected(!ivMode.isSelected());
|
||||
ivMode.setText(
|
||||
getString(ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up));
|
||||
}
|
||||
});
|
||||
|
||||
mSpeedLimit = findViewById(R.id.module_entrance_id_speed_limit_container);
|
||||
mSpeedLimitValue = findViewById(R.id.module_entrance_id_speed_limit_value);
|
||||
mSpeedLimitUnit = findViewById(R.id.module_entrance_id_speed_limit_unit);
|
||||
|
||||
BIN
modules/mogo-module-extensions/src/main/res/drawable-ldpi/icon_car_up.png
Executable file
BIN
modules/mogo-module-extensions/src/main/res/drawable-ldpi/icon_car_up.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 577 B |
BIN
modules/mogo-module-extensions/src/main/res/drawable-ldpi/icon_north_up.png
Executable file
BIN
modules/mogo-module-extensions/src/main/res/drawable-ldpi/icon_north_up.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 316 B |
BIN
modules/mogo-module-extensions/src/main/res/drawable-xhdpi/icon_car_up.png
Executable file
BIN
modules/mogo-module-extensions/src/main/res/drawable-xhdpi/icon_car_up.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
modules/mogo-module-extensions/src/main/res/drawable-xhdpi/icon_north_up.png
Executable file
BIN
modules/mogo-module-extensions/src/main/res/drawable-xhdpi/icon_north_up.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 609 B |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/icon_north_up" android:state_selected="true"/>
|
||||
<item android:drawable="@drawable/icon_north_up" android:state_checked="true"/>
|
||||
<item android:drawable="@drawable/icon_car_up"/>
|
||||
</selector>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#50526E"
|
||||
android:startColor="#3F4057" />
|
||||
<corners android:radius="@dimen/dp_15"/>
|
||||
|
||||
</shape>
|
||||
|
||||
@@ -113,13 +113,21 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<ImageView
|
||||
<TextView
|
||||
android:id="@+id/module_ext_id_north"
|
||||
android:layout_width="wrap_content"
|
||||
android:src="@drawable/ic_1"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_entrance_id_navi_info_panel"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_entrance_id_navi_info_panel"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:text="@string/mode_car_up"
|
||||
android:paddingTop="@dimen/dp_14"
|
||||
android:visibility="gone"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_28"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_33"
|
||||
android:background="@drawable/shape_react_gray_round"
|
||||
android:drawableTop="@drawable/selector_icon_north_up"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_entrance_id_navi_info_panel"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_entrance_id_navi_info_panel"
|
||||
android:layout_height="@dimen/dp_120"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/module_entrance_id_operation_panel"
|
||||
|
||||
@@ -20,8 +20,10 @@
|
||||
<string name="module_ext_str_exit_navi">退出导航</string>
|
||||
<string name="module_ext_str_continue_navi">继续导航</string>
|
||||
<string name="module_ext_str_exit_path">退出全览</string>
|
||||
<string name="mode_car_up">车头</string>
|
||||
<string name="mode_north_up">正北</string>
|
||||
|
||||
<string-array name="module_ext_str_arr_ai_tips">
|
||||
<string-array name="module_ext_str_arr_ai_tips">
|
||||
<item>你好小智,播放音乐</item>
|
||||
<item>你好小智,我要听音乐</item>
|
||||
<item>你好小智,播放赵磊的歌</item>
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.ui.adapter.SearchCategoryAdapter
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.module.navi.uitls.BitmapUtils
|
||||
import com.mogo.module.navi.uitls.StringUtils
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.cv_search_result
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.et_navi_search
|
||||
import kotlinx.android.synthetic.main.fragment_search_category.iv_navi_back
|
||||
@@ -81,11 +82,10 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa
|
||||
.longitude(datums[index].point?.lng ?: 0.0)
|
||||
arrayList.add(options)
|
||||
|
||||
|
||||
|
||||
var int2String = StringUtils.int2String(index)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
"position" + index, arrayOf("第" + index + "个", "第" + index + "条"), this
|
||||
"position" + index, arrayOf("第" + int2String + "个", "第" + int2String + "条"), this
|
||||
)
|
||||
cmds.add("position" + index)
|
||||
}
|
||||
|
||||
@@ -200,8 +200,6 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
SearchServiceHolder.getMarkerManger()
|
||||
.removeMarkers()
|
||||
|
||||
|
||||
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("firstPath", arrayOf<String>(firstPath), this)
|
||||
AIAssist.getInstance(context)
|
||||
@@ -210,8 +208,6 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
.registerUnWakeupCommand("thirdPath", arrayOf<String>(thirdPath), this)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("startNavi", arrayOf<String>(startNavi), this)
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("cancel", arrayOf<String>("取消", "退出", "返回", "退出导航", "取消导航"), this)
|
||||
|
||||
}
|
||||
|
||||
@@ -255,8 +251,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener, IMogoVoiceCmdCallB
|
||||
.unregisterUnWakeupCommand("thirdPath")
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand("startNavi")
|
||||
AIAssist.getInstance(context)
|
||||
.unregisterUnWakeupCommand("cancel")
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.mogo.module.navi.ui.base.UiController;
|
||||
import com.mogo.module.navi.ui.setting.NaviSettingFragment;
|
||||
import com.mogo.module.navi.uitls.StringUtils;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -44,7 +45,8 @@ import java.util.List;
|
||||
*/
|
||||
@Route(path = MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
public class SearchFragment extends BaseSearchFragment
|
||||
implements SearchView, View.OnClickListener, IMogoVoiceCmdCallBack {
|
||||
implements SearchView, View.OnClickListener, IMogoVoiceCmdCallBack,
|
||||
FragmentStackTransactionListener {
|
||||
|
||||
public static final String TAG = "search";
|
||||
|
||||
@@ -183,7 +185,8 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
});
|
||||
|
||||
registerVoidCmd();
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(BACK_CMD, new String[] { "关闭", "返回" }, this);
|
||||
}
|
||||
|
||||
private void goSetting() {
|
||||
@@ -222,15 +225,13 @@ public class SearchFragment extends BaseSearchFragment
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(RESTAURANT_CMD, new String[] { "餐馆" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(TOILET_CMD, new String[] { "卫生间","厕所" }, this);
|
||||
.registerUnWakeupCommand(TOILET_CMD, new String[] { "卫生间", "厕所" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(PARK_CMD, new String[] { "停车场" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(NAVI_SETTING_CMD, new String[] { "导航设置" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(CLEAN_CMD, new String[] { "清空历史目的地" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(BACK_CMD, new String[] { "关闭", "返回" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(WASH_CMD, new String[] { "洗车" }, this);
|
||||
}
|
||||
@@ -339,11 +340,19 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
showHistory();
|
||||
mHistoryAdapter.setDatas(datums);
|
||||
registerHistory();
|
||||
}
|
||||
|
||||
private void registerHistory() {
|
||||
List<SearchPoi> datums = mHistoryAdapter.getList();
|
||||
for (int i = 0; i < datums.size(); i++) {
|
||||
String s = StringUtils.int2String(i + 1);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand("history" + i,
|
||||
new String[] { "第" + s + "个", "第" + s + "条" }, this);
|
||||
if (cmds.contains("history" + i)) {
|
||||
continue;
|
||||
}
|
||||
cmds.add("history" + i);
|
||||
}
|
||||
}
|
||||
@@ -480,6 +489,7 @@ public class SearchFragment extends BaseSearchFragment
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(true);
|
||||
moveMapToRight();
|
||||
unRegisterVoice();
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(BACK_CMD);
|
||||
}
|
||||
|
||||
private void unRegisterVoice() {
|
||||
@@ -503,12 +513,33 @@ public class SearchFragment extends BaseSearchFragment
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(WASH_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(NAVI_SETTING_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(CLEAN_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(BACK_CMD);
|
||||
for (String cmd : cmds) {
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
//@Override public void onPause() {
|
||||
// super.onPause();
|
||||
// unRegisterVoice();
|
||||
//}
|
||||
//
|
||||
//@Override public void onResume() {
|
||||
// super.onResume();
|
||||
// registerVoidCmd();
|
||||
// registerHistory();
|
||||
//}
|
||||
|
||||
|
||||
@Override public void onHiddenChanged(boolean hidden) {
|
||||
super.onHiddenChanged(hidden);
|
||||
if (hidden) {
|
||||
unRegisterVoice();
|
||||
} else {
|
||||
registerVoidCmd();
|
||||
registerHistory();
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onCmdSelected(String cmd) {
|
||||
if (!TextUtils.isEmpty(cmd) && cmd.startsWith("history")) {
|
||||
String index = cmd.substring(7);
|
||||
@@ -584,4 +615,8 @@ public class SearchFragment extends BaseSearchFragment
|
||||
@Override public void onSpeakSelectTimeOut(String speakText) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onTransaction(int size) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user