theme mode
This commit is contained in:
@@ -318,6 +318,13 @@ dependencies {
|
|||||||
apply from: "./functions/socketpush.gradle"
|
apply from: "./functions/socketpush.gradle"
|
||||||
apply from: "./functions/gpssimulator.gradle"
|
apply from: "./functions/gpssimulator.gradle"
|
||||||
apply from: "./functions/leftpanel.gradle"
|
apply from: "./functions/leftpanel.gradle"
|
||||||
|
|
||||||
|
// 换肤功能
|
||||||
|
implementation 'skin.support:skin-support:4.0.5' // skin-support
|
||||||
|
implementation 'skin.support:skin-support-appcompat:4.0.5' // skin-support 基础控件支持
|
||||||
|
implementation 'skin.support:skin-support-design:4.0.5' // skin-support-design material design 控件支持[可选]
|
||||||
|
implementation 'skin.support:skin-support-cardview:4.0.5' // skin-support-cardview CardView 控件支持[可选]
|
||||||
|
implementation 'skin.support:skin-support-constraint-layout:4.0.5' // skin-support-constraint-layout ConstraintLayout 控件支持[可选]
|
||||||
}
|
}
|
||||||
|
|
||||||
android.applicationVariants.all { variant ->
|
android.applicationVariants.all { variant ->
|
||||||
|
|||||||
@@ -3,7 +3,11 @@ package com.mogo.launcher;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.View;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import com.alibaba.android.arouter.launcher.ARouter;
|
import com.alibaba.android.arouter.launcher.ARouter;
|
||||||
import com.auto.zhidao.logsdk.CrashSystem;
|
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.module.left.panel.LeftPanelConst;
|
||||||
import com.zhidao.mogo.tanlu.api.TanluApiConst;
|
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
|
* @author congtaowang
|
||||||
* @since 2019-12-18
|
* @since 2019-12-18
|
||||||
@@ -85,6 +98,8 @@ public class MogoApplication extends AbsMogoApplication {
|
|||||||
Intent intent = new Intent( this, MogoMainService.class );
|
Intent intent = new Intent( this, MogoMainService.class );
|
||||||
startService( intent );
|
startService( intent );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initSkinStrategy();
|
||||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +117,35 @@ public class MogoApplication extends AbsMogoApplication {
|
|||||||
DebugConfig.setRoadEventAnimated( BuildConfig.ROAD_EVENT_ANIMATED );
|
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
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
super.init();
|
super.init();
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ dependencies {
|
|||||||
}
|
}
|
||||||
api 'org.greenrobot:eventbus:3.1.1'
|
api 'org.greenrobot:eventbus:3.1.1'
|
||||||
|
|
||||||
|
api 'skin.support:skin-support:4.0.5' // skin-support
|
||||||
|
api 'skin.support:skin-support-appcompat:4.0.5' // skin-support 基础控件支持
|
||||||
|
api 'skin.support:skin-support-design:4.0.5' // skin-support-design material design 控件支持[可选]
|
||||||
|
api 'skin.support:skin-support-cardview:4.0.5' // skin-support-cardview CardView 控件支持[可选]
|
||||||
|
api 'skin.support:skin-support-constraint-layout:4.0.5' // skin-support-constraint-layout ConstraintLayout 控件支持[可选]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ import android.view.WindowManager;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.app.AppCompatDelegate;
|
||||||
|
import androidx.appcompat.app.SkinAppCompatDelegateImpl;
|
||||||
|
|
||||||
import com.mogo.commons.debug.DebugConfig;
|
import com.mogo.commons.debug.DebugConfig;
|
||||||
import com.mogo.utils.SoftKeyBoardJobber;
|
import com.mogo.utils.SoftKeyBoardJobber;
|
||||||
@@ -89,4 +91,10 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
|||||||
}
|
}
|
||||||
mPresenter = null;
|
mPresenter = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
@Override
|
||||||
|
public AppCompatDelegate getDelegate() {
|
||||||
|
return SkinAppCompatDelegateImpl.get(this, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -651,7 +651,7 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
|||||||
try {
|
try {
|
||||||
return drawMapMarkerImpl( markerShowEntity, zIndex );
|
return drawMapMarkerImpl( markerShowEntity, zIndex );
|
||||||
} catch ( Exception e ) {
|
} catch ( Exception e ) {
|
||||||
e.printStackTrace();
|
Logger.e( TAG, e, "drawMapMarker" );
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user