Skip to content

Commit 793d747

Browse files
committed
添加library
1 parent 6c4799d commit 793d747

File tree

14 files changed

+139
-4
lines changed

14 files changed

+139
-4
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ android {
2020
}
2121

2222
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
23+
compile fileTree(include: ['*.jar'], dir: 'libs')
2424
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
2525
exclude group: 'com.android.support', module: 'support-annotations'
2626
})
2727
compile 'com.android.support:appcompat-v7:26.+'
2828
compile 'com.android.support.constraint:constraint-layout:1.0.2'
2929
testCompile 'junit:junit:4.12'
30+
compile project(':library')
3031
}

library/.gitignore

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

library/build.gradle

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apply plugin: 'com.android.library'
2+
3+
android {
4+
compileSdkVersion 26
5+
buildToolsVersion "26.0.1"
6+
7+
defaultConfig {
8+
minSdkVersion 15
9+
targetSdkVersion 26
10+
versionCode 1
11+
versionName "1.0"
12+
13+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
14+
15+
}
16+
buildTypes {
17+
release {
18+
minifyEnabled false
19+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
20+
}
21+
}
22+
}
23+
24+
dependencies {
25+
compile fileTree(dir: 'libs', include: ['*.jar'])
26+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
27+
exclude group: 'com.android.support', module: 'support-annotations'
28+
})
29+
compile 'com.android.support:appcompat-v7:26.+'
30+
testCompile 'junit:junit:4.12'
31+
}

library/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/lvruheng/Library/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
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.example.library;
2+
3+
import android.content.Context;
4+
import android.support.test.InstrumentationRegistry;
5+
import android.support.test.runner.AndroidJUnit4;
6+
7+
import org.junit.Test;
8+
import org.junit.runner.RunWith;
9+
10+
import static org.junit.Assert.*;
11+
12+
/**
13+
* Instrumentation test, which will execute on an Android device.
14+
*
15+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
16+
*/
17+
@RunWith(AndroidJUnit4.class)
18+
public class ExampleInstrumentedTest {
19+
@Test
20+
public void useAppContext() throws Exception {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.example.library.test", appContext.getPackageName());
25+
}
26+
}

library/src/main/AndroidManifest.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
3+
package="com.example.library"
4+
>
5+
6+
<application android:allowBackup="true"
7+
android:label="@string/app_name"
8+
android:supportsRtl="true"
9+
>
10+
11+
</application>
12+
13+
</manifest>

app/src/main/java/com/example/lvruheng/autoflowlayout/AutoFlowLayout.java renamed to library/src/main/java/com/example/library/AutoFlowLayout.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.lvruheng.autoflowlayout;
1+
package com.example.library;
22

33
import android.content.Context;
44
import android.content.res.TypedArray;

app/src/main/java/com/example/lvruheng/autoflowlayout/FlowAdapter.java renamed to library/src/main/java/com/example/library/FlowAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.example.lvruheng.autoflowlayout;
1+
package com.example.library;
22

33
import android.view.View;
44

library/src/main/res/values/attrs.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<declare-styleable name="AutoFlowLayout">
4+
<attr name="singleLine" format="boolean"></attr>
5+
<attr name="maxLines" format="integer"></attr>
6+
<attr name="multiChecked" format="boolean"></attr>
7+
<attr name="horizontalSpace" format="dimension"></attr>
8+
<attr name="verticalSpace" format="dimension"></attr>
9+
<attr name="columnNumbers" format="integer"></attr>
10+
<attr name="rowNumbers" format="integer"></attr>
11+
<attr name="cutLineWidth" format="dimension"></attr>
12+
<attr name="cutLineColor" format="color"></attr>
13+
<attr name="cutLine" format="boolean"></attr>
14+
<attr name="lineCenter" format="boolean"></attr>
15+
</declare-styleable>
16+
</resources>
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">library</string>
3+
</resources>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.example.library;
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+
}

settings.gradle

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

0 commit comments

Comments
 (0)