1. 优化单位显示

2. 去掉部分log
3. 其他优化
This commit is contained in:
wangcongtao
2020-11-16 17:46:21 +08:00
parent 3d27dbd5d0
commit b00acb8b56
20 changed files with 47 additions and 56 deletions

View File

@@ -2,6 +2,7 @@ package com.mogo.launcher;
import android.content.Context;
import android.content.Intent;
import android.os.Process;
import android.text.TextUtils;
import android.util.Log;
@@ -27,6 +28,7 @@ import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.service.passport.IMogoTicketCallback;
import com.mogo.test.crashreport.ITestCrashReportProvider;
import com.mogo.utils.ProcessUtils;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.LogLevel;
import com.mogo.utils.logger.Logger;
@@ -90,7 +92,7 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor" ) );
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_GLOBAL_UNWAKE,"GlobalUnwake"));
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake" ) );
if ( !DebugConfig.isLauncher() ) {
PersistentManager.getInstance().initManager( this );
@@ -109,13 +111,11 @@ public class MogoApplication extends AbsMogoApplication {
@Override
protected boolean shouldInit() {
return !LeakCanary.isInAnalyzerProcess( this );
Logger.w( TAG, "evaluate shouldInit() with: %s", ProcessUtils.getProcessName( Process.myPid() ) );
return ProcessUtils.isMainProcess( this );
}
private void initDebugConfig() {
if ( !shouldInit() ) {
return;
}
DebugConfig.setNetMode( BuildConfig.NET_ENV );
DebugConfig.setDebug( BuildConfig.DEBUG );
DebugConfig.setLaunchLocationService( BuildConfig.LAUNCH_LOCATION_SERVICE );
@@ -186,10 +186,12 @@ public class MogoApplication extends AbsMogoApplication {
private void prepareSocketAndLocationServices( IMogoServiceApis apis ) {
apis.getSocketManagerApi( getApplicationContext() ).init( getApplicationContext(), DebugConfig.getSocketAppId() );
apis.getLocationInfoApi().start();
apis.getMapServiceApi().getSingletonLocationClient( getApplicationContext() ).addLocationListener( location -> {
apis.getLocationInfoApi().provideLocation( location );
} );
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
apis.getLocationInfoApi().start();
apis.getMapServiceApi().getSingletonLocationClient( getApplicationContext() ).addLocationListener( location -> {
apis.getLocationInfoApi().provideLocation( location );
} );
}
}
@Override

View File

@@ -144,7 +144,6 @@ public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallbac
if ( listener != null ) {
listener.onAck( msgId );
}
Logger.d( TAG, "send message success: msgType = %d, appId = %s, productLine = %d", msgType, appId, productLine );
} catch ( InvalidProtocolBufferException e ) {
e.printStackTrace();
}

View File

@@ -67,7 +67,7 @@ public class ProcessUtils {
* @param pid 进程号
* @return 进程名
*/
private static String getProcessName( int pid ) {
public static String getProcessName( int pid ) {
BufferedReader reader = null;
try {
reader = new BufferedReader( new FileReader( "/proc/" + pid + "/cmdline" ) );

View File

@@ -874,7 +874,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
} else {
if ( ( int ) location.getBearing() == 0
&& mLastDriveLocationShadow != null ) {
if ( mMyLocationMarker == null ) {
if ( mMyLocationMarker == null || mMyLocationMarker.isRemoved() ) {
initMyLocationMarker();
}
if ( mMyLocationMarker != null ) {

View File

@@ -58,7 +58,6 @@ public class AutoNaviReceiver extends BroadcastReceiver {
}
int keyType = intent.getIntExtra( "KEY_TYPE", 0 );
Logger.d( TAG, "receive: keyType = %d", keyType );
switch ( keyType ) {
case 10001:
handleAutoNaviInfo( context, intent );

View File

@@ -14,8 +14,16 @@ import java.lang.reflect.Method;
*/
public class CarSeries {
public static boolean isF8xxSeries(){
return DebugConfig.getProductFlavor().startsWith( "f8" );
private static boolean invokeFlag = false;
private static boolean isF8xxSeries = false;
public static boolean isF8xxSeries() {
if ( invokeFlag ) {
return isF8xxSeries;
}
isF8xxSeries = DebugConfig.getProductFlavor().startsWith( "f8" );
invokeFlag = true;
return isF8xxSeries;
}
@Deprecated
@@ -46,6 +54,12 @@ public class CarSeries {
@Deprecated
public static int CAR_SERIES = 0;
/**
* Deprecated.
* Use {@link DebugConfig#getProductFlavor()} instead.
*
* @return
*/
@Deprecated
public static int getSeries() {
if ( CAR_SERIES != 0 ) {

View File

@@ -34,27 +34,27 @@ public abstract class BaseNaviInfoView {
protected void fillNextCrossDistance( TextView target, TextView unit, int distance ) {
if ( distance >= 1000 ) {
target.setText( String.format( "%.1f", distance / 1000f ) );
unit.setText( "km" );
unit.setText( "公里" );
} else {
target.setText( distance + "" );
unit.setText( "m" );
unit.setText( "" );
}
}
protected void fillFormatSurplusDistance( int m, StringBuilder builder ) {
if ( m >= 1000 ) {
builder.append( String.format( "%.1fkm", m / 1000f ) );
builder.append( String.format( "%.1f公里", m / 1000f ) );
} else {
builder.append( m ).append( "m" );
builder.append( m ).append( "" );
}
}
protected String getFormatSurplusDistance( int m ) {
if ( m >= 1000 ) {
mFormatSurplusDistanceUnit = "km";
mFormatSurplusDistanceUnit = "公里";
return String.format( "%.1f", m / 1000f );
} else {
mFormatSurplusDistanceUnit = "m";
mFormatSurplusDistanceUnit = "";
return String.format( "%d", m );
}
}

View File

@@ -432,7 +432,6 @@ public class EventDispatchCenter implements
@Override
public void onLocationChanged( MogoLocation location ) {
final long start = System.currentTimeMillis();
Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
if ( iterator == null ) {
return;
@@ -447,7 +446,6 @@ public class EventDispatchCenter implements
}
}
}
Logger.i( TAG, "onLocationChanged event cost " + ( System.currentTimeMillis() - start ) + "ms" );
}
@Override

View File

@@ -52,8 +52,6 @@ class AutoNaviBroadcastIntentHandler implements IMogoIntentListener {
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
int operaType = intent.getIntExtra( "EXTRA_OPERA", -1 );
Logger.d( TAG, "action = %s, keyType=%s, type=%s, operType=%s", action, keyType, type, operaType );
if ( !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_RECV )
&& !TextUtils.equals( action, AUTONAVI_STANDARD_BROADCAST_SEND ) ) {
return;

View File

@@ -271,7 +271,6 @@ public class MogoServices implements IMogoMapListener,
public void onSuccess( MarkerResponse o ) {
MapMarkerManager.getInstance().onSyncMarkerResponse( o );
mLoopRequest = false;
Logger.d( TAG, "request Success." );
invokeAutoRefreshStrategy();
}
@@ -472,7 +471,6 @@ public class MogoServices implements IMogoMapListener,
@Override
public void handleMessage( Message msg ) {
super.handleMessage( msg );
Logger.d( TAG, "current thread: %s, msg = %s", Thread.currentThread(), msg.what );
if ( msg.what == ServiceConst.MSG_MAP_CHANGED ) {
if ( msg.obj instanceof RefreshObject ) {
RefreshObject ro = ( ( RefreshObject ) msg.obj );
@@ -608,10 +606,8 @@ public class MogoServices implements IMogoMapListener,
}
private void stopAutoRefreshStrategy( boolean stopOnlineCarRefresh ) {
Logger.d( TAG, "stop auto refresh strategy" );
mHandler.removeMessages( ServiceConst.MSG_TYPE_REFRESH_DECREASE );
if ( stopOnlineCarRefresh ) {
Logger.d( TAG, "stop online car auto refresh" );
MapMarkerManager.getInstance().stopAutoRefresh();
}
}

View File

@@ -17,6 +17,5 @@ public class EmptyIntentHandler implements IntentHandler {
@Override
public void handle( Context context, Intent intent ) {
Logger.w( TAG, "空实现. %s", intent.getAction() );
}
}

View File

@@ -288,7 +288,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
// 解析不同的Marker类型然后对应的进行绘制
Logger.d( TAG, "draw marker" );
mLastDataResult = response.getResult();
UiThreadHandler.post( () -> {
@@ -419,7 +418,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
String sn = getPrimaryKeyFromEntity( markerExploreWay );
IMogoMarker mogoMarker = existCarMap.get( sn );
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
Logger.d( TAG, "draw road condition, sn = %s", sn );
try {
if ( DebugConfig.isRoadEventAnimated() ) {
post2AddAndStartAnimation( markerShowEntity, i * 100L );
@@ -472,7 +470,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
*/
private Map< String, IMogoMarker > purgeMarkerData( List newList, String markerType ) {
final long start = System.currentTimeMillis();
Map< String, IMogoMarker > existMap = new HashMap<>();
List< IMogoMarker > allCarsList = MarkerServiceHandler.getMarkerManager().getMarkers( markerType );
if ( allCarsList == null || allCarsList.isEmpty() ) {
@@ -501,7 +498,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
}
}
allMap.clear();
Logger.i( "timer", "purge data cost " + ( System.currentTimeMillis() - start ) + "ms" );
return existMap;
}
@@ -742,7 +738,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if ( ignoreDrawRequest() ) {
return;
}
Logger.d( TAG, "接收到了地图大而全数据" );
runOnTargetThread( () -> {
drawMapMarker( response );
} );
@@ -776,7 +771,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
private Runnable runnable = new Runnable() {
@Override
public void run() {
Logger.d( TAG, "内部 - 自动刷新在线车辆" );
getOnlineCarDataImpl( mCarLatLng, false, false, ServiceConst.ONLINE_SEARCH_LIMIT, ServiceConst.ONLINE_SEARCH_RADIUS, false );
}
};
@@ -813,20 +807,15 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
mCarLatLng = latLng;
}
Logger.d( TAG, "内部 - 请求执行" );
if ( latLng == null ) {
Logger.d( TAG, "内部 - 定位为空" );
return;
}
if ( ignoreOnlineCarRequest() ) {
Logger.d( TAG, "内部 - 忽略请求" );
removeCarMarkers();
return;
}
Logger.d( TAG, "内部 - 请求开始" );
mRefreshModel.queryOnLineCarWithRoute( latLng, onlyFocus, onlySameCity, radius, limit, false, new RefreshCallback() {
@Override
public void onSuccess( Object o ) {
@@ -851,9 +840,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
);
}
Logger.d( TAG, "内部 - 请求完毕" );
runOnTargetThread( () -> {
Logger.d( TAG, "内部 - 请求完毕开始处理" );
trackData( size );
drawOnlineCarMarkers( onlineCarList, Integer.MAX_VALUE, fitBounds, fitBounds, mMarkerDisplayBounds, latLng );
UiThreadHandler.postDelayed( runnable, SMOOTH_DURATION * 1000 );

View File

@@ -107,9 +107,9 @@ class OnlineCarPanelAdapter extends RecyclerView.Adapter< OnlineCarPanelAdapter.
}
float distance = Utils.calculateLineDistance( location.getLon(), location.getLat(), lon, lat );
if ( distance >= 1000 ) {
return String.format( "%.1fKM", distance / 1000 );
return String.format( "%.1f千米", distance / 1000 );
} else {
return String.format( "%.1fM", distance );
return String.format( "%.1f", distance );
}
}
}

View File

@@ -74,7 +74,7 @@
android:textColor="@color/module_services_empty_tip_textColor"
android:textSize="@dimen/module_services_empty_tip_textSize"
android:textStyle="bold"
tools:text="很抱歉目的地10km内未找到车友" />
tools:text="很抱歉目的地10公里内未找到车友" />
<LinearLayout
android:layout_width="match_parent"

View File

@@ -4,11 +4,11 @@
<string name="module_service_launcher_card_tips">你的周围有%d个%s请点击查看你也可以对我说打开蘑菇出行</string>
<string name="module_service_launcher_card_info">周围有%d个%s</string>
<string name="module_service_open_app_tip">亲,建议您使用蘑菇出行</string>
<string name="module_services_str_20Km_radius">扩大到20KM半径</string>
<string name="module_services_str_40Km_radius">扩大到40KM半径</string>
<string name="module_services_str_20Km_radius">扩大到20公里半径</string>
<string name="module_services_str_40Km_radius">扩大到40公里半径</string>
<string name="module_services_panel_item_distance_tag_text">距离导航目的地</string>
<string name="module_services_panel_item_detail_text">查看车友信息</string>
<string name="module_services_online_car_panel_empty_tmpl">很抱歉,目的地%dKM内未找到车友</string>
<string name="module_services_online_car_panel_empty_tmpl">很抱歉,目的地%d公里内未找到车友</string>
<string name="module_services_online_car_panel_title">目的地车友</string>
<string name="module_services_error_text">加载失败,请点击重试</string>
</resources>

View File

@@ -99,7 +99,7 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
SpanUtils.with(mTvAddressDistance)
.append("" + (int) mV2XPushMessageEntity.getDistance())
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("m")
.append("")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
}

View File

@@ -181,14 +181,14 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder<V2XEventShowEntity> {
SpanUtils.with(tvDistance)
.append("" + (int) mV2XPushMessageEntity.getDistance() / 1000)
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("km")
.append("公里")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
} else {
SpanUtils.with(tvDistance)
.append("" + (int) mV2XPushMessageEntity.getDistance())
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("m")
.append("")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
}

View File

@@ -230,7 +230,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
tvEventTypeTitle.setBackgroundResource(EventTypeUtils.getPoiTypeBg(mNoveltyInfo.getPoiType()));
}
tvEventAddress.setText(mNoveltyInfo.getAddr());
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "M");
tvEventDistance.setText("距离 " + (int) mNoveltyInfo.getDistance() + "");
Calendar c = Calendar.getInstance();
c.setTimeInMillis(mNoveltyInfo.getGenerateTime());

View File

@@ -90,14 +90,14 @@ public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder<V2XHist
SpanUtils.with(mTvFaultHelpDistance)
.append("" + (int) xPushMessageEntity.getDistance() / 1000)
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("km")
.append("公里")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
} else {
SpanUtils.with(mTvFaultHelpDistance)
.append("" + (int) xPushMessageEntity.getDistance())
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
.append("m")
.append("")
.setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
}

View File

@@ -83,7 +83,6 @@ class AutoNaviIntentHandler implements IMogoVoiceCmdCallBack {
public void handle( Context context, Intent intent ) {
int keyType = intent.getIntExtra( "KEY_TYPE", 0 );
Logger.d( TAG, "KEY_TYPE = " + keyType );
switch ( keyType ) {
case 10021:
closeEntrance();