Skip to content

Commit c605246

Browse files
committed
迁移 JCenter 到 JitPack
优化框架代码及补充一个字符串国际化
1 parent 1e416cf commit c605246

File tree

16 files changed

+81
-67
lines changed

16 files changed

+81
-67
lines changed

.gitignore

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
/.gradle
2-
/.idea
3-
/build
4-
*/build
5-
/captures
6-
/.cxx
7-
*/.cxx
8-
/.externalNativeBuild
1+
.gradle
2+
.idea
3+
.cxx
4+
.externalNativeBuild
5+
build
6+
captures
97

108
._*
119
*.iml

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,24 @@
88

99
#### 集成步骤
1010

11+
```groovy
12+
buildscript {
13+
......
14+
}
15+
allprojects {
16+
repositories {
17+
// JitPack 远程仓库:https://jitpack.io
18+
maven { url 'https://jitpack.io' }
19+
}
20+
}
21+
```
22+
23+
* 在项目 app 模块下的 `build.gradle` 文件中加入
24+
1125
```groovy
1226
dependencies {
1327
// 日志调试框架:https://github.com/getActivity/Logcat
14-
debugImplementation 'com.hjq:logcat:9.5'
28+
debugImplementation 'com.github.getActivity:Logcat:9.6'
1529
}
1630
```
1731

@@ -88,12 +102,12 @@ dependencies {
88102

89103
* Gson 解析容错:[GsonFactory](https://github.com/getActivity/GsonFactory)
90104

91-
#### Android技术讨论Q群:78797078
92-
93105
#### 微信公众号:Android轮子哥
94106

95107
![](https://raw.githubusercontent.com/getActivity/Donate/master/picture/official_ccount.png)
96108

109+
#### Android 技术分享 QQ 群:78797078
110+
97111
#### 如果您觉得我的开源库帮你节省了大量的开发时间,请扫描下方的二维码随意打赏,要是能打赏个 10.24 :monkey_face:就太:thumbsup:了。您的支持将鼓励我继续创作:octocat:
98112

99113
![](https://raw.githubusercontent.com/getActivity/Donate/master/picture/pay_ali.png) ![](https://raw.githubusercontent.com/getActivity/Donate/master/picture/pay_wechat.png)

app/build.gradle

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,17 @@ android {
77
applicationId "com.hjq.logcat.demo"
88
minSdkVersion 16
99
targetSdkVersion 30
10-
versionCode 95
11-
versionName "9.5"
10+
versionCode 96
11+
versionName "9.6"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
}
14+
15+
// 使用 JDK 1.8
16+
compileOptions {
17+
targetCompatibility JavaVersion.VERSION_1_8
18+
sourceCompatibility JavaVersion.VERSION_1_8
19+
}
20+
1421
buildTypes {
1522
release {
1623
minifyEnabled false
@@ -28,7 +35,8 @@ dependencies {
2835
implementation 'com.google.android.material:material:1.2.1'
2936

3037
// 标题栏:https://github.com/getActivity/TitleBar
31-
implementation 'com.hjq:titlebar:8.2'
38+
implementation 'com.github.getActivity:TitleBar:8.5'
39+
3240
// 内存泄漏捕捉:https://github.com/square/leakcanary
33-
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.5'
41+
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
3442
}

build.gradle

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
31
buildscript {
42
repositories {
5-
jcenter()
3+
// 阿里云云效仓库:https://maven.aliyun.com/mvn/guide
4+
maven { url 'https://maven.aliyun.com/repository/jcenter' }
5+
maven { url 'https://maven.aliyun.com/repository/google' }
6+
// 华为开源镜像:https://mirrors.huaweicloud.com/
7+
maven { url 'https://repo.huaweicloud.com/repository/maven/' }
8+
// JitPack 远程仓库:https://jitpack.io
9+
maven { url 'https://jitpack.io' }
10+
mavenCentral()
611
google()
12+
jcenter()
713
}
814
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.3'
10-
classpath 'com.novoda:bintray-release:0.8.0'
15+
classpath 'com.android.tools.build:gradle:4.1.2'
1116
}
1217
}
1318

1419
allprojects {
1520
repositories {
16-
jcenter()
21+
maven { url 'https://maven.aliyun.com/repository/jcenter' }
22+
maven { url 'https://maven.aliyun.com/repository/google' }
23+
maven { url 'https://repo.huaweicloud.com/repository/maven/' }
24+
maven { url 'https://jitpack.io' }
25+
mavenCentral()
1726
google()
18-
maven {url "https://jitpack.io"}
19-
}
20-
21-
//解决app:mockableAndroidJar错误的问题
22-
gradle.taskGraph.whenReady {
23-
tasks.each { task ->
24-
if (task.name.equals('mockableAndroidJar')) {
25-
task.enabled = false
26-
}
27-
}
27+
jcenter()
2828
}
2929
}
3030

gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ org.gradle.jvmargs=-Xmx1536m
1515
# This option should only be used with decoupled projects. More details, visit
1616
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
1717
# org.gradle.parallel=true
18+
19+
# 表示使用 AndroidX
20+
android.useAndroidX = true
21+
# 表示将第三方库迁移到 AndroidX
22+
android.enableJetifier = true
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Wed Jul 18 11:21:06 CST 2018
2-
distributionBase=GRADLE_USER_HOME
3-
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
5-
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
1+
zipStoreBase = GRADLE_USER_HOME
2+
zipStorePath = wrapper/dists
3+
distributionBase = GRADLE_USER_HOME
4+
distributionPath = wrapper/dists
5+
distributionUrl = https\://services.gradle.org/distributions/gradle-6.5-all.zip

library/build.gradle

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
apply plugin: 'com.android.library'
2-
apply plugin: 'com.novoda.bintray-release'
32

43
android {
54

5+
// 资源前缀限制
66
resourcePrefix "logcat_"
77

88
compileSdkVersion 30
99

1010
defaultConfig {
1111
minSdkVersion 14
12-
//noinspection ExpiredTargetSdkVersion
13-
targetSdkVersion 23
14-
versionCode 95
15-
versionName "9.5"
12+
versionCode 96
13+
versionName "9.6"
1614
}
1715

1816
lintOptions {
@@ -22,16 +20,7 @@ android {
2220

2321
dependencies {
2422
// 悬浮窗框架:https://github.com/getActivity/XToast
25-
implementation 'com.hjq:xtoast:6.6'
26-
}
27-
28-
publish {
29-
userOrg = 'getactivity'
30-
groupId = 'com.hjq'
31-
artifactId = 'logcat'
32-
version = '9.5'
33-
description = 'This is to help developers quickly see the logging framework they want'
34-
website = "https://github.com/getActivity/Logcat"
23+
implementation 'com.github.getActivity:XToast:6.9'
3524
}
3625

3726
tasks.withType(Javadoc) {

library/src/main/java/com/hjq/logcat/ChooseWindow.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import android.widget.AdapterView;
88
import android.widget.ListView;
99

10-
import com.hjq.xtoast.OnClickListener;
1110
import com.hjq.xtoast.XToast;
1211

1312
import java.util.ArrayList;
@@ -20,7 +19,7 @@
2019
* time : 2020/01/24
2120
* desc : 列表选择类
2221
*/
23-
final class ChooseWindow extends XToast implements AdapterView.OnItemClickListener, OnClickListener<View> {
22+
final class ChooseWindow extends XToast<ChooseWindow> implements AdapterView.OnItemClickListener, XToast.OnClickListener<View> {
2423

2524
private final ChooseAdapter mAdapter;
2625
private OnListener mListener;

library/src/main/java/com/hjq/logcat/FloatingWindow.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import android.view.View;
88
import android.widget.ImageView;
99

10-
import com.hjq.xtoast.OnClickListener;
1110
import com.hjq.xtoast.XToast;
1211
import com.hjq.xtoast.draggable.SpringDraggable;
1312

@@ -17,7 +16,7 @@
1716
* time : 2020/01/24
1817
* desc : 悬浮窗口
1918
*/
20-
final class FloatingWindow extends XToast<FloatingWindow> implements OnClickListener<View> {
19+
final class FloatingWindow extends XToast<FloatingWindow> implements XToast.OnClickListener<View> {
2120

2221
FloatingWindow(Activity activity) {
2322
super(activity);

library/src/main/java/com/hjq/logcat/InitProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public boolean onCreate() {
2424
if (context instanceof Application) {
2525
FloatingLifecycle.with((Application) context);
2626
} else {
27-
Toast.makeText(context, "参数错误,无法启动 Logcat", Toast.LENGTH_LONG).show();
27+
Toast.makeText(context, R.string.logcat_launch_error, Toast.LENGTH_LONG).show();
2828
}
2929
}
3030
return true;

0 commit comments

Comments
 (0)