Merge branch 'feature/v1.0.0' of http://gitlab.zhidaoauto.com/ecos/yycp-service/Launcher into feature/v1.0.0
@@ -31,47 +31,48 @@ public class InputtipsSearch implements IMogoInputtipsSearch, Inputtips.Inputtip
|
||||
private InputtipsQuery mQuery;
|
||||
private IMogoInputtipsListener mListener;
|
||||
|
||||
public InputtipsSearch( Context context, MogoInputtipsQuery query ) {
|
||||
mQuery = ObjectUtils.fromMogo( query );
|
||||
mClient = new Inputtips( context, mQuery );
|
||||
mClient.setInputtipsListener( this );
|
||||
public InputtipsSearch(Context context, MogoInputtipsQuery query) {
|
||||
mQuery = ObjectUtils.fromMogo(query);
|
||||
mClient = new Inputtips(context, mQuery);
|
||||
mClient.setInputtipsListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQuery( MogoInputtipsQuery query ) {
|
||||
this.mQuery = ObjectUtils.fromMogo( query );
|
||||
public void setQuery(MogoInputtipsQuery query) {
|
||||
this.mQuery = ObjectUtils.fromMogo(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInputtipsListener( IMogoInputtipsListener listener ) {
|
||||
public void setInputtipsListener(IMogoInputtipsListener listener) {
|
||||
this.mListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestInputtipsAsyn() {
|
||||
if ( mClient != null ) {
|
||||
if (mClient != null) {
|
||||
mClient.requestInputtipsAsyn();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGetInputtips( List< Tip > list, int i ) {
|
||||
if ( i == 1000 ) {
|
||||
if ( mListener != null ) {
|
||||
mListener.onGetInputtips( getResult( list ) );
|
||||
public void onGetInputtips(List<Tip> list, int i) {
|
||||
if (i == 1000) {
|
||||
if (mListener != null) {
|
||||
mListener.onGetInputtips(getResult(list));
|
||||
}
|
||||
} else {
|
||||
Logger.e( TAG, "errorcode = " + i );
|
||||
Logger.e(TAG, "errorcode = " + i);
|
||||
}
|
||||
}
|
||||
|
||||
private List< MogoTip > getResult( List< Tip > tips ) {
|
||||
List< MogoTip > mogoTips = new ArrayList<>();
|
||||
if ( tips != null ) {
|
||||
for ( Tip tip : tips ) {
|
||||
MogoTip mogoTip = ObjectUtils.fromAMap( tip );
|
||||
if ( mogoTip != null ) {
|
||||
mogoTips.add( mogoTip );
|
||||
private List<MogoTip> getResult(List<Tip> tips) {
|
||||
List<MogoTip> mogoTips = new ArrayList<>();
|
||||
if (tips != null) {
|
||||
//只添加有坐标的结果
|
||||
for (Tip tip : tips) {
|
||||
MogoTip mogoTip = ObjectUtils.fromAMap(tip);
|
||||
if (mogoTip != null && mogoTip.getPoint() != null) {
|
||||
mogoTips.add(mogoTip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 9.1 KiB |
@@ -1,6 +1,5 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -11,15 +10,12 @@ import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
@@ -33,7 +29,6 @@ import com.mogo.module.extensions.R;
|
||||
import com.mogo.module.extensions.dialog.NaviNoticeDialog;
|
||||
import com.mogo.module.extensions.navi.NaviInfoView;
|
||||
import com.mogo.module.share.ShareControl;
|
||||
import com.mogo.module.share.dialog.LaucherShareDialog;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
@@ -41,10 +36,6 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoAddressManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.windowview.IMogoWindowManager;
|
||||
import com.mogo.utils.TipToast;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -101,6 +92,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
protected void initViews() {
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance().build( MogoServicePaths.PATH_FRAGMENT_MANAGER ).navigation();
|
||||
mMogoAddressManager = ( IMogoAddressManager ) ARouter.getInstance().build( MogoServicePaths.PATH_ADDRESS_MANAGER ).navigation();
|
||||
|
||||
mCommonAddress = findViewById( R.id.module_entrance_id_common_address );
|
||||
|
||||
mSearch = findViewById( R.id.module_entrance_id_search );
|
||||
@@ -154,7 +146,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
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 );
|
||||
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
|
Before Width: | Height: | Size: 465 B After Width: | Height: | Size: 396 B |
BIN
modules/mogo-module-extensions/src/main/res/drawable-xhdpi/module_map_ic_home.png
Normal file → Executable file
|
Before Width: | Height: | Size: 831 B After Width: | Height: | Size: 588 B |
@@ -40,7 +40,7 @@ public class VoiceConstants {
|
||||
*/
|
||||
public static final String CMD_MAP_HISTORY = "com.ileja.navi.map.history";
|
||||
public static final String CMD_MAP_HISTORY_UN_WAKEUP = "CMD_MAP_HISTORY_UN_WAKEUP";
|
||||
public static final String[] CMD_MAP_HISTORY_TRIGGER_WORDS = {"导航历史"};
|
||||
public static final String[] CMD_MAP_HISTORY_TRIGGER_WORDS = {"查询导航历史记录"};
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,17 +46,17 @@ public class AddressContentProvider extends ContentProvider {
|
||||
Log.d( TAG, "query code: " + code );
|
||||
final SearchPoi poi = getPoi( code );
|
||||
MatrixCursor
|
||||
cursor = new MatrixCursor( new String[]{DataConstants.HOME_ADDRESS_NAME, DataConstants.HOME_ADDRESS_LATITUDE, DataConstants.HOME_ADDRESS_LONGITUDE} );
|
||||
cursor = new MatrixCursor( new String[]{DataConstants.HOME_ADDRESS_NAME,DataConstants.HOME_ADDRESS, DataConstants.HOME_ADDRESS_LATITUDE, DataConstants.HOME_ADDRESS_LONGITUDE} );
|
||||
if ( code == DataConstants.HOME_ADDRESS_CODE ) {
|
||||
cursor = new MatrixCursor( new String[]{DataConstants.HOME_ADDRESS_NAME, DataConstants.HOME_ADDRESS_LATITUDE, DataConstants.HOME_ADDRESS_LONGITUDE} );
|
||||
cursor = new MatrixCursor( new String[]{DataConstants.HOME_ADDRESS_NAME,DataConstants.HOME_ADDRESS, DataConstants.HOME_ADDRESS_LATITUDE, DataConstants.HOME_ADDRESS_LONGITUDE} );
|
||||
} else if ( code == DataConstants.COMPANY_ADDRESS_CODE ) {
|
||||
cursor = new MatrixCursor( new String[]{DataConstants.COMPANY_ADDRESS_NAME, DataConstants.COMPANY_ADDRESS_LATITUDE, DataConstants.COMPANY_ADDRESS_LONGITUDE} );
|
||||
cursor = new MatrixCursor( new String[]{DataConstants.COMPANY_ADDRESS_NAME,DataConstants.COMPANY_ADDRESS, DataConstants.COMPANY_ADDRESS_LATITUDE, DataConstants.COMPANY_ADDRESS_LONGITUDE} );
|
||||
}
|
||||
if ( cursor != null ) {
|
||||
if ( poi == null ) {
|
||||
cursor.addRow( new Object[]{"", 0, 0} );
|
||||
cursor.addRow( new Object[]{"","", 0, 0} );
|
||||
} else {
|
||||
cursor.addRow( new Object[]{poi.getName(), poi.getLat(), poi.getLng()} );
|
||||
cursor.addRow( new Object[]{poi.getName(),poi.getAddress(), poi.getLat(), poi.getLng()} );
|
||||
}
|
||||
}
|
||||
return cursor;
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package com.mogo.module.navi.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.module.navi.R;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description 通用分享dialog
|
||||
* @since 2020-01-10
|
||||
*/
|
||||
public class NoticeDialog extends Dialog implements View.OnClickListener {
|
||||
private final String content;
|
||||
private final String positive;
|
||||
private TextView txtOk;
|
||||
private Context mContext;
|
||||
private View tvCancel;
|
||||
private View.OnClickListener onClickListener;
|
||||
private TextView tvContent;
|
||||
|
||||
public NoticeDialog(@NonNull Context context,String content,String positive) {
|
||||
super(context, R.style.Theme_AppCompat_Dialog);
|
||||
this.mContext = context;
|
||||
|
||||
this.content=content;
|
||||
this.positive=positive;
|
||||
|
||||
getWindow().setBackgroundDrawableResource(android.R.color.transparent);
|
||||
}
|
||||
|
||||
//public NoticeDialog(@NonNull Context context, int themeResId) {
|
||||
// super(context, R.style.Theme_AppCompat_Dialog);
|
||||
//}
|
||||
|
||||
public void setOnClickListener(View.OnClickListener onClickListener) {
|
||||
this.onClickListener = onClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
initView();
|
||||
setContent(content);
|
||||
setPositiveButton(positive);
|
||||
initListener();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
setContentView(R.layout.dialog_common_notice);
|
||||
txtOk = findViewById(R.id.tv_dialog_ok);
|
||||
tvCancel = findViewById(R.id.tv_dialog_cancel);
|
||||
tvContent = findViewById(R.id.tv_dialog_content);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initListener() {
|
||||
txtOk.setOnClickListener(this);
|
||||
tvCancel.setOnClickListener(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
|
||||
if (onClickListener != null) {
|
||||
onClickListener.onClick(view);
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
||||
public void setContent(String s) {
|
||||
if (tvContent != null) {
|
||||
tvContent.setText(s);
|
||||
}
|
||||
}
|
||||
|
||||
public void setPositiveButton(String str) {
|
||||
if (txtOk != null) {
|
||||
txtOk.setText(str);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,9 @@ import com.mogo.module.common.MogoModulePaths
|
||||
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
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*@author zyz
|
||||
@@ -33,6 +36,8 @@ object NaviManager {
|
||||
val lat = intent.getDoubleExtra("LAT", 0.0)
|
||||
val lon = intent.getDoubleExtra("LON", 0.0)
|
||||
|
||||
showHome()
|
||||
|
||||
var newInstance =
|
||||
ChoosePathFragment.newInstance(
|
||||
MogoLatLng(lat,lon)
|
||||
@@ -42,9 +47,20 @@ object NaviManager {
|
||||
)
|
||||
}else if (key_type == 10021) {
|
||||
SearchServiceHolder.getNavi().stopNavi()
|
||||
}else if (key_type == 20009) {
|
||||
showHome()
|
||||
SearchServiceHolder.fragmentManager
|
||||
.clearAll()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showHome() {
|
||||
val intent = Intent(Intent.ACTION_MAIN)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
intent.addCategory(Intent.CATEGORY_HOME)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
}
|
||||
val inputFilter = IntentFilter()
|
||||
inputFilter.addAction(AUTONAVI_STANDARD_BROADCAST_RECV)
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.module.navi.ui.search;
|
||||
import android.app.AlertDialog;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
@@ -19,11 +20,13 @@ import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
|
||||
import com.mogo.map.search.poisearch.MogoPoiResult;
|
||||
import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
|
||||
import com.mogo.module.common.TextWatcherAdapter;
|
||||
import com.mogo.module.navi.R;
|
||||
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.database.AppDataBase;
|
||||
import com.mogo.module.navi.dialog.NoticeDialog;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapService;
|
||||
import io.reactivex.Observable;
|
||||
@@ -46,25 +49,25 @@ import java.util.List;
|
||||
* <p>
|
||||
* 搜搜页逻辑处理
|
||||
*/
|
||||
public class SearchPresenter extends Presenter< SearchView >
|
||||
{
|
||||
|
||||
public class SearchPresenter extends Presenter<SearchView> {
|
||||
|
||||
private CompositeDisposable mCompositeDisposable;
|
||||
private IMogoMapService mMapService;
|
||||
private IMogoMapService mMapService;
|
||||
|
||||
public SearchPresenter( SearchView view ) {
|
||||
super( view );
|
||||
public SearchPresenter(SearchView view) {
|
||||
super(view);
|
||||
mCompositeDisposable = new CompositeDisposable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
attachSearchBoxTextWatcher( mView.getSearchBox() );
|
||||
mMapService = (IMogoMapService) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICES_MAP ).navigation( getContext() );
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
attachSearchBoxTextWatcher(mView.getSearchBox());
|
||||
mMapService = (IMogoMapService) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_SERVICES_MAP)
|
||||
.navigation(getContext());
|
||||
loadHistories();
|
||||
}
|
||||
}
|
||||
|
||||
private void loadHistories() {
|
||||
Disposable subscribe =
|
||||
@@ -82,8 +85,8 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
addDisposable(subscribe);
|
||||
}
|
||||
|
||||
private void attachSearchBoxTextWatcher( EditText editText ) {
|
||||
if ( editText == null ) {
|
||||
private void attachSearchBoxTextWatcher(EditText editText) {
|
||||
if (editText == null) {
|
||||
return;
|
||||
}
|
||||
editText.addTextChangedListener(watcherAdapter);
|
||||
@@ -91,14 +94,14 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
|
||||
private final TextWatcherAdapter watcherAdapter = new TextWatcherAdapter() {
|
||||
@Override
|
||||
public void afterTextChanged( Editable s ) {
|
||||
public void afterTextChanged(Editable s) {
|
||||
// 避免 disable 设置内容时触发
|
||||
final String input = s.toString();
|
||||
startSearchPoiByInput( input );
|
||||
startSearchPoiByInput(input);
|
||||
}
|
||||
};
|
||||
|
||||
public void startSearchPoiByInput( String keyword ) {
|
||||
public void startSearchPoiByInput(String keyword) {
|
||||
MogoInputtipsQuery mogoInputtipsQuery = new MogoInputtipsQuery();
|
||||
mogoInputtipsQuery.setKeyword(keyword);
|
||||
|
||||
@@ -111,59 +114,70 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
|
||||
inputtipsSearch.setInputtipsListener(new IMogoInputtipsListener() {
|
||||
@Override public void onGetInputtips(List<MogoTip> result) {
|
||||
mView.renderSearchPoiResult(result,false);
|
||||
mView.renderSearchPoiResult(result, false);
|
||||
}
|
||||
});
|
||||
inputtipsSearch.requestInputtipsAsyn();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存搜索到的导航地址
|
||||
*
|
||||
* @param tip
|
||||
* @return
|
||||
*/
|
||||
public Single cacheSelectPoiItem( MogoTip tip ) {
|
||||
return Single.create( emitter -> {
|
||||
SearchPoi poi = EntityConvertUtils.tipToPoi( tip );
|
||||
public Single cacheSelectPoiItem(MogoTip tip) {
|
||||
return Single.create(emitter -> {
|
||||
SearchPoi poi = EntityConvertUtils.tipToPoi(tip);
|
||||
//ignore insert result
|
||||
final List<Long> output = AppDataBase.getDatabase( getContext() ).poiDao().insert( poi );
|
||||
emitter.onSuccess( output );
|
||||
} ).subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() );
|
||||
final List<Long> output = AppDataBase.getDatabase(getContext()).poiDao().insert(poi);
|
||||
emitter.onSuccess(output);
|
||||
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());
|
||||
}
|
||||
|
||||
public void addDisposable( Disposable disposable ) {
|
||||
mCompositeDisposable.add( disposable );
|
||||
public void addDisposable(Disposable disposable) {
|
||||
mCompositeDisposable.add(disposable);
|
||||
}
|
||||
|
||||
public void deleteAllCachedPoi() {
|
||||
|
||||
new AlertDialog.Builder( getContext() )
|
||||
.setMessage( "清空历史记录?" )
|
||||
.setPositiveButton( "立即清空", ( dlg, which ) -> {
|
||||
dlg.dismiss();
|
||||
//new AlertDialog.Builder( getContext() )
|
||||
// .setMessage( "清空历史记录?" )
|
||||
// .setPositiveButton( "立即清空", ( dlg, which ) -> {
|
||||
// dlg.dismiss();
|
||||
// deleteAllCachedPoiImpl();
|
||||
// } )
|
||||
// .setNegativeButton( "取消", ( dlg, which ) -> {
|
||||
// dlg.dismiss();
|
||||
// } )
|
||||
// .create()
|
||||
// .show();
|
||||
|
||||
NoticeDialog noticeDialog = new NoticeDialog(getContext(),"清空历史记录?","立即清空");
|
||||
|
||||
//noticeDialog.setContent("清空历史记录?");
|
||||
//noticeDialog.setPositiveButton("立即清空");
|
||||
|
||||
noticeDialog.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
if (v.getId() == R.id.tv_dialog_ok) {
|
||||
deleteAllCachedPoiImpl();
|
||||
} )
|
||||
.setNegativeButton( "取消", ( dlg, which ) -> {
|
||||
dlg.dismiss();
|
||||
} )
|
||||
.create()
|
||||
.show();
|
||||
}
|
||||
}
|
||||
});
|
||||
noticeDialog.show();
|
||||
}
|
||||
|
||||
private void deleteAllCachedPoiImpl() {
|
||||
final Disposable disposable = AppDataBase.getDatabase( getContext() )
|
||||
.poiDao()
|
||||
.getAll()
|
||||
.map( input -> {
|
||||
return AppDataBase.getDatabase( getContext() ).poiDao().deleteAll( input );
|
||||
} )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( count -> {
|
||||
mView.showHistory( null );
|
||||
} );
|
||||
mCompositeDisposable.add( disposable );
|
||||
final Disposable disposable = AppDataBase.getDatabase(getContext())
|
||||
.poiDao()
|
||||
.getAll()
|
||||
.map(input -> {
|
||||
return AppDataBase.getDatabase(getContext()).poiDao().deleteAll(input);
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(count -> {
|
||||
mView.showHistory(null);
|
||||
});
|
||||
mCompositeDisposable.add(disposable);
|
||||
}
|
||||
//
|
||||
///**
|
||||
@@ -197,9 +211,9 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
//
|
||||
//
|
||||
|
||||
private void emitterCommonAddress( SingleEmitter<List<Long>> emitter, SearchPoi poi ) {
|
||||
private void emitterCommonAddress(SingleEmitter<List<Long>> emitter, SearchPoi poi) {
|
||||
String poiId = null;
|
||||
switch ( mView.getSearchType() ) {
|
||||
switch (mView.getSearchType()) {
|
||||
case SearchConstants.SEARCH_TYPE_MULTI_HOME:
|
||||
poiId = DataConstants.POI_ID_HOME;
|
||||
break;
|
||||
@@ -207,20 +221,20 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
poiId = DataConstants.POI_ID_COMPANY;
|
||||
break;
|
||||
}
|
||||
if ( TextUtils.isEmpty( poiId ) ) {
|
||||
emitter.onError( new IllegalArgumentException( "设置类型错误,请重试" ) );
|
||||
if (TextUtils.isEmpty(poiId)) {
|
||||
emitter.onError(new IllegalArgumentException("设置类型错误,请重试"));
|
||||
return;
|
||||
}
|
||||
if ( poi == null ) {
|
||||
emitter.onError( new IllegalArgumentException( "位置类型转换错误,请重试" ) );
|
||||
if (poi == null) {
|
||||
emitter.onError(new IllegalArgumentException("位置类型转换错误,请重试"));
|
||||
return;
|
||||
}
|
||||
poi.setpId( poiId );
|
||||
poi.setType( mView.getSearchType() );
|
||||
poi.setpId(poiId);
|
||||
poi.setType(mView.getSearchType());
|
||||
//ignore insert result
|
||||
final List<Long> output = AppDataBase.getDatabase( getContext() ).poiDao().insert( poi );
|
||||
final List<Long> output = AppDataBase.getDatabase(getContext()).poiDao().insert(poi);
|
||||
notifyAIAssistCommonAddressChanged();
|
||||
emitter.onSuccess( output );
|
||||
emitter.onSuccess(output);
|
||||
}
|
||||
|
||||
private void notifyAIAssistCommonAddressChanged() {
|
||||
@@ -232,12 +246,11 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
public void navi2Positon(){
|
||||
public void navi2Positon() {
|
||||
//mMapService.getNavi(getContext()).naviTo();
|
||||
}
|
||||
|
||||
public void insert(SearchPoi searchPoi){
|
||||
public void insert(SearchPoi searchPoi) {
|
||||
Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
AppDataBase.getDatabase(getContext()).poiDao().insert(searchPoi);
|
||||
@@ -245,23 +258,21 @@ public class SearchPresenter extends Presenter< SearchView >
|
||||
}).subscribeOn(Schedulers.io()).subscribe();
|
||||
}
|
||||
|
||||
public void clearHistory(List<SearchPoi> list){
|
||||
Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
AppDataBase.getDatabase(getContext()).poiDao().deleteAll(list);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).subscribe();
|
||||
}
|
||||
|
||||
|
||||
public void clearHistory(List<SearchPoi> list) {
|
||||
Observable.create(new ObservableOnSubscribe<String>() {
|
||||
@Override public void subscribe(ObservableEmitter<String> emitter) throws Exception {
|
||||
AppDataBase.getDatabase(getContext()).poiDao().deleteAll(list);
|
||||
}
|
||||
}).subscribeOn(Schedulers.io()).subscribe();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy( @NonNull LifecycleOwner owner ) {
|
||||
super.onDestroy( owner );
|
||||
if ( mView.getSearchBox() != null ) {
|
||||
mView.getSearchBox().removeTextChangedListener( watcherAdapter );
|
||||
public void onDestroy(@NonNull LifecycleOwner owner) {
|
||||
super.onDestroy(owner);
|
||||
if (mView.getSearchBox() != null) {
|
||||
mView.getSearchBox().removeTextChangedListener(watcherAdapter);
|
||||
}
|
||||
if ( mCompositeDisposable != null && !mCompositeDisposable.isDisposed() ) {
|
||||
if (mCompositeDisposable != null && !mCompositeDisposable.isDisposed()) {
|
||||
mCompositeDisposable.dispose();
|
||||
mCompositeDisposable = null;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,9 @@ import com.mogo.utils.UiThreadHandler
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.ObservableOnSubscribe
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import kotlinx.android.synthetic.main.fragment_setting_address.et_navi_search
|
||||
import kotlinx.android.synthetic.main.fragment_setting_address.iv_navi_back
|
||||
import kotlinx.android.synthetic.main.fragment_setting_address.tv_set_as_home
|
||||
import kotlinx.android.synthetic.main.include_search_bar.et_navi_search
|
||||
import kotlinx.android.synthetic.main.include_search_bar.iv_navi_back
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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="#3E7FFC"
|
||||
android:startColor="#5CC1FF" />
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?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="#333F4057" />
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/dp_790"
|
||||
android:layout_height="@dimen/dp_440"
|
||||
android:orientation="vertical"
|
||||
app:cardBackgroundColor="#3F4057"
|
||||
app:cardCornerRadius="@dimen/dp_20"
|
||||
>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dialog_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_56"
|
||||
android:layout_marginTop="@dimen/dp_134"
|
||||
android:text="是否退出导航?"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_40"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dialog_ok"
|
||||
android:layout_width="@dimen/dp_395"
|
||||
android:layout_height="@dimen/dp_128"
|
||||
android:background="@drawable/shape_react_blue_grident"
|
||||
android:gravity="center"
|
||||
android:text="确认"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_dialog_cancel"
|
||||
android:layout_width="@dimen/dp_395"
|
||||
android:layout_height="@dimen/dp_128"
|
||||
android:background="@drawable/shape_react_gray_grident"
|
||||
android:gravity="center"
|
||||
android:text="取消"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
/>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -9,7 +9,46 @@
|
||||
android:paddingTop="@dimen/dp_40"
|
||||
>
|
||||
|
||||
<include layout="@layout/include_search_bar" />
|
||||
<LinearLayout
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll_navi_search"
|
||||
android:layout_width="@dimen/moudle_search_et_width"
|
||||
android:layout_height="@dimen/moudle_search_et_hight"
|
||||
android:background="@drawable/shape_round_gray"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:showIn="@layout/fragment_search"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="@dimen/moudle_search_iv_back_hight"
|
||||
android:id="@+id/iv_navi_back"
|
||||
android:layout_height="@dimen/moudle_search_iv_back_hight"
|
||||
android:layout_marginLeft="@dimen/moudle_search_iv_back_margin_left"
|
||||
android:layout_marginRight="@dimen/moudle_search_iv_back_margin_right"
|
||||
android:src="@mipmap/icon_back"
|
||||
/>
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:singleLine="true"
|
||||
android:layout_marginRight="@dimen/module_search_btn_width"
|
||||
android:id="@+id/et_navi_search"
|
||||
android:background="@null"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
|
||||
android:textSize="@dimen/module_search_et_text_size"
|
||||
android:imeOptions="actionDone"
|
||||
android:hint="@string/hint_map_search"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white_60"
|
||||
/>
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="@dimen/module_search_btn_width"
|
||||
|
||||
@@ -23,12 +23,13 @@
|
||||
<EditText
|
||||
android:layout_width="0dp"
|
||||
android:singleLine="true"
|
||||
android:layout_marginRight="@dimen/module_search_et_margin_right"
|
||||
android:layout_marginRight="@dimen/module_search_btn_width"
|
||||
android:id="@+id/et_navi_search"
|
||||
android:background="@null"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
|
||||
android:textSize="@dimen/module_search_et_text_size"
|
||||
android:imeOptions="actionDone"
|
||||
android:hint="@string/hint_map_search"
|
||||
|
||||
|
Before Width: | Height: | Size: 478 B After Width: | Height: | Size: 377 B |
|
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 531 B |
@@ -259,6 +259,7 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
mIntentManager.registerIntentListener( Intent.ACTION_POWER_CONNECTED, this );
|
||||
mIntentManager.registerIntentListener( Intent.ACTION_POWER_DISCONNECTED, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_NWD_ACC, this );
|
||||
mIntentManager.registerIntentListener( MogoReceiver.ACTION_VOICE_UI, this );
|
||||
}
|
||||
|
||||
private void registerAIReceiver( Context context ) {
|
||||
@@ -285,6 +286,8 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
// acc On
|
||||
filter.addAction( Intent.ACTION_POWER_CONNECTED );
|
||||
filter.addAction( Intent.ACTION_POWER_DISCONNECTED );
|
||||
// 小智语音
|
||||
filter.addAction( MogoReceiver.ACTION_VOICE_UI );
|
||||
try {
|
||||
context.getApplicationContext().registerReceiver( mAIAssistReceiver, filter );
|
||||
Logger.i( TAG, "register voice receiver." );
|
||||
@@ -612,6 +615,13 @@ public class MogoServiceProvider implements IMogoModuleProvider,
|
||||
} else if ( MogoReceiver.ACTION_NWD_ACC.equals( command ) ) {
|
||||
int state = intent.getByteExtra( MogoReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
|
||||
mStatusManager.setAccStatus( getModuleName(), state == 1 );
|
||||
} else if ( MogoReceiver.ACTION_VOICE_UI.equals( command ) ) {
|
||||
String val = intent.getStringExtra( MogoReceiver.PARRAM_WAKE_STATUS );
|
||||
if ( TextUtils.equals( val, MogoReceiver.VALUE_DISMISS ) ) {
|
||||
mStatusManager.setVoiceUIShow( TAG, false );
|
||||
} else if ( TextUtils.equals( val, MogoReceiver.VALUE_SHOW ) ) {
|
||||
mStatusManager.setVoiceUIShow( TAG, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
// 诺威达 acc 状态
|
||||
public static final String PARAM_ACC_STATUS = "extra_mcu_state";
|
||||
|
||||
// 小智语音唤醒UI
|
||||
public static final String ACTION_VOICE_UI = "com.zhidao.xiaozhi.wake.status";
|
||||
public static final String PARRAM_WAKE_STATUS = "WAKE_STATUS";
|
||||
public static final String VALUE_DISMISS = "dismiss";
|
||||
public static final String VALUE_SHOW = "show";
|
||||
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
|
||||
public MogoReceiver( Context context ) {
|
||||
|
||||
@@ -955,6 +955,7 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
|
||||
String poiType = "";
|
||||
if (event.type.equals("1")) { //上报路况
|
||||
poiType = "10001";
|
||||
mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
|
||||
} else if (event.type.equals("2")) { //交通检查 10002
|
||||
poiType = "10002";
|
||||
@@ -984,16 +985,18 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
Log.d(TAG, "onMarkerInfo share onCompleted ---!poiType--- else ---->");
|
||||
}
|
||||
|
||||
//请求分享接口
|
||||
if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
|
||||
MarkerExploreWay markerExploreWay = markerExploreWayList.get(0);
|
||||
if (markerExploreWay.getUserInfo() != null && !TextUtils.isEmpty(poiType)) { //上报路况不使用这个接口
|
||||
uploadShareInfo(poiType, event.imageUrl, markerExploreWay.getUserInfo().getUserName(),
|
||||
markerExploreWay.getUserInfo().getUserHead());
|
||||
//请求分享接口,只有封路和交通检查走新接口,老接口只有上报拥堵使用,并且定时任务都是拥堵的type
|
||||
if (poiType.equals("10002") || poiType.equals("10003")) {
|
||||
if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
|
||||
MarkerExploreWay markerExploreWay = markerExploreWayList.get(0);
|
||||
if (markerExploreWay.getUserInfo() != null && !TextUtils.isEmpty(poiType)) { //上报路况不使用这个接口
|
||||
uploadShareInfo(poiType, event.imageUrl, markerExploreWay.getUserInfo().getUserName(),
|
||||
markerExploreWay.getUserInfo().getUserHead());
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "onMarkerInfo share markerExploreWayList = null");
|
||||
uploadShareInfo(poiType, event.imageUrl, "", "");
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "onMarkerInfo share markerExploreWayList = null");
|
||||
uploadShareInfo(poiType, event.imageUrl, "", "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||