Skip to content

Commit bc1d1d1

Browse files
author
wanjian
committed
no message
1 parent 47ee605 commit bc1d1d1

36 files changed

+369
-18
lines changed

app/build.gradle

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,32 @@ android {
4848
}
4949
sourceSets {
5050
demo {
51-
res.srcDirs = ['src/main/res','src/pad/res']
51+
res.srcDirs = ['src/main/res', 'src/pad/res']
5252
}
5353
}
5454
}
5555

5656
dependencies {
57-
implementation fileTree(dir: 'libs', include: ['*.jar'])
57+
implementation fileTree(include: ['*.jar'], dir: 'libs')
5858
implementation 'com.android.support:appcompat-v7:28.0.0'
5959
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
6060
testImplementation 'junit:junit:4.12'
6161
androidTestImplementation 'com.android.support.test:runner:1.0.2'
6262
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
63+
implementation project(':module2')
6364
}
6465

6566
tinyPng {
67+
//http://www.bccto.me/ 临时邮箱申请
68+
6669
enable true
67-
keys=["SWxfXRhZ6H1wnXnd3j5HmbK8wCpvdH0X",]
70+
keys = ["SWxfXRhZ6H1wnXnd3j5HmbK8wCpvdH0X",
71+
"FBYz4WZR5tj9S4Jv4tCL5m3KgrQnXBgP",
72+
"1sQXBgXvvhfx5j1l10DKRvVvrlD3rcS4",
73+
"DdMZxbJ7W9K15hSZ6G5QVNbqh7PKGxjX",
74+
"xS2CNP0w7Sp4Xz7P1DvcCZNsQ9QJNsyb",
75+
"X7z8kgM3zw1Fr3R8RQTkhN3Kynx8xpdX",
76+
"mT1td5Qt6JW7yy0n2pkJd6ZwBxmHsjBy",
77+
"ctW1PG2wJhpJYxDhcj4NSgQ14WFxC7gb",
78+
]
6879
}

app/exclude_pictures.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
app/src/main/res/drawable/ic_launcher_background.xml
2-
app/src/main/res/drawable-24/ic_launcher_background.xml
1+
app/src/main/res/mipmap-hdpi/ic_launcher.png
2+
main/res/mipmap-mdpi/ic_launc

app/processed_pictures

Lines changed: 0 additions & 12 deletions
This file was deleted.
-364 Bytes
Loading
889 Bytes
Loading
-595 Bytes
Loading
-243 Bytes
Loading
-376 Bytes
Loading
-502 Bytes
Loading
-702 Bytes
Loading
-644 Bytes
Loading
-869 Bytes
Loading
-1.01 KB
Loading
-1011 Bytes
Loading
-595 Bytes
Loading

app/src/pad/res/drawable/img1.png

80.8 KB
Loading

app/src/pad/res/drawable/img2.png

4.46 KB
Loading

app/src/pad/res/drawable/img3.png

6.19 KB
Loading

app/src/pad/res/drawable/img4.jpg

981 Bytes
Loading

module2/.gitignore

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

module2/build.gradle

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apply plugin: 'com.android.library'
2+
apply plugin: "com.wanjian.tinypng"
3+
android {
4+
compileSdkVersion 28
5+
6+
7+
8+
defaultConfig {
9+
minSdkVersion 19
10+
targetSdkVersion 28
11+
versionCode 1
12+
versionName "1.0"
13+
14+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15+
16+
}
17+
18+
buildTypes {
19+
release {
20+
minifyEnabled false
21+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
22+
}
23+
}
24+
25+
}
26+
27+
dependencies {
28+
implementation fileTree(dir: 'libs', include: ['*.jar'])
29+
30+
implementation 'com.android.support:appcompat-v7:28.0.0'
31+
testImplementation 'junit:junit:4.12'
32+
androidTestImplementation 'com.android.support.test:runner:1.0.2'
33+
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
34+
}
35+
tinyPng {
36+
enable true
37+
keys=["SWxfXRhZ6H1wnXnd3j5HmbK8wCpvdH0X",]
38+
}

module2/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.wanjian.module2;
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+
* Instrumented 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() {
21+
// Context of the app under test.
22+
Context appContext = InstrumentationRegistry.getTargetContext();
23+
24+
assertEquals("com.wanjian.module2.test", appContext.getPackageName());
25+
}
26+
}

module2/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.wanjian.module2" />
19.1 KB
Loading
206 KB
Loading
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">module2</string>
3+
</resources>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.wanjian.module2;
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() {
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', ':tinypng'
1+
include ':app', ':tinypng', ':module2'

tinypng/.gitignore

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

tinypng/build.gradle

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
apply plugin: 'groovy'
2+
apply plugin: 'maven'
3+
repositories {
4+
mavenLocal()
5+
jcenter()
6+
}
7+
8+
dependencies {
9+
compile gradleApi()
10+
// https://mvnrepository.com/artifact/org.javassist/javassist
11+
// compile group: 'org.javassist', name: 'javassist', version: '3.23.1-GA'
12+
compile 'com.tinify:tinify:1.1.1'
13+
}
14+
15+
group 'com.wanjian.plugin'
16+
version '1.0.0-SNAPSHOT'
17+
18+
sourceCompatibility = 1.8
19+
20+
uploadArchives {
21+
repositories {
22+
mavenDeployer {
23+
repository(url: uri('./repo'))
24+
}
25+
}
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.wanjian.plugin
2+
3+
import com.wanjian.plugin.config.TinyPng
4+
import com.wanjian.plugin.tasks.TinyPngProcessTask
5+
import org.gradle.api.GradleException
6+
import org.gradle.api.Plugin
7+
import org.gradle.api.Project
8+
9+
class TinyPngPlugin implements Plugin<Project> {
10+
@Override
11+
void apply(Project project) {
12+
//
13+
def variants;
14+
if (project.plugins.hasPlugin('com.android.application')) {
15+
variants = project.android.applicationVariants
16+
} else if (project.plugins.hasPlugin('com.android.library')) {
17+
variants = project.android.libraryVariants
18+
} else {
19+
throw new GradleException('Android plugin required')
20+
}
21+
22+
project.extensions.create('tinyPng', TinyPng)
23+
24+
project.afterEvaluate {
25+
if (project.tinyPng.enable == false) {
26+
project.logger.error("tinypng is disabled.")
27+
return
28+
}
29+
30+
variants.all { variant ->
31+
def variantName = variant.name.capitalize()
32+
TinyPngProcessTask tinyPngProcessTask = project.tasks.create("tinyPng${variantName}", TinyPngProcessTask)
33+
tinyPngProcessTask.setVariant(variant)
34+
// project.tasks.findByName("generate${variantName}BuildConfig").dependsOn tinyPngProcessTask
35+
project.tasks.findByName("generate${variantName}Resources").dependsOn tinyPngProcessTask
36+
}
37+
}
38+
}
39+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.wanjian.plugin.config;
2+
3+
public class TinyPng {
4+
5+
boolean enable;
6+
7+
def keys = [];
8+
}

0 commit comments

Comments
 (0)