导航语音指令
This commit is contained in:
@@ -12,6 +12,7 @@ import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.ui.search.ChoosePathFragment
|
||||
import com.mogo.utils.logger.Logger
|
||||
import androidx.core.content.ContextCompat.startActivity
|
||||
import com.mogo.map.navi.MogoNaviConfig
|
||||
import com.mogo.module.navi.ui.search.SearchFragment
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
|
||||
@@ -20,27 +21,27 @@ import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
* 2020-01-18.
|
||||
*/
|
||||
object NaviManager {
|
||||
private lateinit var mReceiver:BroadcastReceiver
|
||||
private lateinit var mReceiver: BroadcastReceiver
|
||||
private val AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV"
|
||||
|
||||
fun init(context: Context){
|
||||
fun init(context: Context) {
|
||||
mReceiver = object : BroadcastReceiver() {
|
||||
override fun onReceive(
|
||||
context: Context,
|
||||
intent: Intent
|
||||
) {
|
||||
val action = intent.action
|
||||
if (TextUtils.equals(action, AUTONAVI_STANDARD_BROADCAST_RECV)) {
|
||||
if (TextUtils.equals(action, AUTONAVI_STANDARD_BROADCAST_RECV)) {
|
||||
val key_type = intent.getIntExtra("KEY_TYPE", 0)
|
||||
Logger.d("NaviManager","key_type"+key_type,null)
|
||||
if (key_type == 10038||key_type == 10007) {
|
||||
Logger.d("NaviManager", "key_type" + key_type, null)
|
||||
if (key_type == 10038 || key_type == 10007) {
|
||||
val lat: Double
|
||||
val lon: Double
|
||||
|
||||
if (key_type==10007){
|
||||
if (key_type == 10007) {
|
||||
lat = intent.getDoubleExtra("ENTRY_LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("ENTRY_LON", 0.0)
|
||||
}else{
|
||||
} else {
|
||||
lat = intent.getDoubleExtra("LAT", 0.0)
|
||||
lon = intent.getDoubleExtra("LON", 0.0)
|
||||
|
||||
@@ -49,14 +50,15 @@ object NaviManager {
|
||||
|
||||
var newInstance =
|
||||
ChoosePathFragment.newInstance(
|
||||
MogoLatLng(lat,lon)
|
||||
MogoLatLng(lat, lon)
|
||||
)
|
||||
SearchServiceHolder.push(
|
||||
newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT
|
||||
)
|
||||
}else if (key_type == 10021) {
|
||||
SearchServiceHolder.getNavi().stopNavi()
|
||||
}else if (key_type == 20009) {
|
||||
} else if (key_type == 10021) {
|
||||
SearchServiceHolder.getNavi()
|
||||
.stopNavi()
|
||||
} else if (key_type == 20009) {
|
||||
showHome()
|
||||
SearchServiceHolder.fragmentManager
|
||||
.clearAll()
|
||||
@@ -70,7 +72,23 @@ object NaviManager {
|
||||
.build()
|
||||
)
|
||||
|
||||
} else if (key_type == 10005) {
|
||||
|
||||
// * 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
|
||||
// * `避免收费` |`1` `多策略算路` |`2` `不走高速` |`3` ` 躲避拥堵` |`4` `不走高速且避免收费` |`5` `不走高速且躲避拥堵` |`6`
|
||||
// * `躲避收费和拥堵` |`7` `不走高速躲避收费和拥堵` |`8` `高速优先` |`20` `躲避拥堵且高速优先` |`24`
|
||||
// *
|
||||
var prefer = intent.getIntExtra("NAVI_ROUTE_PREFER", 0)
|
||||
|
||||
var avoidSpeed = MogoNaviConfig().congestion(prefer == 4)
|
||||
.cost(prefer == 1||prefer == 7)
|
||||
.highSpeed(prefer == 20)
|
||||
.avoidSpeed(prefer == 3)
|
||||
SearchServiceHolder.getNavi()
|
||||
.reCalculateRoute(avoidSpeed)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.mogo.module.navi.ui.search
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.MogoMarkerOptions
|
||||
import com.mogo.map.search.geo.MogoPoiItem
|
||||
@@ -28,14 +31,36 @@ import kotlinx.android.synthetic.main.fragment_search_category.tv_navi_navi
|
||||
* @author zyz
|
||||
* 2020-01-09.
|
||||
*/
|
||||
class CategorySearchFragment : BaseFragment(), CategoryView {
|
||||
class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBack {
|
||||
override fun onCmdSelected(cmd: String?) {
|
||||
if (cmd?.startsWith("position") == true) {
|
||||
var index = cmd.substring(8)
|
||||
mAdapter.setCurrent(index.toInt())
|
||||
updateMarker()
|
||||
goPath()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCmdAction(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onCmdCancel(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
}
|
||||
|
||||
private val TAG: String = "CategorySearchFragment"
|
||||
private var addMarkers: List<IMogoMarker>? = null
|
||||
|
||||
private lateinit var cmds: ArrayList<String>
|
||||
override fun renderSearchPoiResult(datums: List<MogoPoiItem>?) {
|
||||
mAdapter.setDatas(datums)
|
||||
cv_search_result.visibility = View.VISIBLE
|
||||
pb_path.visibility=View.GONE
|
||||
pb_path.visibility = View.GONE
|
||||
var arrayList = ArrayList<MogoMarkerOptions>()
|
||||
for (index in 0 until datums!!.size) {
|
||||
var decodeResource =
|
||||
@@ -55,14 +80,20 @@ class CategorySearchFragment : BaseFragment(), CategoryView {
|
||||
// .anchor(0.5f, 1f)
|
||||
.longitude(datums[index].point?.lng ?: 0.0)
|
||||
arrayList.add(options)
|
||||
|
||||
|
||||
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand(
|
||||
"position" + index, arrayOf("第" + index + "个", "第" + index + "条"), this
|
||||
)
|
||||
cmds.add("position" + index)
|
||||
}
|
||||
addMarkers = SearchServiceHolder.getMarkerManger()
|
||||
.addMarkers(TAG, arrayList, true)
|
||||
moveMapToRight()
|
||||
}
|
||||
|
||||
|
||||
|
||||
private lateinit var mAdapter: SearchCategoryAdapter
|
||||
|
||||
private lateinit var mSearchPresenter: CategoryPresenter
|
||||
@@ -75,8 +106,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView {
|
||||
)
|
||||
mSearchPresenter = CategoryPresenter(this)
|
||||
lifecycle.addObserver(mSearchPresenter)
|
||||
|
||||
|
||||
cmds=ArrayList<String>()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@@ -104,16 +134,22 @@ class CategorySearchFragment : BaseFragment(), CategoryView {
|
||||
|
||||
tv_navi_navi.setOnClickListener {
|
||||
|
||||
var newInstance = ChoosePathFragment.newInstance(mAdapter.currentItem.point)
|
||||
|
||||
SearchServiceHolder.push(newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT)
|
||||
goPath()
|
||||
}
|
||||
mAdapter.setOnClickListener {
|
||||
var position = it.getTag(R.id.tag_position) as Int
|
||||
mAdapter.setCurrent(position)
|
||||
|
||||
updateMarker()
|
||||
}
|
||||
|
||||
AIAssist.getInstance(context)
|
||||
.registerUnWakeupCommand("back", arrayOf("关闭", "返回"), this)
|
||||
|
||||
}
|
||||
|
||||
private fun goPath() {
|
||||
var newInstance = ChoosePathFragment.newInstance(mAdapter.currentItem.point)
|
||||
SearchServiceHolder.push(newInstance, MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT)
|
||||
}
|
||||
|
||||
private fun updateMarker() {
|
||||
@@ -124,7 +160,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView {
|
||||
?.setIcon(getMarkerIcon(mAdapter.current))
|
||||
}
|
||||
|
||||
private fun getMarkerIcon(index :Int): Bitmap {
|
||||
private fun getMarkerIcon(index: Int): Bitmap {
|
||||
var decodeResource =
|
||||
BitmapFactory.decodeResource(
|
||||
resources,
|
||||
@@ -133,7 +169,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView {
|
||||
|
||||
var createWaterMask =
|
||||
BitmapUtils.createWaterMask(
|
||||
context, decodeResource, (index+1).toString(), R.color.white, 18
|
||||
context, decodeResource, (index + 1).toString(), R.color.white, 18
|
||||
)
|
||||
return createWaterMask
|
||||
}
|
||||
@@ -149,6 +185,10 @@ class CategorySearchFragment : BaseFragment(), CategoryView {
|
||||
lifecycle.removeObserver(mSearchPresenter)
|
||||
SearchServiceHolder.getMarkerManger()
|
||||
.removeMarkers(TAG)
|
||||
|
||||
cmds.forEach {
|
||||
AIAssist.getInstance(context).unregisterUnWakeupCommand(it)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.module.navi.ui.search;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.health.ServiceHealthStats;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -11,6 +13,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.search.inputtips.MogoTip;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.navi.R;
|
||||
@@ -22,6 +26,7 @@ import com.mogo.module.navi.ui.adapter.HistoryPoiAdapter;
|
||||
import com.mogo.module.navi.ui.adapter.SearchPoiAdapter;
|
||||
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 java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -38,7 +43,8 @@ import java.util.List;
|
||||
* {@link SearchConstants#SEARCH_TYPE_MULTI_HOME}
|
||||
*/
|
||||
@Route(path = MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
public class SearchFragment extends BaseSearchFragment implements SearchView, View.OnClickListener {
|
||||
public class SearchFragment extends BaseSearchFragment
|
||||
implements SearchView, View.OnClickListener, IMogoVoiceCmdCallBack {
|
||||
|
||||
public static final String TAG = "search";
|
||||
|
||||
@@ -119,10 +125,7 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_History_destination", new HashMap<String, Object>());
|
||||
SearchPoi item = (SearchPoi) v.getTag(R.id.tag_item);
|
||||
MogoTip mogoTip = EntityConvertUtils.poi2MogoTip(item);
|
||||
SearchServiceHolder.INSTANCE.push(
|
||||
ChoosePathFragment.Companion.newInstance(mogoTip.getPoint()),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
goHistory(item);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,8 +134,7 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
MogoTip tag = (MogoTip) v.getTag(R.id.tag_position);
|
||||
SearchPoi searchPoi = EntityConvertUtils.tipToPoi(tag);
|
||||
if (tag.getPoint() == null) {
|
||||
push(CategorySearchFragment.Companion.newInstance(tag.getName()),
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY);
|
||||
goCategory(tag.getName());
|
||||
} else {
|
||||
mSearchPresenter.insert(searchPoi);
|
||||
SearchServiceHolder.INSTANCE.push(
|
||||
@@ -150,10 +152,7 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
|
||||
findViewById(R.id.tv_navi_setting).setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_button_setting", new HashMap<String, Object>());
|
||||
|
||||
push(new NaviSettingFragment(), MogoModulePaths.PATH_FRAGMENT_SETTING);
|
||||
goSetting();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -183,6 +182,57 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
mSearchPresenter.startSearchPoiByInput(mSearchBox.getText().toString());
|
||||
}
|
||||
});
|
||||
|
||||
registerVoidCmd();
|
||||
}
|
||||
|
||||
private void goSetting() {
|
||||
SearchServiceHolder.INSTANCE.getAnalyticsManager()
|
||||
.track("Navigation_button_setting", new HashMap<String, Object>());
|
||||
|
||||
push(new NaviSettingFragment(), MogoModulePaths.PATH_FRAGMENT_SETTING);
|
||||
}
|
||||
|
||||
private void goHistory(SearchPoi item) {
|
||||
MogoTip mogoTip = EntityConvertUtils.poi2MogoTip(item);
|
||||
SearchServiceHolder.INSTANCE.push(
|
||||
ChoosePathFragment.Companion.newInstance(mogoTip.getPoint()),
|
||||
MogoModulePaths.PATH_FRAGMENT_CHOOSE_PAHT);
|
||||
}
|
||||
|
||||
private static final String GO_HOME_CMD = "goHome";
|
||||
private static final String GO_COMPANY_CMD = "goCompany";
|
||||
private static final String GAS_CMD = "gas";
|
||||
private static final String RESTAURANT_CMD = "restaurant";
|
||||
private static final String TOILET_CMD = "toilet";
|
||||
private static final String PARK_CMD = "park";
|
||||
private static final String WASH_CMD = "wash";
|
||||
private static final String NAVI_SETTING_CMD = "setting";
|
||||
private static final String CLEAN_CMD = "clean";
|
||||
private static final String BACK_CMD = "back";
|
||||
|
||||
private void registerVoidCmd() {
|
||||
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(GO_HOME_CMD, new String[] { "回家" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(GO_COMPANY_CMD, new String[] { "去公司" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(GAS_CMD, new String[] { "加油站" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(RESTAURANT_CMD, new String[] { "餐馆" }, this);
|
||||
AIAssist.getInstance(getContext())
|
||||
.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);
|
||||
}
|
||||
|
||||
private void push(Fragment fragment, String tag) {
|
||||
@@ -289,8 +339,17 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
}
|
||||
showHistory();
|
||||
mHistoryAdapter.setDatas(datums);
|
||||
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);
|
||||
cmds.add("history" + i);
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> cmds = new ArrayList<String>();
|
||||
|
||||
@Override
|
||||
public int getSearchType() {
|
||||
return mSearchType;
|
||||
@@ -407,6 +466,10 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
@Override public void onClick(View v) {
|
||||
TextView category = (TextView) v;
|
||||
String text = category.getText().toString();
|
||||
goCategory(text);
|
||||
}
|
||||
|
||||
private void goCategory(String text) {
|
||||
push(CategorySearchFragment.Companion.newInstance(text),
|
||||
MogoModulePaths.PATH_FRAGMENT_SEARCH_CATEGORY);
|
||||
}
|
||||
@@ -416,5 +479,109 @@ public class SearchFragment extends BaseSearchFragment implements SearchView, Vi
|
||||
super.onDestroyView();
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(true);
|
||||
moveMapToRight();
|
||||
unRegisterVoice();
|
||||
}
|
||||
|
||||
private void unRegisterVoice() {
|
||||
|
||||
//private static final String GO_HOME_CMD="goHome";
|
||||
//private static final String GO_COMPANY_CMD="goCompany";
|
||||
//private static final String GAS_CMD="gas";
|
||||
//private static final String RESTAURANT_CMD="restaurant";
|
||||
//private static final String TOILET_CMD="toilet";
|
||||
//private static final String PARK_CMD="park";
|
||||
//private static final String WASH_CMD="wash";
|
||||
//private static final String NAVI_SETTING_CMD="setting";
|
||||
//private static final String CLEAN_CMD="clean";
|
||||
//private static final String BACK_CMD="back";
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(GO_HOME_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(GO_COMPANY_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(GAS_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(RESTAURANT_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(TOILET_CMD);
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(PARK_CMD);
|
||||
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 onCmdSelected(String cmd) {
|
||||
if (!TextUtils.isEmpty(cmd) && cmd.startsWith("history")) {
|
||||
String index = cmd.substring(7);
|
||||
SearchPoi item = mHistoryAdapter.getItem(Integer.valueOf(index));
|
||||
goHistory(item);
|
||||
return;
|
||||
}
|
||||
switch (cmd) {
|
||||
case CLEAN_CMD:
|
||||
mSearchPresenter.deleteAllCachedPoi();
|
||||
AIAssist.getInstance(getContext())
|
||||
.speakQAndACmd(getString(R.string.notice_clean_history),
|
||||
new String[] { "确定" }, new String[] { "取消" }, this);
|
||||
break;
|
||||
|
||||
case BACK_CMD:
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager().pop();
|
||||
break;
|
||||
case GAS_CMD:
|
||||
|
||||
goCategory(getString(R.string.navi_gas));
|
||||
|
||||
break;
|
||||
case GO_COMPANY_CMD:
|
||||
AddressManager.INSTANCE.goCompany();
|
||||
|
||||
break;
|
||||
case GO_HOME_CMD:
|
||||
AddressManager.INSTANCE.goHome();
|
||||
break;
|
||||
case NAVI_SETTING_CMD:
|
||||
goSetting();
|
||||
break;
|
||||
|
||||
case PARK_CMD:
|
||||
goCategory(getString(R.string.navi_park));
|
||||
|
||||
break;
|
||||
case RESTAURANT_CMD:
|
||||
goCategory(getString(R.string.navi_restrant));
|
||||
|
||||
break;
|
||||
|
||||
case TOILET_CMD:
|
||||
goCategory(getString(R.string.navi_toilet));
|
||||
break;
|
||||
|
||||
case WASH_CMD:
|
||||
goCategory(getString(R.string.navi_wash));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void onCmdAction(String speakText) {
|
||||
|
||||
mSearchPresenter.deleteAllCachedPoi();
|
||||
mSearchPresenter.hideDialog();
|
||||
}
|
||||
|
||||
@Override public void onCmdCancel(String speakText) {
|
||||
|
||||
mSearchPresenter.hideDialog();
|
||||
}
|
||||
|
||||
@Override public void onSpeakEnd(String speakText) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onSpeakSelectTimeOut(String speakText) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,6 +136,8 @@ public class SearchPresenter extends Presenter<SearchView> {
|
||||
mCompositeDisposable.add(disposable);
|
||||
}
|
||||
|
||||
private NoticeDialog noticeDialog;
|
||||
|
||||
public void deleteAllCachedPoi() {
|
||||
|
||||
//new AlertDialog.Builder( getContext() )
|
||||
@@ -150,7 +152,7 @@ public class SearchPresenter extends Presenter<SearchView> {
|
||||
// .create()
|
||||
// .show();
|
||||
|
||||
NoticeDialog noticeDialog = new NoticeDialog(getContext(),"清空历史记录?","立即清空");
|
||||
noticeDialog = new NoticeDialog(getContext(),"清空历史记录?","立即清空");
|
||||
|
||||
//noticeDialog.setContent("清空历史记录?");
|
||||
//noticeDialog.setPositiveButton("立即清空");
|
||||
@@ -165,7 +167,13 @@ public class SearchPresenter extends Presenter<SearchView> {
|
||||
noticeDialog.show();
|
||||
}
|
||||
|
||||
private void deleteAllCachedPoiImpl() {
|
||||
public void hideDialog(){
|
||||
if (noticeDialog != null) {
|
||||
noticeDialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteAllCachedPoiImpl() {
|
||||
final Disposable disposable = AppDataBase.getDatabase(getContext())
|
||||
.poiDao()
|
||||
.getAll()
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.mogo.module.navi.uitls;
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
* 2020-03-05.
|
||||
*/
|
||||
public class StringUtils {
|
||||
|
||||
public static String int2String(int index){
|
||||
switch (index){
|
||||
case 1:
|
||||
return "一";
|
||||
case 2:
|
||||
return "二";
|
||||
case 3:
|
||||
return "三";
|
||||
case 4:
|
||||
return "四";
|
||||
case 5:
|
||||
return "五";
|
||||
case 6:
|
||||
return "六";
|
||||
case 7:
|
||||
return "七";
|
||||
case 8:
|
||||
return "八";
|
||||
case 9:
|
||||
return "九";
|
||||
default:
|
||||
return "十";
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user