Skip to content

Commit e9f7a77

Browse files
committed
see 07/17 log
1 parent abc7a5d commit e9f7a77

File tree

14 files changed

+320
-189
lines changed

14 files changed

+320
-189
lines changed

app/build.gradle

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,7 @@
1-
apply plugin: 'com.android.application'
2-
3-
File signPropertiesFile = file('sign/keystore.properties')
4-
5-
android {
6-
compileSdkVersion compile_sdk_version
7-
defaultConfig {
8-
applicationId "com.blankj.androidutilcode"
9-
minSdkVersion min_sdk_version
10-
targetSdkVersion target_sdk_version
11-
versionCode version_code
12-
versionName version_name
13-
}
14-
15-
if (signPropertiesFile.exists()) {
16-
Properties properties = new Properties()
17-
properties.load(new FileInputStream(signPropertiesFile))
18-
signingConfigs {
19-
release {
20-
storeFile file(properties['keystore'])
21-
storePassword properties['storePassword']
22-
keyAlias properties['keyAlias']
23-
keyPassword properties['keyPassword']
24-
}
25-
}
26-
}
27-
28-
buildTypes {
29-
release {
30-
minifyEnabled true
31-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
32-
if (signPropertiesFile.exists()) {
33-
signingConfig signingConfigs.release
34-
}
35-
}
36-
}
37-
38-
sourceSets {
39-
main.res.srcDirs += 'src/main/res_core'
40-
main.res.srcDirs += 'src/main/res_sub'
41-
}
42-
43-
lintOptions {
44-
abortOnError false
45-
}
1+
plugins {
2+
id "com.android.application"
463
}
474

48-
dependencies {
49-
implementation fileTree(include: ['*.jar'], dir: 'libs')
50-
implementation project(':utilcode')
51-
implementation project(':subutil')
5+
configAndroidDomain project
526

53-
implementation "com.android.support:appcompat-v7:$support_version"
54-
implementation "com.android.support:design:$support_version"
55-
implementation 'com.r0adkll:slidableactivity:2.0.5'
56-
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
57-
// LeakCanary
58-
debugImplementation "com.squareup.leakcanary:leakcanary-android:$leakcanary_version"
59-
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"
60-
// implementation 'com.blankj:utilcode:1.17.2'
61-
}
7+
configAppDependencies project

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools"
34
package="com.blankj.androidutilcode">
45

56
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
@@ -56,6 +57,7 @@
5657
android:windowSoftInputMode="stateHidden|adjustPan">
5758
<intent-filter>
5859
<action android:name="android.intent.action.MAIN" />
60+
<action android:name="android.intent.action.VIEW" />
5961

6062
<category android:name="android.intent.category.LAUNCHER" />
6163
</intent-filter>
@@ -188,7 +190,8 @@
188190
</activity>
189191
<activity
190192
android:name=".feature.sub.pinyin.PinyinActivity"
191-
android:launchMode="singleTop" />
193+
android:launchMode="singleTop"
194+
android:screenOrientation="landscape" />
192195

193196
<meta-data
194197
android:name="app_meta_data"

app/src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<string name="app_name">Util</string>
43
<string name="core_util">Core Util</string>
54
<string name="sub_util">Sub Util</string>
65

build.gradle

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,17 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
apply from: 'version.gradle'
3+
apply from: 'config.gradle'
44
repositories {
55
google()
66
jcenter()
77
}
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.1.3'
10-
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
11-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
128

13-
classpath "tech.harmonysoft:traute-gradle:1.1.8"
14-
// NOTE: Do not place your application dependencies here; they belong
15-
// in the individual module build.gradle files
9+
dependencies {
10+
classpath depConfig.gradle
1611
}
1712
}
1813

1914
allprojects {
20-
apply plugin: "tech.harmonysoft.oss.traute"
2115
repositories {
2216
google()
2317
jcenter()
@@ -28,8 +22,8 @@ allprojects {
2822

2923
resolutionStrategy.eachDependency {
3024
if (it.requested.group == 'com.android.support'
31-
&& it.requested.name != 'multidex') {
32-
it.useVersion support_version
25+
&& !it.requested.name.contains('multidex')) {
26+
it.useVersion versionConfig.support
3327
}
3428
}
3529
}

config.gradle

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
ext {
2+
androidConfig = [
3+
applicationId : 'com.blankj.androidutilcode',
4+
appName : 'Util',
5+
6+
compileSdkVersion: 27,
7+
minSdkVersion : 14,
8+
targetSdkVersion : 27,
9+
versionCode : 1_017_004,
10+
versionName : '1.17.4'// E.g 1.9.72 => 1,009,072
11+
]
12+
13+
versionConfig = [
14+
// plugin
15+
gradle : '3.1.3',
16+
kotlin : '1.2.30',
17+
// lib
18+
support : '27.1.0',
19+
gson : '2.8.2',
20+
glide : '4.7.1',
21+
leakcanary : '1.5.4',
22+
// test
23+
junit : '4.12',
24+
robolectric: '3.1.2'
25+
]
26+
27+
depConfig = [
28+
gradle : "com.android.tools.build:gradle:$versionConfig.gradle",
29+
kotlin : "org.jetbrains.kotlin:kotlin-gradle-plugin:$versionConfig.kotlin",
30+
31+
support : [
32+
appcompat_v7: "com.android.support:appcompat-v7:$versionConfig.support",
33+
design : "com.android.support:design:$versionConfig.support",
34+
],
35+
leakcanary : [
36+
android : "com.squareup.leakcanary:leakcanary-android:$versionConfig.leakcanary",
37+
android_no_op: "com.squareup.leakcanary:leakcanary-android-no-op:$versionConfig.leakcanary",
38+
],
39+
gson : "com.google.code.gson:gson:$versionConfig.gson",
40+
glide : "com.github.bumptech.glide:glide:$versionConfig.glide",
41+
42+
junit : "junit:junit:$versionConfig.junit",
43+
robolectric: "org.robolectric:robolectric:$versionConfig.robolectric",
44+
]
45+
46+
configAndroidDomain = this.&configAndroidDomain
47+
configAppDependencies = this.&configAppDependencies
48+
configUtilCodeDependencies = this.&configUtilCodeDependencies
49+
configSubUtilDependencies = this.&configSubUtilDependencies
50+
}
51+
52+
def configAndroidDomain(Project pro) {
53+
if (pro.plugins.hasPlugin("com.android.application")) {
54+
configAppAndroidDomain(pro)
55+
} else {
56+
configLibAndroidDomain(pro)
57+
}
58+
}
59+
60+
def configAppAndroidDomain(Project pro) {
61+
configField(pro)
62+
configSigning(pro)
63+
pro.android {
64+
compileSdkVersion androidConfig.compileSdkVersion
65+
defaultConfig {
66+
applicationId androidConfig.applicationId
67+
minSdkVersion androidConfig.minSdkVersion
68+
targetSdkVersion androidConfig.targetSdkVersion
69+
versionCode androidConfig.versionCode
70+
versionName androidConfig.versionName
71+
}
72+
73+
buildTypes {
74+
release {
75+
minifyEnabled true
76+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
77+
}
78+
}
79+
80+
sourceSets {
81+
main.res.srcDirs += 'src/main/res_core'
82+
main.res.srcDirs += 'src/main/res_sub'
83+
}
84+
85+
lintOptions {
86+
abortOnError false
87+
}
88+
}
89+
}
90+
91+
def configField(Project pro) {
92+
pro.android.defaultConfig {
93+
resValue "string", "app_name", androidConfig.appName
94+
}
95+
}
96+
97+
def configSigning(Project pro) {
98+
File signPropertiesFile = file('sign/keystore.properties')
99+
if (!signPropertiesFile.exists()) return
100+
pro.android {
101+
Properties properties = new Properties()
102+
properties.load(new FileInputStream(signPropertiesFile))
103+
signingConfigs {
104+
release {
105+
storeFile file(properties['keystore'])
106+
storePassword properties['storePassword']
107+
keyAlias properties['keyAlias']
108+
keyPassword properties['keyPassword']
109+
}
110+
}
111+
buildTypes.release.signingConfig signingConfigs.release
112+
}
113+
}
114+
115+
def configLibAndroidDomain(Project pro) {
116+
pro.android {
117+
compileSdkVersion androidConfig.compileSdkVersion
118+
defaultConfig {
119+
minSdkVersion androidConfig.minSdkVersion
120+
versionCode androidConfig.versionCode
121+
versionName androidConfig.versionName
122+
}
123+
124+
buildTypes {
125+
release {
126+
minifyEnabled false
127+
// consumerProguardFiles 'proguard-rules.pro'
128+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
129+
}
130+
}
131+
132+
lintOptions {
133+
abortOnError false
134+
}
135+
136+
testOptions.unitTests.all {
137+
testLogging {
138+
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
139+
}
140+
}
141+
}
142+
}
143+
144+
145+
def configAppDependencies(Project pro) {
146+
pro.dependencies {
147+
implementation fileTree(include: ['*.jar'], dir: 'libs')
148+
implementation project(':utilcode')
149+
implementation project(':subutil')
150+
151+
implementation depConfig.support.appcompat_v7
152+
implementation depConfig.support.design
153+
implementation 'com.r0adkll:slidableactivity:2.0.5'
154+
// LeakCanary
155+
debugImplementation depConfig.leakcanary.android
156+
releaseImplementation depConfig.leakcanary.android_no_op
157+
// implementation 'com.blankj:utilcode:1.17.2'
158+
}
159+
}
160+
161+
def configUtilCodeDependencies(Project pro) {
162+
pro.dependencies {
163+
compileOnly depConfig.support.appcompat_v7
164+
compileOnly depConfig.support.design
165+
166+
testImplementation depConfig.junit
167+
testImplementation depConfig.robolectric
168+
testImplementation depConfig.support.appcompat_v7
169+
}
170+
}
171+
172+
def configSubUtilDependencies(Project pro) {
173+
pro.dependencies {
174+
compileOnly depConfig.support.appcompat_v7
175+
compileOnly depConfig.support.design
176+
177+
api depConfig.gson
178+
api(depConfig.glide) {
179+
exclude group: "com.android.support"
180+
}
181+
182+
testImplementation depConfig.junit
183+
testImplementation depConfig.robolectric
184+
}
185+
}
File renamed without changes.
File renamed without changes.

subutil/build.gradle

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,8 @@
1-
apply plugin: 'com.android.library'
2-
apply from: 'readme.gradle'
3-
4-
android {
5-
compileSdkVersion compile_sdk_version
6-
defaultConfig {
7-
minSdkVersion min_sdk_version
8-
versionCode version_code
9-
versionName version_name
10-
}
11-
12-
buildTypes {
13-
release {
14-
minifyEnabled false
15-
// consumerProguardFiles 'proguard-rules.pro'
16-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17-
}
18-
}
19-
20-
lintOptions {
21-
abortOnError false
22-
}
23-
24-
testOptions.unitTests.all {
25-
testLogging {
26-
events 'passed', 'skipped', 'failed', 'standardOut', 'standardError'
27-
}
28-
}
1+
apply {
2+
plugin('com.android.library')
3+
from('readme.gradle')
294
}
305

31-
dependencies {
32-
compileOnly "com.android.support:appcompat-v7:$support_version"
33-
compileOnly "com.android.support:design:$support_version"
34-
35-
testImplementation "junit:junit:$junit_version"
36-
testImplementation "org.robolectric:robolectric:$robolectric_version"
37-
38-
api "com.google.code.gson:gson:$gson_version"
6+
configAndroidDomain project
397

40-
// glide
41-
api ("com.github.bumptech.glide:glide:$glide_version") {
42-
exclude group: "com.android.support"
43-
}
44-
}
8+
configSubUtilDependencies project

update_log.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
* 18/06/29 修复 IntentUtils 分享图片判断逻辑,CacheDiskUtils 可放入 byte[0],发布 1.17.3
1+
* 18/07/16 新增 ScreenUtils#adaptPortraitScreen 和 ScreenUtils#adaptLandscapeScreen,发布 1.17.3
2+
* 18/07/13 修复 IntentUtils 分享图片判断逻辑,CacheDiskUtils 可放入 byte[0]
23
* 18/06/29 修复 FragmentUtils 中 getFragmentManager 空指针错误,发布 1.17.2
34
* 18/06/27 新增 UriUtils#uri2File
45
* 18/06/25 新增 KeyboardUtils#fixAndroidBug5497,发布 1.17.1 版本

0 commit comments

Comments
 (0)