Skip to content

Commit e1a4a1a

Browse files
committed
see 07/08 log
1 parent 47d2b34 commit e1a4a1a

File tree

13 files changed

+162
-5
lines changed

13 files changed

+162
-5
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ dependencies {
5353
def leakCanary = "com.squareup.leakcanary:leakcanary-android-no-op:$LEAKCANARY_VERSION"
5454

5555
compile project(':utilcode')
56+
compile project(':subutil')
5657
compile "com.android.support:appcompat-v7:$SUPPORT_VERSION"
5758
compile "com.android.support:support-v4:$SUPPORT_VERSION"
5859
compile "com.android.support:design:$SUPPORT_VERSION"

settings.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':app', ':utilcode'
1+
include ':app', ':utilcode', ':subutil'

subutil/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

subutil/build.gradle

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: 'jacoco'
3+
4+
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'createDebugCoverageReport']) {
5+
6+
reports {
7+
xml.enabled = true
8+
html.enabled = true
9+
}
10+
11+
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
12+
def debugTree = fileTree(dir: "${buildDir}/intermediates/classes/debug", excludes: fileFilter)
13+
def mainSrc = "${project.projectDir}/src/main/java"
14+
15+
sourceDirectories = files([mainSrc])
16+
classDirectories = files([debugTree])
17+
executionData = fileTree(dir: "$buildDir", includes: [
18+
"jacoco/testDebugUnitTest.exec",
19+
"outputs/code-coverage/connected/*coverage.ec"
20+
])
21+
}
22+
23+
android {
24+
compileSdkVersion 25
25+
buildToolsVersion "25.0.3"
26+
27+
defaultConfig {
28+
minSdkVersion 14
29+
versionCode 41
30+
versionName "1.7.1"
31+
}
32+
33+
buildTypes {
34+
debug {
35+
testCoverageEnabled true
36+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
37+
}
38+
release {
39+
minifyEnabled true
40+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
41+
}
42+
}
43+
44+
lintOptions {
45+
abortOnError false
46+
}
47+
}
48+
49+
tasks.matching { it instanceof Test }.all {
50+
testLogging.events = ["failed", "passed", "skipped"]
51+
}
52+
53+
dependencies {
54+
final SUPPORT_VERSION = '25.3.1'
55+
final JUNIT_VERSION = '4.12'
56+
final TRUTH_VERSION = '0.31'
57+
final ROBOLECTRIC_VERSION = '3.1.2'
58+
59+
provided "com.android.support:appcompat-v7:$SUPPORT_VERSION"
60+
provided "com.android.support:support-v4:$SUPPORT_VERSION"
61+
provided "com.android.support:design:$SUPPORT_VERSION"
62+
63+
testCompile "junit:junit:$JUNIT_VERSION"
64+
testCompile "org.robolectric:robolectric:$ROBOLECTRIC_VERSION"
65+
}
66+
//apply from: "https://raw.githubusercontent.com/xiaopansky/android-library-publish-to-jcenter/master/bintrayUpload.gradle"
67+
//gradlew bintrayUpload

subutil/proguard-rules.pro

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/Blankj/Library/Android/android_sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
18+
19+
# Uncomment this to preserve the line number information for
20+
# debugging stack traces.
21+
#-keepattributes SourceFile,LineNumberTable
22+
23+
# If you keep the line number information, uncomment this to
24+
# hide the original source file name.
25+
#-renamesourcefileattribute SourceFile

subutil/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<manifest package="com.blankj.subutil"/>

utilcode/src/main/java/com/blankj/utilcode/util/LunarUtils.java renamed to subutil/src/main/java/com/blankj/subutil/util/LunarUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.blankj.utilcode.util;
1+
package com.blankj.subutil.util;
22

33
/**
44
* <pre>

utilcode/src/main/java/com/blankj/utilcode/util/PinyinUtils.java renamed to subutil/src/main/java/com/blankj/subutil/util/PinyinUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.blankj.utilcode.util;
1+
package com.blankj.subutil.util;
22

33
import android.support.v4.util.SimpleArrayMap;
44

utilcode/src/main/java/com/blankj/utilcode/util/ThreadPoolUtils.java renamed to subutil/src/main/java/com/blankj/subutil/util/ThreadPoolUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.blankj.utilcode.util;
1+
package com.blankj.subutil.util;
22

33
import android.support.annotation.IntDef;
44

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.blankj.subutil.util;
2+
3+
import android.annotation.SuppressLint;
4+
import android.content.Context;
5+
import android.support.annotation.NonNull;
6+
7+
/**
8+
* <pre>
9+
* author: Blankj
10+
* blog : http://blankj.com
11+
* time : 16/12/08
12+
* desc : Utils初始化相关
13+
* </pre>
14+
*/
15+
public final class Utils {
16+
17+
@SuppressLint("StaticFieldLeak")
18+
private static Context context;
19+
20+
private Utils() {
21+
throw new UnsupportedOperationException("u can't instantiate me...");
22+
}
23+
24+
/**
25+
* 初始化工具类
26+
*
27+
* @param context 上下文
28+
*/
29+
public static void init(@NonNull final Context context) {
30+
Utils.context = context.getApplicationContext();
31+
}
32+
33+
/**
34+
* 获取ApplicationContext
35+
*
36+
* @return ApplicationContext
37+
*/
38+
public static Context getContext() {
39+
if (context != null) return context;
40+
throw new NullPointerException("u should init first");
41+
}
42+
}

utilcode/src/main/java/com/blankj/utilcode/util/VibrationUtils.java renamed to subutil/src/main/java/com/blankj/subutil/util/VibrationUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.blankj.utilcode.util;
1+
package com.blankj.subutil.util;
22

33
/**
44
* <pre>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<string name="app_name">subutil</string>
3+
</resources>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.blankj.subutil;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.*;
6+
7+
/**
8+
* Example local unit test, which will execute on the development machine (host).
9+
*
10+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
11+
*/
12+
public class ExampleUnitTest {
13+
@Test
14+
public void addition_isCorrect() throws Exception {
15+
assertEquals(4, 2 + 2);
16+
}
17+
}

0 commit comments

Comments
 (0)