Skip to content

Commit 0851fca

Browse files
author
Blankj
committed
see 03/15 log
1 parent 22db243 commit 0851fca

73 files changed

Lines changed: 846 additions & 594 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

build.gradle

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
buildscript {
33
apply from: 'config.gradle'
44
repositories {
5-
if (bus.isDebug) {
6-
maven() {
7-
url uri(new File(project.rootDir, "maven"))
5+
if (!bus.isPublish) {
6+
if (bus.isDebug) {
7+
maven() {
8+
url uri(new File(project.rootDir, "maven"))
9+
}
810
}
911
}
1012
google()
@@ -13,6 +15,9 @@ buildscript {
1315

1416
dependencies {
1517
for (plugin in dep.plugin) {
18+
if (bus.isPublish && plugin.contains("com.blankj:bus-gradle-plugin:")) {
19+
continue
20+
}
1621
classpath plugin
1722
}
1823
}

bus-gradle-plugin/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Change Log
22

3+
## v1.7
4+
兼容 utilcodex
5+
36
## v1.6
47
修复 inject 时候 zip 操作不对导致混淆出错的问题
58

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#project
2+
project.name=StaticBusPlugin
3+
project.groupId=com.blankj
4+
project.artifactId=bus-gradle-plugin
5+
project.packaging=aar
6+
project.siteUrl=https://github.com/Blankj/AndroidUtilCode
7+
project.gitUrl=https://github.com/Blankj/AndroidUtilCode.git
8+
#javadoc
9+
javadoc.name=StaticBusPlugin

bus-gradle-plugin/src/main/java/com/blankj/bus/BusScan.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ class BusScan {
7272
busStaticMap.put(name, sign);
7373
} else {// may be is kotlin
7474
if (!processKt(method, name, methodLongName)) {
75-
int priority = ((BusUtils.Subscribe) method.getAnnotation(BusUtils.Subscribe.class)).priority();
76-
processEventBus(method, name, methodLongName);
75+
// int priority = ((BusUtils.Subscribe) method.getAnnotation(BusUtils.Subscribe.class)).priority();
76+
// processEventBus(method, name, methodLongName);
7777
}
7878
}
7979
}

bus-gradle-plugin/src/main/java/com/blankj/bus/BusTransform.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import com.android.build.gradle.internal.pipeline.TransformManager
55
import com.blankj.util.JavassistUtils
66
import com.blankj.util.JsonUtils
77
import com.blankj.util.LogUtils
8-
98
import org.apache.commons.io.FileUtils
109
import org.gradle.api.Project
1110

@@ -86,6 +85,7 @@ class BusTransform extends Transform {
8685
FileUtils.copyFile(jar, dest)
8786

8887
if (jarName.startsWith("com.blankj:utilcode:")
88+
|| jarName.startsWith("com.blankj:utilcodex:")
8989
|| jarName.contains("utilcode-lib")) {
9090
busScan.busJar = dest
9191
LogUtils.l("bus jar: $jarName [$dest]")

config.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ ext {
99
versionName = '1.23.7'// E.g. 1.9.72 => 1,009,072
1010

1111
bus = [
12-
isDebug: false,
13-
version: '1.6',
14-
group : 'com.blankj'
12+
isPublish: false,
13+
isDebug : false,
14+
version : '1.7',
15+
group : 'com.blankj'
1516
]
1617

1718
// lib version

config_app.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ apply {
22
plugin "com.android.application"
33
plugin "kotlin-android"
44
plugin "kotlin-android-extensions"
5-
plugin "com.blankj.bus"
5+
if (!bus.isPublish) {
6+
plugin "com.blankj.bus"
7+
}
68
}
79

810
configSigning project
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
package com.blankj.lib.base;
2+
3+
/**
4+
* <pre>
5+
* author: blankj
6+
* blog : http://blankj.com
7+
* time : 2019/03/14
8+
* desc :
9+
* </pre>
10+
*/
11+
12+
import android.annotation.SuppressLint;
13+
import android.app.Activity;
14+
import android.os.Bundle;
15+
import android.support.annotation.LayoutRes;
16+
import android.support.v7.app.AppCompatActivity;
17+
import android.view.LayoutInflater;
18+
import android.view.View;
19+
20+
import com.blankj.utilcode.util.AntiShakeUtils;
21+
import com.blankj.utilcode.util.AppUtils;
22+
import com.blankj.utilcode.util.ToastUtils;
23+
import com.blankj.utilcode.util.Utils;
24+
import com.r0adkll.slidr.Slidr;
25+
26+
/**
27+
* <pre>
28+
* author: Blankj
29+
* blog : http://blankj.com
30+
* time : 2016/10/24
31+
* desc : base about activity
32+
* </pre>
33+
*/
34+
public abstract class BaseActivity extends AppCompatActivity
35+
implements IBaseView {
36+
37+
protected View mContentView;
38+
protected Activity mActivity;
39+
40+
public abstract boolean isSwipeBack();
41+
42+
/**
43+
* 上次点击时间
44+
*/
45+
private long lastClick = 0;
46+
47+
@Override
48+
protected void onCreate(Bundle savedInstanceState) {
49+
mActivity = this;
50+
super.onCreate(savedInstanceState);
51+
initData(getIntent().getExtras());
52+
setRootLayout(bindLayout());
53+
initView(savedInstanceState, mContentView);
54+
doBusiness();
55+
56+
if (isSwipeBack()) {
57+
Slidr.attach(this);
58+
}
59+
AppUtils.registerAppStatusChangedListener(this, new Utils.OnAppStatusChangedListener() {
60+
@Override
61+
public void onForeground() {
62+
ToastUtils.showShort("foreground");
63+
}
64+
65+
@Override
66+
public void onBackground() {
67+
ToastUtils.showShort("background");
68+
}
69+
});
70+
}
71+
72+
@SuppressLint("ResourceType")
73+
@Override
74+
public void setRootLayout(@LayoutRes int layoutId) {
75+
if (layoutId <= 0) return;
76+
setContentView(mContentView = LayoutInflater.from(this).inflate(layoutId, null));
77+
}
78+
79+
@Override
80+
public void onClick(View view) {
81+
if (AntiShakeUtils.isValid(view)) {
82+
onWidgetClick(view);
83+
}
84+
}
85+
86+
@Override
87+
protected void onDestroy() {
88+
super.onDestroy();
89+
AppUtils.unregisterAppStatusChangedListener(this);
90+
}
91+
}
92+

lib/base/src/main/java/com/blankj/lib/base/BaseActivity.kt

Lines changed: 0 additions & 67 deletions
This file was deleted.

lib/base/src/main/java/com/blankj/lib/base/BaseApplication.kt renamed to lib/base/src/main/java/com/blankj/lib/base/BaseApplication.java

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,64 @@
1-
package com.blankj.lib.base
1+
package com.blankj.lib.base;
22

3-
import android.app.Application
4-
import android.content.Context
5-
import android.support.multidex.MultiDex
6-
import com.blankj.utilcode.util.AppUtils
7-
import com.blankj.utilcode.util.CrashUtils
8-
import com.blankj.utilcode.util.LogUtils
9-
import com.blankj.utilcode.util.MessengerUtils
10-
import com.squareup.leakcanary.LeakCanary
3+
import android.app.Application;
4+
import android.content.Context;
5+
import android.support.multidex.MultiDex;
6+
7+
import com.blankj.utilcode.util.AppUtils;
8+
import com.blankj.utilcode.util.CrashUtils;
9+
import com.blankj.utilcode.util.LogUtils;
10+
import com.squareup.leakcanary.LeakCanary;
11+
12+
import java.util.ArrayList;
1113

1214
/**
13-
* ```
14-
* author: blankj
15-
* blog : http://blankj.com
16-
* time : 2018/11/16
17-
* desc : base about application
18-
* ```
15+
* <pre>
16+
* author: blankj
17+
* blog : http://blankj.com
18+
* time : 2018/11/16
19+
* desc : base about application
20+
* </pre>
1921
*/
20-
open class BaseApplication : Application() {
22+
public class BaseApplication extends Application {
23+
24+
private static BaseApplication sInstance;
2125

22-
companion object {
23-
lateinit var instance: BaseApplication
26+
public static BaseApplication getInstance() {
27+
return sInstance;
2428
}
2529

26-
private var isDebug: Boolean? = null
30+
private Boolean isDebug;
2731

28-
override fun attachBaseContext(base: Context) {
29-
super.attachBaseContext(base)
30-
MultiDex.install(this)
32+
@Override
33+
protected void attachBaseContext(Context base) {
34+
super.attachBaseContext(base);
35+
MultiDex.install(this);
3136
}
3237

33-
override fun onCreate() {
34-
super.onCreate()
35-
instance = this
36-
initLeakCanary()
37-
initLog()
38-
initCrash()
39-
MessengerUtils.init()
38+
@Override
39+
public void onCreate() {
40+
super.onCreate();
41+
sInstance = this;
42+
initLeakCanary();
43+
initLog();
44+
initCrash();
45+
// MessengerUtils.init();
4046
}
4147

42-
private fun initLeakCanary() {// 内存泄露检查工具
48+
private void initLeakCanary() {// 内存泄露检查工具
4349
if (isDebug()) {
4450
if (LeakCanary.isInAnalyzerProcess(this)) {
4551
// This process is dedicated to LeakCanary for heap analysis.
4652
// You should not init your app in this process.
47-
return
53+
return;
4854
}
49-
LeakCanary.install(this)
55+
LeakCanary.install(this);
5056
}
5157
}
5258

5359
// init it in ur application
54-
fun initLog() {
55-
val config = LogUtils.getConfig()
60+
public void initLog() {
61+
LogUtils.Config config = LogUtils.getConfig()
5662
.setLogSwitch(isDebug())// 设置 log 总开关,包括输出到控制台和文件,默认开
5763
.setConsoleSwitch(isDebug())// 设置是否输出到控制台开关,默认开
5864
.setGlobalTag(null)// 设置 log 全局标签,默认为空
@@ -70,23 +76,27 @@ fun initLog() {
7076
.setStackOffset(0)// 设置栈偏移,比如二次封装的话就需要设置,默认为 0
7177
.setSaveDays(3)// 设置日志可保留天数,默认为 -1 表示无限时长
7278
// 新增 ArrayList 格式化器,默认已支持 Array, Throwable, Bundle, Intent 的格式化输出
73-
.addFormatter(object : LogUtils.IFormatter<ArrayList<*>>() {
74-
override fun format(list: ArrayList<*>?): String {
75-
return "LogUtils Formatter ArrayList { " + list.toString() + " }"
79+
.addFormatter(new LogUtils.IFormatter<ArrayList>() {
80+
@Override
81+
public String format(ArrayList arrayList) {
82+
return "LogUtils Formatter ArrayList { " + arrayList.toString() + " }";
7683
}
77-
})
78-
LogUtils.i(config.toString())
84+
});
85+
LogUtils.i(config.toString());
7986
}
8087

81-
private fun initCrash() {
82-
CrashUtils.init { crashInfo, e ->
83-
LogUtils.e(crashInfo)
84-
AppUtils.relaunchApp()
85-
}
88+
private void initCrash() {
89+
CrashUtils.init(new CrashUtils.OnCrashListener() {
90+
@Override
91+
public void onCrash(String crashInfo, Throwable e) {
92+
LogUtils.e(crashInfo);
93+
AppUtils.relaunchApp();
94+
}
95+
});
8696
}
8797

88-
fun isDebug(): Boolean {
89-
if (isDebug == null) isDebug = AppUtils.isAppDebug()
90-
return isDebug!!
98+
private boolean isDebug() {
99+
if (isDebug == null) isDebug = AppUtils.isAppDebug();
100+
return isDebug;
91101
}
92102
}

0 commit comments

Comments
 (0)