集成doraemonkit

This commit is contained in:
xingxing
2019-05-12 10:51:55 +08:00
parent a6efd6170a
commit 4d6bdd372a
4 changed files with 21 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ repositories {
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'android-aspectjx'
def dbflow_version = "4.0.0-beta2"
def ciName = isEmpty(System.getenv("TRAVIS_TAG")) ? "Staging" : System.getenv("TRAVIS_TAG")
@@ -42,6 +43,7 @@ android {
versionName ciName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField "String", "BUGLY_KEY", String.format("\"%s\"", buglyPrdKey)
multiDexEnabled true
}
lintOptions {
@@ -111,4 +113,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation "org.mockito:mockito-core:2.+"
debugImplementation 'com.didichuxing.doraemonkit:doraemonkit:1.1.6'
releaseImplementation 'com.didichuxing.doraemonkit:doraemonkit-no-op:1.1.6'
implementation "com.android.support:multidex:1.0.2"
}

View File

@@ -1,13 +1,15 @@
package org.houxg.leamonax;
import android.app.Application;
import android.content.Context;
import android.content.res.Resources;
import android.support.multidex.MultiDexApplication;
import android.text.TextUtils;
import android.widget.ImageView;
import com.bumptech.glide.Glide;
import com.didichuxing.doraemonkit.DoraemonKit;
import com.didichuxing.doraemonkit.kit.webdoor.WebDoorManager;
import com.elvishew.xlog.LogLevel;
import com.elvishew.xlog.XLog;
import com.facebook.stetho.Stetho;
@@ -25,7 +27,7 @@ import net.danlew.android.joda.JodaTimeAndroid;
import org.greenrobot.eventbus.EventBus;
import org.houxg.leamonax.ui.MainActivity;
public class Leamonax extends Application {
public class Leamonax extends MultiDexApplication {
private static Context mContext;
@@ -58,6 +60,16 @@ public class Leamonax extends Application {
Glide.with(context).load(path).into(imageView);
}
});
DoraemonKit.install(this);
// H5任意门功能需要非必须
DoraemonKit.setWebDoorCallback(new WebDoorManager.WebDoorCallback() {
@Override
public void overrideUrlLoading(Context context, String s) {
// 使用自己的H5容器打开这个链接
}
});
}
private void initBugly() {

View File

@@ -48,7 +48,7 @@ public class ApiProvider {
}
public void init(String host) {
OkHttpClient.Builder builder = new OkHttpClient.Builder()
OkHttpClient.Builder builder = new OkHttpClient().newBuilder()
.addNetworkInterceptor(new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {

View File

@@ -9,6 +9,7 @@ buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.hujiang.aspectjx:gradle-android-plugin-aspectjx:2.0.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files