From 3a8f39678c3e5ae89c4f6524a6f2e7de21861222 Mon Sep 17 00:00:00 2001 From: wangcongtao Date: Mon, 25 May 2020 14:36:08 +0800 Subject: [PATCH] opt --- gradle.properties | 2 +- .../common/map/MapCenterPointStrategy.java | 4 +- .../module/common/wm/WindowManagerView.java | 2 +- .../mogo/module/navi/dialog/NoticeDialog.java | 91 -------- .../navi/ui/search/CategorySearchFragment.kt | 19 +- .../navi/ui/search/SearchPresenter.java | 196 +++++++++--------- .../mogo/module/navi/uitls/BitmapUtils.java | 69 +++--- .../main/res/layout/dialog_common_notice.xml | 60 ------ .../src/main/res/layout/fragment_search.xml | 8 +- .../res/layout/fragment_search_category.xml | 10 +- .../res/layout/fragment_setting_address.xml | 12 +- .../main/res/layout/include_search_bar.xml | 12 +- .../src/main/res/values-ldpi/dimens.xml | 15 +- .../src/main/res/values-xhdpi/dimens.xml | 47 +++++ .../src/main/res/values/dimens.xml | 15 +- 15 files changed, 227 insertions(+), 335 deletions(-) delete mode 100644 modules/mogo-module-search/src/main/java/com/mogo/module/navi/dialog/NoticeDialog.java delete mode 100644 modules/mogo-module-search/src/main/res/layout/dialog_common_notice.xml create mode 100644 modules/mogo-module-search/src/main/res/values-xhdpi/dimens.xml diff --git a/gradle.properties b/gradle.properties index 73a90f4ee9..75c867a601 100644 --- a/gradle.properties +++ b/gradle.properties @@ -24,7 +24,7 @@ SNAPSHOT_REPOSITORY_URL=http://nexus.zhidaoauto.com/repository/maven-snapshots/ USERNAME=xintai PASSWORD=xintai2018 # 编译模式: false - 依赖本地版本, true - 依赖 maven 版本 -RELEASE=true +RELEASE=false # 模块版本 ## 工程内模块 MOGO_COMMONS_VERSION=1.1.0.7 diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java index c560808406..fa5f1578d3 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/map/MapCenterPointStrategy.java @@ -82,8 +82,8 @@ public class MapCenterPointStrategy { { // 分类搜索,定位视图右边 Map< Integer, MapCenterPoint > categorySearch = new HashMap<>(); - categorySearch.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.610833D ) ); - categorySearch.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.733594D, 0.596759D ) ); + categorySearch.put( CarSeries.CAR_SERIES_D80X, new MapCenterPoint( 0.733398D, 0.5D ) ); + categorySearch.put( CarSeries.CAR_SERIES_F80X, new MapCenterPoint( 0.733594D, 0.5D ) ); sStrategies.put( Scene.CATEGORY_SEARCH, categorySearch ); } diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerView.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerView.java index 29db8cd8fb..4c60022b5d 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerView.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/wm/WindowManagerView.java @@ -42,7 +42,7 @@ public class WindowManagerView { } mLayoutParams.format = PixelFormat.TRANSLUCENT; mLayoutParams.gravity = Gravity.CENTER; - mLayoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH; + mLayoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) { mLayoutParams.width = 1920; diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/dialog/NoticeDialog.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/dialog/NoticeDialog.java deleted file mode 100644 index d1379e06c0..0000000000 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/dialog/NoticeDialog.java +++ /dev/null @@ -1,91 +0,0 @@ -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); - } - } -} diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt index 4dccdb5b3f..b109fef994 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/CategorySearchFragment.kt @@ -64,7 +64,11 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa ) var createWaterMask = BitmapUtils.createWaterMask( - context, decodeResource, (index + 1).toString(), R.color.white, 18 + context, + decodeResource, + (index + 1).toString(), + R.color.white, + resources.getDimensionPixelSize(R.dimen.module_search_marker_number_textSize) ) val options = MogoMarkerOptions() .icon(createWaterMask) @@ -74,7 +78,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa // .anchor(0.5f, 1f) .longitude(datums[index].point?.lng ?: 0.0) arrayList.add(options) - if( locationList.size < 3 ){ + if (locationList.size < 3) { locationList.add(datums[index].point) } @@ -178,7 +182,7 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa } } - private fun updateMarker(moveToCenter:Boolean = true) { + private fun updateMarker(moveToCenter: Boolean = true) { addMarkers?.get(mAdapter.lastPosition)?.setIcon(getMarkerIcon(mAdapter.lastPosition)) var current = addMarkers?.get(mAdapter.current) @@ -198,10 +202,13 @@ class CategorySearchFragment : BaseFragment(), CategoryView, IMogoVoiceCmdCallBa if (mAdapter.current == index) R.mipmap.icon_search_category_checked else R.mipmap.icon_search_category_unchecked ) - var createWaterMask = BitmapUtils.createWaterMask( - context, decodeResource, (index + 1).toString(), R.color.white, 18 + return BitmapUtils.createWaterMask( + context, + decodeResource, + (index + 1).toString(), + R.color.white, + resources.getDimensionPixelSize(R.dimen.module_search_marker_number_textSize) ) - return createWaterMask } override fun onActivityCreated(savedInstanceState: Bundle?) { diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java index d6ebbb5cfc..95e4444621 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/ui/search/SearchPresenter.java @@ -2,7 +2,6 @@ package com.mogo.module.navi.ui.search; import android.text.Editable; import android.text.TextUtils; -import android.view.View; import android.widget.EditText; import androidx.annotation.NonNull; @@ -16,13 +15,12 @@ import com.mogo.map.search.inputtips.IMogoInputtipsSearch; import com.mogo.map.search.inputtips.MogoTip; import com.mogo.map.search.inputtips.query.MogoInputtipsQuery; import com.mogo.module.common.TextWatcherAdapter; -import com.mogo.module.navi.R; +import com.mogo.module.common.dialog.WMDialog; 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.SearchApisHolder; 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; @@ -45,94 +43,95 @@ import io.reactivex.schedulers.Schedulers; *

* 搜搜页逻辑处理 */ -public class SearchPresenter extends Presenter { +public class SearchPresenter extends Presenter< SearchView > { private CompositeDisposable mCompositeDisposable; 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 = - AppDataBase.getDatabase(getContext()) - .poiDao() - .getAll() - .subscribeOn(Schedulers.io()) - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(new Consumer>() { - @Override public void accept(List searchPois) throws Exception { - mView.showHistory(searchPois); - } - }); + AppDataBase.getDatabase( getContext() ) + .poiDao() + .getAll() + .subscribeOn( Schedulers.io() ) + .observeOn( AndroidSchedulers.mainThread() ) + .subscribe( new Consumer< List< SearchPoi > >() { + @Override + public void accept( List< SearchPoi > searchPois ) throws Exception { + mView.showHistory( searchPois ); + } + } ); - addDisposable(subscribe); + addDisposable( subscribe ); } - private void attachSearchBoxTextWatcher(EditText editText) { - if (editText == null) { + private void attachSearchBoxTextWatcher( EditText editText ) { + if ( editText == null ) { return; } - editText.addTextChangedListener(watcherAdapter); + editText.addTextChangedListener( watcherAdapter ); } 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); + mogoInputtipsQuery.setKeyword( keyword ); MogoLocation lastKnowLocation = SearchApisHolder.getLocationClientApis().getLastKnowLocation(); - mogoInputtipsQuery.setCity(lastKnowLocation.getCityName()); - mogoInputtipsQuery.setCityLimit(true); + mogoInputtipsQuery.setCity( lastKnowLocation.getCityName() ); + mogoInputtipsQuery.setCityLimit( true ); IMogoInputtipsSearch inputtipsSearch = - mMapService.getInputtipsSearch(getContext(), mogoInputtipsQuery); + mMapService.getInputtipsSearch( getContext(), mogoInputtipsQuery ); - inputtipsSearch.setInputtipsListener(new IMogoInputtipsListener() { - @Override public void onGetInputtips(List result) { - mView.renderSearchPoiResult(result, false); + inputtipsSearch.setInputtipsListener( new IMogoInputtipsListener() { + @Override + public void onGetInputtips( List< MogoTip > result ) { + mView.renderSearchPoiResult( result, false ); } - }); + } ); inputtipsSearch.requestInputtipsAsyn(); } /** * 缓存搜索到的导航地址 */ - 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 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 ); } - private NoticeDialog noticeDialog; - + private WMDialog dlg; public void deleteAllCachedPoi() { //new AlertDialog.Builder( getContext() ) @@ -147,40 +146,39 @@ public class SearchPresenter extends Presenter { // .create() // .show(); - 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) { + dlg = new WMDialog.Builder( getContext() ) + .setContent( "清空历史记录?" ) + .setCancelButton( "取消", ( ( dialog, which ) -> { + dialog.dismiss(); + } ) ) + .setOkButton( "立即清空", ( ( dialog, which ) -> { deleteAllCachedPoiImpl(); - } - } - }); - noticeDialog.show(); + dialog.dismiss(); + } ) ) + .build(); + dlg.show(); } - public void hideDialog(){ - if (noticeDialog != null) { - noticeDialog.dismiss(); + public void hideDialog() { + if ( dlg != null ) { + dlg.dismiss(); } } public 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 ); } // ///** @@ -214,9 +212,9 @@ public class SearchPresenter extends Presenter { // // - private void emitterCommonAddress(SingleEmitter> 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; @@ -224,20 +222,20 @@ public class SearchPresenter extends Presenter { 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 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() { @@ -253,29 +251,31 @@ public class SearchPresenter extends Presenter { //mMapService.getNavi(getContext()).naviTo(); } - public void insert(SearchPoi searchPoi) { - Observable.create(new ObservableOnSubscribe() { - @Override public void subscribe(ObservableEmitter emitter) throws Exception { - AppDataBase.getDatabase(getContext()).poiDao().insert(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 ); } - }).subscribeOn(Schedulers.io()).subscribe(); + } ).subscribeOn( Schedulers.io() ).subscribe(); } - public void clearHistory(List list) { - Observable.create(new ObservableOnSubscribe() { - @Override public void subscribe(ObservableEmitter emitter) throws Exception { - AppDataBase.getDatabase(getContext()).poiDao().deleteAll(list); + 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(); + } ).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; } diff --git a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/uitls/BitmapUtils.java b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/uitls/BitmapUtils.java index d5837536b3..defe711056 100644 --- a/modules/mogo-module-search/src/main/java/com/mogo/module/navi/uitls/BitmapUtils.java +++ b/modules/mogo-module-search/src/main/java/com/mogo/module/navi/uitls/BitmapUtils.java @@ -5,27 +5,31 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Rect; + import androidx.core.content.ContextCompat; +import com.mogo.module.common.utils.CarSeries; + /** * @author zyz * 2020-01-13. */ public class BitmapUtils { - public static Bitmap createWaterMask(Context context, Bitmap src, String text, int textColor, - int textSize) { - Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - paint.setColor(ContextCompat.getColor(context, textColor)); - paint.setTextSize(dp2px(context, textSize)); - paint.setDither(true); // 获取跟清晰的图像采样 - paint.setFilterBitmap(true);// 过滤一些 + public static Bitmap createWaterMask( Context context, Bitmap src, String text, int textColor, + int textSize ) { + Paint paint = new Paint( Paint.ANTI_ALIAS_FLAG ); + paint.setColor( ContextCompat.getColor( context, textColor ) ); + paint.setTextSize( textSize ); + + paint.setDither( true ); // 获取跟清晰的图像采样 + paint.setFilterBitmap( true );// 过滤一些 int width = src.getWidth(); int height = src.getHeight(); //创建一个bitmap Rect bounds = new Rect(); - paint.getTextBounds(text, 0, text.length(), bounds); + paint.getTextBounds( text, 0, text.length(), bounds ); //// 创建一个新的和SRC长度宽度一样的位图 //Bitmap newb = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); ////将该图片作为画布 @@ -33,38 +37,30 @@ public class BitmapUtils { ////在画布 0,0坐标上开始绘制原始图片 Bitmap.Config config = src.getConfig(); - if (config == null) { + if ( config == null ) { config = android.graphics.Bitmap.Config.ARGB_8888; } // 绘制文字 - Bitmap ret = src.copy(config, true); + Bitmap ret = src.copy( config, true ); //Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); - Canvas canvas = new Canvas(ret); + Canvas canvas = new Canvas( ret ); - int i = Integer.parseInt(text); + int i = Integer.parseInt( text ); - if (isLow(context)) { - if (i == 1) { - canvas.drawText(text, (width - bounds.width() * 2) / 2.0F, - (float) (bounds.height() * 2.4), - paint); - } else { - canvas.drawText(text, (width - bounds.width()) / 2.0F, - (float) (bounds.height() * 1.9), - paint); - } + float x, y; + + if ( i == 1 ) { + // "1" 有点偏右 + x = ( width - bounds.width() ) / 2 - bounds.width() / 2; } else { - if (i == 1) { - canvas.drawText(text, (width - bounds.width()*1.8F) / 2.0F, - (float) (bounds.height() * 1.9), - paint); - }else { - - canvas.drawText(text, (width - bounds.width()*1.2F) / 2.0F, - (float) (bounds.height() * 1.9), - paint); - } + x = ( width - bounds.width() ) / 2; } + if ( CarSeries.CAR_SERIES_F80X == CarSeries.getSeries() ) { + y = ( height - bounds.height() ) / 2 + bounds.height() - 5.5f; + } else { + y = ( height - bounds.height() ) / 2 + bounds.height() - 2.5f; + } + canvas.drawText( text, x, y, paint ); // 保存 //canvas.save(); @@ -72,13 +68,4 @@ public class BitmapUtils { // 存储 return ret; } - - public static int dp2px(Context context, float dp) { - final float scale = context.getResources().getDisplayMetrics().density; - return (int) (dp * scale + 0.5f); - } - - public static boolean isLow(Context context) { - return context.getResources().getDisplayMetrics().density < 1; - } } diff --git a/modules/mogo-module-search/src/main/res/layout/dialog_common_notice.xml b/modules/mogo-module-search/src/main/res/layout/dialog_common_notice.xml deleted file mode 100644 index fbaf16fd9f..0000000000 --- a/modules/mogo-module-search/src/main/res/layout/dialog_common_notice.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/layout/fragment_search.xml b/modules/mogo-module-search/src/main/res/layout/fragment_search.xml index 9193db299c..57459ecbae 100644 --- a/modules/mogo-module-search/src/main/res/layout/fragment_search.xml +++ b/modules/mogo-module-search/src/main/res/layout/fragment_search.xml @@ -4,10 +4,10 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" - android:paddingBottom="@dimen/moudle_search_fragment_padding" - android:paddingLeft="@dimen/moudle_search_fragment_padding" - android:paddingRight="@dimen/moudle_search_fragment_padding" - android:paddingTop="@dimen/moudle_search_fragment_padding_top" + android:paddingBottom="@dimen/module_search_fragment_padding" + android:paddingLeft="@dimen/module_search_fragment_padding" + android:paddingRight="@dimen/module_search_fragment_padding" + android:paddingTop="@dimen/module_search_fragment_padding_top" android:clickable="true" tools:context=".ui.search.SearchFragment" style="@style/amap_fragment_container_padding_style" diff --git a/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml b/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml index 10e1904bb2..600aae8c77 100644 --- a/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml +++ b/modules/mogo-module-search/src/main/res/layout/fragment_search_category.xml @@ -100,7 +100,7 @@ xmlns:tools="http://schemas.android.com/tools" android:id="@+id/ll_navi_search" android:layout_width="@dimen/module_search_dp_838" - android:layout_height="@dimen/moudle_search_et_hight" + android:layout_height="@dimen/module_search_et_hight" android:background="@drawable/shape_round_gray" android:gravity="center_vertical" android:orientation="horizontal" @@ -109,11 +109,11 @@ tools:showIn="@layout/fragment_search" > - 32px - 32px - 640px - 64px - 42px - 12px - 10px + 32px + 32px + 640px + 64px + 42px + 12px + 10px 30px 22px 142px @@ -45,5 +45,6 @@ 96px 56px 100px + 18dp \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-search/src/main/res/values-xhdpi/dimens.xml new file mode 100644 index 0000000000..ed3dae2497 --- /dev/null +++ b/modules/mogo-module-search/src/main/res/values-xhdpi/dimens.xml @@ -0,0 +1,47 @@ + + + + @dimen/dp_60 + @dimen/dp_40 + 600dp + @dimen/dp_120 + @dimen/dp_80 + @dimen/dp_24 + @dimen/dp_20 + @dimen/dp_50 + 40px + 266px + 8px + 40px + 104px + 568px + 120px + 32px + 75px + 72px + 75px + 778px + 1200px + 32px + 40px + 60px + 37px + 268px + 236px + 180px + 80px + 70px + 25sp + 42px + 160px + 150px + 180dp + 120px + 45px + 838px + 184px + 104px + 154px + 32dp + + \ No newline at end of file diff --git a/modules/mogo-module-search/src/main/res/values/dimens.xml b/modules/mogo-module-search/src/main/res/values/dimens.xml index 25f203b349..ae0a7b7fe8 100644 --- a/modules/mogo-module-search/src/main/res/values/dimens.xml +++ b/modules/mogo-module-search/src/main/res/values/dimens.xml @@ -4,13 +4,13 @@ @dimen/dp_60 @dimen/sp_40 25sp - @dimen/dp_60 - @dimen/dp_40 - 600dp - @dimen/dp_120 - @dimen/dp_80 - @dimen/dp_24 - @dimen/dp_20 + @dimen/dp_60 + @dimen/dp_40 + 600dp + @dimen/dp_120 + @dimen/dp_80 + @dimen/dp_24 + @dimen/dp_20 @dimen/dp_50 40px 266px @@ -45,6 +45,7 @@ 184px 104px 154px + 32dp \ No newline at end of file