theme mode
This commit is contained in:
@@ -3,7 +3,11 @@ package com.mogo.launcher;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.auto.zhidao.logsdk.CrashSystem;
|
||||
@@ -33,6 +37,15 @@ import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst;
|
||||
import com.zhidao.mogo.tanlu.api.TanluApiConst;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
|
||||
import skin.support.SkinCompatManager;
|
||||
import skin.support.app.SkinAppCompatViewInflater;
|
||||
import skin.support.app.SkinCardViewInflater;
|
||||
import skin.support.app.SkinLayoutInflater;
|
||||
import skin.support.constraint.app.SkinConstraintViewInflater;
|
||||
import skin.support.design.app.SkinMaterialViewInflater;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
@@ -85,6 +98,8 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
Intent intent = new Intent( this, MogoMainService.class );
|
||||
startService( intent );
|
||||
}
|
||||
|
||||
initSkinStrategy();
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
@@ -102,6 +117,35 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setRoadEventAnimated( BuildConfig.ROAD_EVENT_ANIMATED );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void asyncInitImpl() {
|
||||
super.asyncInitImpl();
|
||||
}
|
||||
|
||||
private void initSkinStrategy(){
|
||||
SkinCompatManager.withoutActivity(this)
|
||||
.addInflater(new SkinAppCompatViewInflater()) // 基础控件换肤初始化
|
||||
.addInflater(new SkinMaterialViewInflater()) // material design 控件换肤初始化[可选]
|
||||
.addInflater(new SkinConstraintViewInflater()) // ConstraintLayout 控件换肤初始化[可选]
|
||||
.addInflater(new SkinCardViewInflater()) // CardView v7 控件换肤初始化[可选]
|
||||
.addInflater( ( context, name, attrs ) -> {
|
||||
View view = null;
|
||||
try {
|
||||
Class clazz = Class.forName( name );
|
||||
Constructor<View> constructor = clazz.getConstructor( Context.class, AttributeSet.class );
|
||||
constructor.setAccessible( true );
|
||||
view = constructor.newInstance( constructor, attrs );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return view;
|
||||
} )
|
||||
.setSkinAllActivityEnable(true)
|
||||
.setSkinStatusBarColorEnable(false) // 关闭状态栏换肤,默认打开[可选]
|
||||
.setSkinWindowBackgroundEnable(false) // 关闭windowBackground换肤,默认打开[可选]
|
||||
.loadSkin();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
|
||||
Reference in New Issue
Block a user