code opt
This commit is contained in:
@@ -87,83 +87,6 @@ public abstract class BaseSearchFragment extends BaseFragment implements SearchV
|
||||
mSearchBox = view.findViewById(R.id.et_navi_search);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchMyLocationUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_MY_LOCATION;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// //removeChoicePointMarker();
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchChoicePointUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_CHOICE_POINT;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
private void saveCurrentLocationAsCommonAddress() {
|
||||
//if ( mLastAMapLocation == null ) {
|
||||
// shortToast( "定位失败,请重试" );
|
||||
// return;
|
||||
//}
|
||||
//final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( mLastAMapLocation ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
//}, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
//} );
|
||||
//mSearchPresenter.addDisposable( disposable );
|
||||
}
|
||||
|
||||
private void saveRegeoAddressAsCommonAddress() {
|
||||
//if ( mSearchBox.getTag() instanceof RegeocodeAddress ) {
|
||||
// final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( ( ( RegeocodeAddress ) mSearchBox.getTag() ) ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
// }, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
// } );
|
||||
// mSearchPresenter.addDisposable( disposable );
|
||||
//} else {
|
||||
// Toast.makeText( mContext, "请选择位置", Toast.LENGTH_SHORT ).show();
|
||||
//}
|
||||
}
|
||||
|
||||
// view interface
|
||||
|
||||
|
||||
@@ -231,91 +231,6 @@ public class SearchFragment extends BaseSearchFragment
|
||||
.registerUnWakeupCommand(WASH_CMD, new String[] { "洗车" }, this);
|
||||
}
|
||||
|
||||
private void push(Fragment fragment, String tag) {
|
||||
FragmentDescriptor.Builder builder = new FragmentDescriptor.Builder();
|
||||
builder.fragment(fragment);
|
||||
FragmentDescriptor build =
|
||||
builder.tag(tag).build();
|
||||
SearchServiceHolder.INSTANCE.getFragmentManager().push(build);
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchMyLocationUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_MY_LOCATION;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// //removeChoicePointMarker();
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* 显示我的位置,并且可设置为家
|
||||
*/
|
||||
//private void multiSearchChoicePointUI() {
|
||||
// mUiMode = SearchConstants.UI_MODE_MULTI_CHOICE_POINT;
|
||||
// mSearchBox.setEnabled( false );
|
||||
// mMyLocation.setVisibility( View.GONE );
|
||||
// mChoicePoint.setVisibility( View.GONE );
|
||||
// mCurrentLocation.setVisibility( View.GONE );
|
||||
// mSearchResult.setVisibility( View.GONE );
|
||||
// mActionButton.setVisibility( View.VISIBLE );
|
||||
// mActionButton.setText( SearchUtils.getSearchTypeActionName( mSearchType ) );
|
||||
// mSearchBox.setCompoundDrawables( null, null, null, null );
|
||||
// mSearchBox.setTag( null );
|
||||
// if ( mSearchBox.getLayoutParams() instanceof RelativeLayout.LayoutParams ) {
|
||||
// final RelativeLayout.LayoutParams params = ( ( RelativeLayout.LayoutParams ) mSearchBox.getLayoutParams() );
|
||||
// params.addRule( RelativeLayout.LEFT_OF, R.id.amap_search_action_setting );
|
||||
// mSearchBox.setPadding( 0, 0, WindowUtils.dip2px( mContext, 15 ), 0 );
|
||||
// mSearchBox.setLayoutParams( params );
|
||||
// }
|
||||
//}
|
||||
private void saveCurrentLocationAsCommonAddress() {
|
||||
//if ( mLastAMapLocation == null ) {
|
||||
// shortToast( "定位失败,请重试" );
|
||||
// return;
|
||||
//}
|
||||
//final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( mLastAMapLocation ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
//}, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
//} );
|
||||
//mSearchPresenter.addDisposable( disposable );
|
||||
}
|
||||
|
||||
private void saveRegeoAddressAsCommonAddress() {
|
||||
//if ( mSearchBox.getTag() instanceof RegeocodeAddress ) {
|
||||
// final Disposable disposable = mSearchPresenter.cacheCommonAddressPoi( ( ( RegeocodeAddress ) mSearchBox.getTag() ) ).subscribe( output -> {
|
||||
// Toast.makeText( mContext, "设置成功!", Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = true;
|
||||
// }, error -> {
|
||||
// if ( error instanceof Exception) {
|
||||
// Toast.makeText( mContext, ( (Exception) error ).getMessage(), Toast.LENGTH_SHORT ).show();
|
||||
// mActionSuccess = false;
|
||||
// }
|
||||
// } );
|
||||
// mSearchPresenter.addDisposable( disposable );
|
||||
//} else {
|
||||
// Toast.makeText( mContext, "请选择位置", Toast.LENGTH_SHORT ).show();
|
||||
//}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSearchPoiResult(List<MogoTip> datums, boolean showDelete) {
|
||||
@@ -379,70 +294,6 @@ public class SearchFragment extends BaseSearchFragment
|
||||
|
||||
}
|
||||
|
||||
//@Override
|
||||
//public void renderChoicePointResult( RegeocodeAddress address ) {
|
||||
// if ( address == null ) {
|
||||
// mSearchBox.setTag( null );
|
||||
// mSearchBox.setText( "" );
|
||||
// return;
|
||||
// }
|
||||
// mSearchBox.setTag( address );
|
||||
// mSearchBox.setText( address.getFormatAddress() );
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public void renderErrorView() {
|
||||
//
|
||||
//}
|
||||
//
|
||||
//@Override
|
||||
//public void renderContentView() {
|
||||
//
|
||||
//}
|
||||
|
||||
// view interface end
|
||||
|
||||
///**
|
||||
// * 屏幕中心marker 跳动
|
||||
// */
|
||||
//@Override
|
||||
//public void startJumpAnimation() {
|
||||
//
|
||||
// final AMap aMap = mUiController.getAMapServiceVisitor().getMap();
|
||||
//
|
||||
// if ( mChoicePointMaker != null ) {
|
||||
// //根据屏幕距离计算需要移动的目标点
|
||||
// final LatLng latLng = mChoicePointMaker.getPosition();
|
||||
// Point point = aMap.getProjection().toScreenLocation( latLng );
|
||||
// point.y -= WindowUtils.dip2px( mContext, 125 );
|
||||
// LatLng target = aMap.getProjection()
|
||||
// .fromScreenLocation( point );
|
||||
// //使用TranslateAnimation,填写一个需要移动的目标点
|
||||
// Animation animation = new TranslateAnimation( target );
|
||||
// animation.setInterpolator( new Interpolator() {
|
||||
// @Override
|
||||
// public float getInterpolation( float input ) {
|
||||
// // 模拟重加速度的interpolator
|
||||
// if ( input <= 0.5 ) {
|
||||
// return ( float ) ( 0.5f - 2 * ( 0.5 - input ) * ( 0.5 - input ) );
|
||||
// } else {
|
||||
// return ( float ) ( 0.5f - Math.sqrt( ( input - 0.5f ) * ( 1.5f - input ) ) );
|
||||
// }
|
||||
// }
|
||||
// } );
|
||||
// //整个移动所需要的时间
|
||||
// animation.setDuration( 600 );
|
||||
// //设置动画
|
||||
// mChoicePointMaker.setAnimation( animation );
|
||||
// //开始动画
|
||||
// mChoicePointMaker.startAnimation();
|
||||
//
|
||||
// }
|
||||
//}
|
||||
|
||||
private void navi2Location(SearchPoi searchPoi) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出搜索,进行清理
|
||||
|
||||
@@ -4,41 +4,33 @@ import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.View
|
||||
import android.view.animation.BounceInterpolator
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.map.MogoLatLng
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.marker.IMogoMarker
|
||||
import com.mogo.map.marker.MogoMarkerOptions
|
||||
import com.mogo.map.marker.anim.OnMarkerAnimationListener
|
||||
import com.mogo.map.search.geo.IMogoGeoSearchListener
|
||||
import com.mogo.map.search.geo.MogoGeocodeResult
|
||||
import com.mogo.map.search.geo.MogoRegeocodeResult
|
||||
import com.mogo.map.search.geo.query.MogoRegeocodeQuery
|
||||
import com.mogo.module.common.MogoModulePaths
|
||||
import com.mogo.module.common.adapter.MogoMapListenerAdapter
|
||||
import com.mogo.module.common.map.MapCenterPointStrategy
|
||||
import com.mogo.module.common.map.Scene
|
||||
import com.mogo.module.navi.R
|
||||
import com.mogo.module.navi.R.string
|
||||
import com.mogo.module.navi.bean.EntityConvertUtils
|
||||
import com.mogo.module.navi.bean.SearchPoi
|
||||
import com.mogo.module.navi.constants.AMapConstants
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
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.database.AppDataBase
|
||||
import com.mogo.module.navi.manager.AddressManager
|
||||
import com.mogo.module.navi.ui.base.BaseFragment
|
||||
import com.mogo.utils.TipToast
|
||||
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.fragment_setting_address.*
|
||||
|
||||
/**
|
||||
* @author zyz
|
||||
@@ -131,8 +123,7 @@ class SettingAddressFragment : BaseFragment(), IMogoGeoSearchListener {
|
||||
}
|
||||
tv_set_as_home.setOnClickListener {
|
||||
if (selectPoi == null) {
|
||||
Toast.makeText(context, "请选择", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
TipToast.shortTip("请选择")
|
||||
return@setOnClickListener
|
||||
}
|
||||
insert(selectPoi!!)
|
||||
|
||||
Reference in New Issue
Block a user