rc
This commit is contained in:
@@ -131,16 +131,22 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
.tag( MogoModulePaths.PATH_FRAGMENT_SEARCH )
|
||||
.notifyMainModule( true )
|
||||
.build() );
|
||||
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
} );
|
||||
|
||||
mHome = findViewById( R.id.module_entrance_id_home );
|
||||
mHome.setOnClickListener( view -> {
|
||||
mMogoAddressManager.goHome();
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
|
||||
} );
|
||||
|
||||
mCompany = findViewById( R.id.module_entrance_id_company );
|
||||
mCompany.setOnClickListener( view -> {
|
||||
mMogoAddressManager.goCompany();
|
||||
mApis.getAdasControllerApi().closeADAS();
|
||||
|
||||
} );
|
||||
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
|
||||
@@ -14,6 +14,7 @@ import androidx.viewpager.widget.ViewPager;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.mvp.MvpActivity;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
@@ -58,10 +59,11 @@ import java.util.List;
|
||||
* 描述:加载各个模块
|
||||
*/
|
||||
public class MainActivity extends MvpActivity< MainView, MainPresenter > implements MainView,
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener {
|
||||
IMogoLocationListener,
|
||||
IMogoMarkerClickListener, IMogoVoiceCmdCallBack {
|
||||
|
||||
private static final String TAG = "MainActivity";
|
||||
private static final String BACK_CMD = "back";
|
||||
|
||||
private IMogoServiceApis mServiceApis;
|
||||
private IMogoMapService mMogoMapService;
|
||||
@@ -279,11 +281,17 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoFragmentManager.registerMainFragmentStackTransactionListener( ( size ) -> {
|
||||
if ( size == 0 ) {
|
||||
showLayout();
|
||||
|
||||
AIAssist.getInstance(getContext())
|
||||
.unregisterUnWakeupCommand(BACK_CMD);
|
||||
|
||||
} else if ( size == 1 ) {
|
||||
UiThreadHandler.postDelayed( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMogoMapUIController.setPointToCenter( 0.5, 0.5 );
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(BACK_CMD, new String[] { "关闭", "返回" }, this);
|
||||
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override public void run() {
|
||||
mMogoMapUIController.setPointToCenter(0.5,0.5);
|
||||
|
||||
}
|
||||
}, 1000 );
|
||||
@@ -416,4 +424,28 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mMogoFragmentManager = null;
|
||||
AIAssist.getInstance( this ).release();
|
||||
}
|
||||
|
||||
@Override public void onCmdSelected(String cmd) {
|
||||
|
||||
if (TextUtils.equals(BACK_CMD,cmd)) {
|
||||
mMogoFragmentManager.clearAll();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override public void onCmdAction(String speakText) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onCmdCancel(String speakText) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onSpeakEnd(String speakText) {
|
||||
|
||||
}
|
||||
|
||||
@Override public void onSpeakSelectTimeOut(String speakText) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 60 KiB |
@@ -7,6 +7,7 @@ import com.mogo.module.navi.bean.EntityConvertUtils
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.DataConstants
|
||||
import com.mogo.module.navi.constants.SearchServiceHolder
|
||||
import com.mogo.module.navi.cp.AddressHelper
|
||||
import com.mogo.module.navi.dao.SearchPoiDao
|
||||
import com.mogo.module.navi.database.AppDataBase
|
||||
import com.mogo.module.navi.ui.search.ChoosePathFragment
|
||||
@@ -114,20 +115,28 @@ object AddressManager {
|
||||
}
|
||||
}
|
||||
|
||||
fun deleteHome(){
|
||||
fun deleteHome(context: Context){
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(homeAddress)
|
||||
homeAddress?.name=""
|
||||
AddressHelper.notifyAddressChanged(context, homeAddress!!)
|
||||
|
||||
homeAddress=null
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.subscribe()
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun deleteCompany(){
|
||||
fun deleteCompany(context: Context){
|
||||
Observable.create(
|
||||
ObservableOnSubscribe<String> {
|
||||
poiDao.delete(companyAddress)
|
||||
companyAddress?.name=""
|
||||
AddressHelper.notifyAddressChanged(context, companyAddress!!)
|
||||
|
||||
companyAddress=null
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@@ -177,9 +177,7 @@ public class SearchFragment extends BaseSearchFragment
|
||||
}
|
||||
});
|
||||
|
||||
AIAssist.getInstance(getContext())
|
||||
.registerUnWakeupCommand(BACK_CMD, new String[] { "关闭", "返回" }, this);
|
||||
registerVoidCmd();
|
||||
registerVoidCmd();
|
||||
}
|
||||
|
||||
private void goResult(MogoTip tag) {
|
||||
@@ -217,7 +215,6 @@ public class SearchFragment extends BaseSearchFragment
|
||||
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() {
|
||||
|
||||
@@ -522,7 +519,6 @@ public class SearchFragment extends BaseSearchFragment
|
||||
SearchServiceHolder.INSTANCE.getMapUIController().showMyLocation(true);
|
||||
moveMapToRight();
|
||||
unRegisterVoice();
|
||||
AIAssist.getInstance(getContext()).unregisterUnWakeupCommand(BACK_CMD);
|
||||
}
|
||||
|
||||
private void unRegisterVoice() {
|
||||
@@ -598,9 +594,7 @@ public class SearchFragment extends BaseSearchFragment
|
||||
new String[] { "确定","立即清空" }, new String[] { "取消" }, this);
|
||||
break;
|
||||
|
||||
case BACK_CMD:
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager().clearAll();
|
||||
break;
|
||||
|
||||
case GAS_CMD:
|
||||
|
||||
goCategory(getString(R.string.navi_gas));
|
||||
|
||||
@@ -197,12 +197,12 @@ class NaviSettingFragment : BaseFragment(), OnCheckedChangeListener {
|
||||
|
||||
|
||||
tv_navi_clear_home_address.setOnClickListener {
|
||||
AddressManager.deleteHome()
|
||||
AddressManager.deleteHome(context!!)
|
||||
clearHome()
|
||||
}
|
||||
|
||||
tv_navi_clear_company_address.setOnClickListener {
|
||||
AddressManager.deleteCompany()
|
||||
AddressManager.deleteCompany(context!!)
|
||||
clearCompany()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.module.navi.ui.setting
|
||||
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
@@ -43,8 +44,15 @@ import kotlinx.android.synthetic.main.fragment_setting_address.tv_set_as_home
|
||||
class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
override fun onRegeocodeSearched(regeocodeResult: MogoRegeocodeResult?) {
|
||||
et_navi_search.setText(regeocodeResult?.regeocodeAddress?.formatAddress)
|
||||
selectPoi?.address=regeocodeResult?.regeocodeAddress?.formatAddress
|
||||
selectPoi?.name=regeocodeResult?.regeocodeAddress?.building
|
||||
var formatAddress = regeocodeResult?.regeocodeAddress?.formatAddress
|
||||
selectPoi?.address = formatAddress
|
||||
|
||||
var neighborhood = regeocodeResult?.regeocodeAddress?.neighborhood
|
||||
if (!TextUtils.isEmpty(neighborhood)) {
|
||||
selectPoi?.name = neighborhood
|
||||
}else{
|
||||
selectPoi?.name = formatAddress
|
||||
}
|
||||
}
|
||||
|
||||
override fun onGeocodeSearched(geocodeResult: MogoGeocodeResult?) {
|
||||
@@ -55,7 +63,7 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
private var style: Int = DataConstants.TYPE_HOME_ADDRESS
|
||||
var addMarker: IMogoMarker? = null
|
||||
|
||||
private var selectPoi: SearchPoi?=null
|
||||
private var selectPoi: SearchPoi? = null
|
||||
private var mapListener: IMogoMapListener = object : MogoMapListenerAdapter() {
|
||||
override fun onMapChanged(
|
||||
latLng: MogoLatLng?,
|
||||
@@ -64,20 +72,23 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
bearing: Float
|
||||
) {
|
||||
super.onMapChanged(latLng, zoom, tilt, bearing)
|
||||
selectPoi=EntityConvertUtils.geoToPoi(latLng?.lat?:0.0,latLng?.lng?:0.0,style)
|
||||
selectPoi = EntityConvertUtils.geoToPoi(latLng?.lat ?: 0.0, latLng?.lng ?: 0.0, style)
|
||||
|
||||
var mogoRegeocodeQuery = MogoRegeocodeQuery()
|
||||
mogoRegeocodeQuery.point = latLng
|
||||
SearchServiceHolder.getGeoSearcher().getFromLocationAsyn(mogoRegeocodeQuery)
|
||||
SearchServiceHolder.getGeoSearcher()
|
||||
.getFromLocationAsyn(mogoRegeocodeQuery)
|
||||
addMarker?.apply {
|
||||
SearchServiceHolder.getMapUIController().startJumpAnimation(this,
|
||||
150f,{input ->
|
||||
if (input <= 0.5) {
|
||||
(0.5f - 2.0 * (0.5 - input) * (0.5 - input)).toFloat()
|
||||
} else {
|
||||
(0.5f - Math.sqrt(((input - 0.5f) * (1.5f - input)).toDouble())).toFloat()
|
||||
}
|
||||
}, 600)
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.startJumpAnimation(this,
|
||||
150f, { input ->
|
||||
if (input <= 0.5) {
|
||||
(0.5f - 2.0 * (0.5 - input) * (0.5 - input)).toFloat()
|
||||
} else {
|
||||
(0.5f - Math.sqrt(((input - 0.5f) * (1.5f - input)).toDouble())).toFloat()
|
||||
}
|
||||
}, 600
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,9 +107,11 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
.setGeoSearchListener(this)
|
||||
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, true)
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, true
|
||||
)
|
||||
|
||||
SearchServiceHolder.getMarkerManger().removeMarkers()
|
||||
SearchServiceHolder.getMarkerManger()
|
||||
.removeMarkers()
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
@@ -131,7 +144,8 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
}
|
||||
tv_set_as_home.setOnClickListener {
|
||||
if (selectPoi == null) {
|
||||
Toast.makeText(context,"请选择",Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, "请选择", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
return@setOnClickListener
|
||||
}
|
||||
insert(selectPoi!!)
|
||||
@@ -146,16 +160,16 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
UiThreadHandler.postDelayed({
|
||||
var decodeResource = BitmapFactory.decodeResource(resources, R.mipmap.icon_choose_position2)
|
||||
val options = MogoMarkerOptions()
|
||||
.icon(decodeResource)
|
||||
.latitude(location?.lat ?: 0.0)
|
||||
.owner(TAG)
|
||||
.anchor(0.5f, 1f)
|
||||
.longitude(location?.lng ?: 0.0)
|
||||
.icon(decodeResource)
|
||||
.latitude(location?.lat ?: 0.0)
|
||||
.owner(TAG)
|
||||
.anchor(0.5f, 1f)
|
||||
.longitude(location?.lng ?: 0.0)
|
||||
addMarker = SearchServiceHolder.getMarkerManger()
|
||||
.addMarker(MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
.addMarker(MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, options)
|
||||
|
||||
var locationPointInScreen = SearchServiceHolder.getMapUIController()
|
||||
.getLocationPointInScreen(location)
|
||||
.getLocationPointInScreen(location)
|
||||
addMarker?.setPositionByPixels(locationPointInScreen)
|
||||
}, 500L)
|
||||
}
|
||||
@@ -173,7 +187,7 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
.subscribe()
|
||||
|
||||
|
||||
AddressHelper.notifyAddressChanged(context,searchPoi)
|
||||
AddressHelper.notifyAddressChanged(context, searchPoi)
|
||||
|
||||
}
|
||||
|
||||
@@ -188,12 +202,14 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
addMarker?.destroy()
|
||||
|
||||
SearchServiceHolder.statusManager.setSearchUIShow(
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, false)
|
||||
MogoModulePaths.PATH_FRAGMENT_SETTING_HOME, false
|
||||
)
|
||||
|
||||
if (SearchServiceHolder.fragmentManager.stackSize == 0) {
|
||||
moveMapToRight()
|
||||
SearchServiceHolder.getMapUIController().showMyLocation(true)
|
||||
}
|
||||
if (SearchServiceHolder.fragmentManager.stackSize == 0) {
|
||||
moveMapToRight()
|
||||
SearchServiceHolder.getMapUIController()
|
||||
.showMyLocation(true)
|
||||
}
|
||||
|
||||
// moveMapToRight()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user