1. 优化模块加载、去掉部分逻辑、升级socket版本号
This commit is contained in:
@@ -2,10 +2,8 @@
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
independentImplementation rootProject.ext.dependencies.mogomodulewidgets
|
||||
implementation rootProject.ext.dependencies.mogomodulewidgets
|
||||
} else {
|
||||
independentImplementation project(':modules:mogo-module-widgets')
|
||||
implementation project(':modules:mogo-module-widgets')
|
||||
}
|
||||
}
|
||||
@@ -2,20 +2,18 @@ ext {
|
||||
time = ""
|
||||
kotlin_version = "1.3.71"
|
||||
android = [
|
||||
// applicationId : "com.mogo.launcher",
|
||||
// zhidadoApplicationId: "com.zhidao.launcher",
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId : "com.mogo.launcher.app",
|
||||
fLauncherApplicationId : "com.mogo.launcher.f",
|
||||
bydautoIndependentApplicationId: "com.mogo.launcher.app.bydauto",
|
||||
fLauncherAmapApiValue : "aa2c8a0547378ead2f9a37762d9dd179",
|
||||
bydautoIndependentApiValue : "b1e1d527b02a493913c50985827c943a",
|
||||
commonLauncherAmapApiValue : "a36b9f7b086fa3951bb35338a5a06dd3",
|
||||
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId : "com.mogo.launcher.app",
|
||||
fLauncherApplicationId : "com.mogo.launcher.f",
|
||||
bydautoIndependentApplicationId: "com.mogo.launcher.app.bydauto",
|
||||
fLauncherAmapApiValue : "aa2c8a0547378ead2f9a37762d9dd179",
|
||||
bydautoIndependentApiValue : "b1e1d527b02a493913c50985827c943a",
|
||||
commonLauncherAmapApiValue : "a36b9f7b086fa3951bb35338a5a06dd3",
|
||||
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
]
|
||||
dependencies = [
|
||||
// androidx
|
||||
|
||||
@@ -32,7 +32,7 @@ dependencies {
|
||||
// 上报位置
|
||||
implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7'
|
||||
// 长链
|
||||
implementation 'com.zhidao.socket:built-in-socket:1.0.15'
|
||||
implementation 'com.zhidao.socket:built-in-socket:1.0.17'
|
||||
// passport
|
||||
implementation 'com.zhidao.tcloginsdk:tclogin:1.1.3'
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@ import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
|
||||
import com.zhidao.socket.Callback;
|
||||
import com.zhidao.socket.CallbackManager;
|
||||
import com.zhidao.socket.Environment;
|
||||
import com.zhidao.socket.SocketClient;
|
||||
import com.zhidao.socket.SocketConfig;
|
||||
import com.zhidao.socket.SocketMessageDispatcher;
|
||||
import com.zhidao.socket.utils.RequestUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -92,7 +92,7 @@ class SocketManager implements IMogoSocketManager, Callback {
|
||||
.setOpenAnalytics( true )
|
||||
.setSn( Utils.getSn() )
|
||||
.setDebug( DebugConfig.isDebug() );
|
||||
SocketMessageDispatcher.getInstance().start( context );
|
||||
SocketClient.getInstance().start( context );
|
||||
}
|
||||
|
||||
private Environment getEnvironment() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.tts.base.IMogoTTS;
|
||||
import com.mogo.tts.base.MogoTTSConstants;
|
||||
import com.mogo.tts.base.PreemptType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -15,6 +16,8 @@ import com.mogo.tts.base.PreemptType;
|
||||
*/
|
||||
public class AIAssist {
|
||||
|
||||
private static final String TAG = "AIAssist";
|
||||
|
||||
private static volatile AIAssist sInstance;
|
||||
|
||||
private IMogoTTS mTTS;
|
||||
@@ -32,7 +35,11 @@ public class AIAssist {
|
||||
|
||||
public synchronized void release() {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.release();
|
||||
try {
|
||||
mTTS.release();
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "release" );
|
||||
}
|
||||
}
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@@ -84,16 +84,4 @@ public class MainIndependentActivity extends MainActivity {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
forceStop();
|
||||
}
|
||||
|
||||
private void forceStop(){
|
||||
UiThreadHandler.postDelayed( ()->{
|
||||
System.exit( 0 );
|
||||
}, 1_000L );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,7 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00008,
|
||||
R.drawable.mogo_tts_icon_00009,
|
||||
R.drawable.mogo_tts_icon_00010,
|
||||
R.drawable.mogo_tts_icon_00011
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00011,
|
||||
R.drawable.mogo_tts_icon_00012,
|
||||
R.drawable.mogo_tts_icon_00013,
|
||||
R.drawable.mogo_tts_icon_00014,
|
||||
@@ -50,8 +49,7 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00020,
|
||||
R.drawable.mogo_tts_icon_00021,
|
||||
R.drawable.mogo_tts_icon_00022,
|
||||
R.drawable.mogo_tts_icon_00023
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00023,
|
||||
R.drawable.mogo_tts_icon_00024,
|
||||
R.drawable.mogo_tts_icon_00025,
|
||||
R.drawable.mogo_tts_icon_00026,
|
||||
@@ -63,8 +61,7 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00032,
|
||||
R.drawable.mogo_tts_icon_00033,
|
||||
R.drawable.mogo_tts_icon_00034,
|
||||
R.drawable.mogo_tts_icon_00035
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00035,
|
||||
R.drawable.mogo_tts_icon_00036,
|
||||
R.drawable.mogo_tts_icon_00037,
|
||||
R.drawable.mogo_tts_icon_00038,
|
||||
@@ -76,8 +73,7 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00044,
|
||||
R.drawable.mogo_tts_icon_00045,
|
||||
R.drawable.mogo_tts_icon_00046,
|
||||
R.drawable.mogo_tts_icon_00047
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00047,
|
||||
R.drawable.mogo_tts_icon_00048,
|
||||
R.drawable.mogo_tts_icon_00049,
|
||||
R.drawable.mogo_tts_icon_00050,
|
||||
@@ -89,8 +85,7 @@ public class AnimRes {
|
||||
R.drawable.mogo_tts_icon_00056,
|
||||
R.drawable.mogo_tts_icon_00057,
|
||||
R.drawable.mogo_tts_icon_00058,
|
||||
R.drawable.mogo_tts_icon_00059
|
||||
}, {
|
||||
R.drawable.mogo_tts_icon_00059,
|
||||
R.drawable.mogo_tts_icon_00060,
|
||||
R.drawable.mogo_tts_icon_00061,
|
||||
R.drawable.mogo_tts_icon_00062,
|
||||
|
||||
@@ -70,7 +70,7 @@ public class OthersAnim implements Anim {
|
||||
}
|
||||
mStarted = true;
|
||||
mHandler.sendEmptyMessage( MSG_LOOP );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 60 * 1_000L );
|
||||
// mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 60 * 1_000L );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -258,17 +258,18 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mStatusManager.setDisplayOverview(TAG, false);
|
||||
UiThreadHandler.removeCallbacks(mLockCarRunnable);
|
||||
}
|
||||
if ( mIsLock ) {
|
||||
if ( mMApUIController.getCurrentUiMode() == EnumMapUI.CarUp_2D ) {
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
} else if( mMApUIController.getCurrentUiMode() == EnumMapUI.NorthUP_2D ){
|
||||
mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
}
|
||||
} else {
|
||||
if ( !mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 0 ) ) {
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
// if ( mIsLock ) {
|
||||
// if ( mMApUIController.getCurrentUiMode() == EnumMapUI.CarUp_2D ) {
|
||||
// mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
// } else if( mMApUIController.getCurrentUiMode() == EnumMapUI.NorthUP_2D ){
|
||||
// mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
// }
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
if ( !mApis.getRefreshStrategyControllerApi().restartAutoRefreshAtTime( 0 ) ) {
|
||||
mStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
}
|
||||
} );
|
||||
@@ -753,16 +754,15 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
} else {
|
||||
mExitNavi.setText(R.string.module_ext_str_continue_navi);
|
||||
}
|
||||
|
||||
if ( isLock ) {
|
||||
if ( mMApUIController.getCurrentUiMode() == EnumMapUI.CarUp_2D ) {
|
||||
mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
|
||||
} else {
|
||||
mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
|
||||
}
|
||||
} else {
|
||||
mMove2CurrentLocation.setImageResource( R.drawable.module_map_ic_move2_current_location );
|
||||
}
|
||||
// if ( isLock ) {
|
||||
// if ( mMApUIController.getCurrentUiMode() == EnumMapUI.CarUp_2D ) {
|
||||
// mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
|
||||
// } else {
|
||||
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
|
||||
// }
|
||||
// } else {
|
||||
// mMove2CurrentLocation.setImageResource( R.drawable.module_map_ic_move2_current_location );
|
||||
// }
|
||||
}
|
||||
|
||||
private void traceData(String from) {
|
||||
@@ -986,11 +986,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mCameraMode.setSelected(ui == EnumMapUI.NorthUP_2D);
|
||||
mCameraMode.setText(getString(ui == EnumMapUI.NorthUP_2D ? R.string.mode_car_up : R.string.mode_north_up));
|
||||
|
||||
if ( ui == EnumMapUI.CarUp_2D ) {
|
||||
mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
|
||||
} else if( ui == EnumMapUI.NorthUP_2D ){
|
||||
mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
|
||||
}
|
||||
// if ( ui == EnumMapUI.CarUp_2D ) {
|
||||
// mMove2CurrentLocation.setImageResource( R.drawable.icon_north_up );
|
||||
// } else if( ui == EnumMapUI.NorthUP_2D ){
|
||||
// mMove2CurrentLocation.setImageResource( R.drawable.icon_car_up );
|
||||
// }
|
||||
}
|
||||
|
||||
private static int SEEK_HELP_NOTICE_NUM_MSG_TYPE = 401015;
|
||||
|
||||
@@ -370,5 +370,6 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
SchemeIntent.getInstance().clear();
|
||||
FloatingViewHandler.clear();
|
||||
mServiceApis.getShareManager().releaseContext();
|
||||
mServiceApis.getSkinSupportInstallerApi().onDestroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.MogoMapView;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.map.MyLocationUtil;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
@@ -135,6 +136,10 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
uiSettings.setZoomGesturesEnabled( true );
|
||||
mMogoMap.getUIController().changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
|
||||
|
||||
final EnumMapUI mapUI = MogoApisHandler.getInstance().getApis().getAdasControllerApi().getCurrentSkinMode();
|
||||
getUIController().changeMapMode( mapUI );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -294,9 +294,6 @@ public class MapPresenter extends Presenter< MapView > implements
|
||||
mCustomVoiceCommandHandler = new MapControlCommandHandler();
|
||||
mCustomVoiceCommandHandler.setCallback( this );
|
||||
mRegisterCenter.registerADASControlStatusChangedListener( TAG, this );
|
||||
|
||||
final EnumMapUI mapUI = mApis.getAdasControllerApi().getCurrentSkinMode();
|
||||
mMogoMapService.getMapUIController().changeMapMode( mapUI );
|
||||
}
|
||||
|
||||
private void initBroadcast() {
|
||||
|
||||
@@ -67,6 +67,8 @@ class LauncherCardRefresher {
|
||||
public static final int MSG_REFRESH_ADVERTISEMENT = 2022;
|
||||
// 加载网络配置数据
|
||||
public static final int MSG_LOAD_NET_CONFIG = 2023;
|
||||
// 加载网络配置数据2
|
||||
public static final int MSG_LOAD_NET_CONFIG2 = 2026;
|
||||
// 默认播报
|
||||
public static final int MSG_START_LOOP_DEFAULT_CARD = 2024;
|
||||
// 等待网络
|
||||
@@ -129,6 +131,9 @@ class LauncherCardRefresher {
|
||||
case MSG_LOAD_NET_CONFIG:
|
||||
loadNetworkConfigStrategy();
|
||||
break;
|
||||
case MSG_LOAD_NET_CONFIG2:
|
||||
requestTtsStrategyConfig();
|
||||
break;
|
||||
case MSG_REFRESH_DEFAULT_CARD:
|
||||
renderDefaultLauncherCardConfig( false );
|
||||
mRefreshStrategy = mRefreshStrategy.getNext();
|
||||
@@ -181,6 +186,7 @@ class LauncherCardRefresher {
|
||||
.getSingletonLocationClient( mContext )
|
||||
.getLastKnowLocation() != null ) {
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOAD_NET_CONFIG, 0L );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOAD_NET_CONFIG2, 2 * ONE_MINUTE );
|
||||
} else {
|
||||
mHandler.sendEmptyMessageDelayed( MSG_WAIT_NETWORK, 10 * ONE_SECOND );
|
||||
}
|
||||
@@ -206,6 +212,7 @@ class LauncherCardRefresher {
|
||||
mHandler.removeMessages( MSG_START_LOOP_DEFAULT_CARD );
|
||||
mHandler.removeMessages( MSG_REFRESH_ADVERTISEMENT );
|
||||
mHandler.removeMessages( MSG_LOAD_NET_CONFIG );
|
||||
mHandler.removeMessages( MSG_LOAD_NET_CONFIG2 );
|
||||
mHandler.removeMessages( MSG_WAIT_NETWORK );
|
||||
Logger.d( TAG, "stop" );
|
||||
}
|
||||
@@ -329,7 +336,6 @@ class LauncherCardRefresher {
|
||||
*/
|
||||
private void loadNetworkConfigStrategy() {
|
||||
loadAdvertisementConfig();
|
||||
requestTtsStrategyConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -397,6 +403,8 @@ class LauncherCardRefresher {
|
||||
.addType( LauncherCardRefreshType.ExplorerWay.getVal() )
|
||||
.addType( LauncherCardRefreshType.Weather.getVal() )
|
||||
.sn( Utils.getSn() )
|
||||
.cityCode( location.getCityCode() )
|
||||
.cityName( location.getCityName() )
|
||||
.location( new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
final Map< String, Object > query = new ParamsProvider.Builder( mContext )
|
||||
.append( "data", GsonUtil.jsonFromObject( body ) )
|
||||
|
||||
@@ -425,7 +425,6 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
mogoMarker = drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,18 @@ class TtsConfigBody implements Parcelable {
|
||||
private MogoLatLng location;
|
||||
private List< String > dataType;
|
||||
private String sn;
|
||||
private String cityCode;
|
||||
private String cityName;
|
||||
|
||||
public TtsConfigBody cityCode( String cityCode ) {
|
||||
this.cityCode = cityCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody cityName( String cityName ) {
|
||||
this.cityName = cityName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TtsConfigBody addType( String type ) {
|
||||
if ( dataType == null ) {
|
||||
@@ -40,6 +52,9 @@ class TtsConfigBody implements Parcelable {
|
||||
}
|
||||
|
||||
|
||||
public TtsConfigBody() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
@@ -50,15 +65,16 @@ class TtsConfigBody implements Parcelable {
|
||||
dest.writeParcelable( this.location, flags );
|
||||
dest.writeStringList( this.dataType );
|
||||
dest.writeString( this.sn );
|
||||
}
|
||||
|
||||
public TtsConfigBody() {
|
||||
dest.writeString( this.cityCode );
|
||||
dest.writeString( this.cityName );
|
||||
}
|
||||
|
||||
protected TtsConfigBody( Parcel in ) {
|
||||
this.location = in.readParcelable( MogoLatLng.class.getClassLoader() );
|
||||
this.dataType = in.createStringArrayList();
|
||||
this.sn = in.readString();
|
||||
this.cityCode = in.readString();
|
||||
this.cityName = in.readString();
|
||||
}
|
||||
|
||||
public static final Creator< TtsConfigBody > CREATOR = new Creator< TtsConfigBody >() {
|
||||
|
||||
@@ -257,7 +257,6 @@ public class MogoServiceApis implements IMogoServiceApis {
|
||||
SingletonsHolder.registerApi( clazz, newInst );
|
||||
Logger.d( TAG, "keep IProvider instance to SingletonHolder: path = %s", path );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
return newInst;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_bkg_corner">4px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_widgets_app_bkg_corner">8px</dimen>
|
||||
</resources>
|
||||
@@ -79,6 +79,6 @@ class SkinSupportInstaller implements IMogoSkinSupportInstaller {
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
SkinActivityLifecycle.init( AbsMogoApplication.getApp() ).restoreOldFactory2( AbsMogoApplication.getApp() );
|
||||
SkinCompatManager.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +152,15 @@ public class SkinCompatManager extends SkinObservable {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public static void destroy(){
|
||||
sInstance.onDestroy();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
public void onDestroy(){
|
||||
SkinActivityLifecycle.destroy((Application)mAppContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化换肤框架,监听Activity生命周期. 通过该方法初始化,应用中Activity无需继承{@link skin.support.app.SkinCompatActivity}.
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -13,13 +14,12 @@ import java.util.WeakHashMap;
|
||||
import skin.support.SkinCompatManager;
|
||||
import skin.support.annotation.Skinable;
|
||||
import skin.support.content.res.SkinCompatResources;
|
||||
import skin.support.content.res.SkinCompatThemeUtils;
|
||||
import skin.support.observe.SkinObservable;
|
||||
import skin.support.observe.SkinObserver;
|
||||
import skin.support.utils.Slog;
|
||||
import skin.support.view.LayoutInflaterCompat;
|
||||
import skin.support.view.LayoutInflaterFactory;
|
||||
import skin.support.widget.SkinCompatSupportable;
|
||||
import skin.support.content.res.SkinCompatThemeUtils;
|
||||
|
||||
import static skin.support.widget.SkinCompatHelper.INVALID_ID;
|
||||
import static skin.support.widget.SkinCompatHelper.checkResourceId;
|
||||
@@ -34,9 +34,6 @@ public class SkinActivityLifecycle implements Application.ActivityLifecycleCallb
|
||||
*/
|
||||
private WeakReference< Activity > mCurActivityRef;
|
||||
|
||||
private LayoutInflater.Factory2 mOldFactory2 = null;
|
||||
private LayoutInflater.Factory mOldFactory = null;
|
||||
|
||||
public static SkinActivityLifecycle init( Application application ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SkinActivityLifecycle.class ) {
|
||||
@@ -56,6 +53,7 @@ public class SkinActivityLifecycle implements Application.ActivityLifecycleCallb
|
||||
|
||||
@Override
|
||||
public void onActivityCreated( Activity activity, Bundle savedInstanceState ) {
|
||||
Log.d( "onCreated", "----onCreated2" );
|
||||
onCompensateActivityCreated( activity, savedInstanceState );
|
||||
}
|
||||
|
||||
@@ -113,8 +111,6 @@ public class SkinActivityLifecycle implements Application.ActivityLifecycleCallb
|
||||
private void installLayoutFactory( Context context ) {
|
||||
try {
|
||||
LayoutInflater layoutInflater = LayoutInflater.from( context );
|
||||
mOldFactory2 = layoutInflater.getFactory2();
|
||||
mOldFactory = layoutInflater.getFactory();
|
||||
LayoutInflaterCompat.setFactory2( layoutInflater, getSkinDelegate( context ) );
|
||||
} catch ( Throwable e ) {
|
||||
Slog.i( "SkinActivity", "A factory has already been set on this LayoutInflater" );
|
||||
@@ -208,14 +204,9 @@ public class SkinActivityLifecycle implements Application.ActivityLifecycleCallb
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void restoreOldFactory2(Context context){
|
||||
try {
|
||||
LayoutInflater layoutInflater = LayoutInflater.from( context );
|
||||
layoutInflater.setFactory2( mOldFactory2 );
|
||||
layoutInflater.setFactory( mOldFactory );
|
||||
} catch ( Throwable e ) {
|
||||
|
||||
}
|
||||
public static void destroy(Application application){
|
||||
application.unregisterActivityLifecycleCallbacks( sInstance );
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user