Skip to content

Commit d38c0f0

Browse files
committed
整理文件,支持
1 parent 4e76eb5 commit d38c0f0

30 files changed

Lines changed: 151 additions & 52 deletions

app/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,10 @@ dependencies {
2525
testImplementation 'junit:junit:4.12'
2626
androidTestImplementation 'com.android.support.test:runner:1.0.1'
2727
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
28-
implementation project(':engine')
28+
implementation project(':library')
29+
compile 'com.squareup.retrofit2:retrofit:2.4.0'
30+
implementation "io.reactivex.rxjava2:rxjava:2.1.12"
31+
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
32+
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
33+
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
2934
}
Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,53 @@
11
package com.egeio.network;
22

3-
import android.support.v7.app.AppCompatActivity;
43
import android.os.Bundle;
4+
import android.support.v7.app.AppCompatActivity;
5+
6+
import net.engine.NetEngine;
7+
import net.engine.NetParams;
8+
9+
import io.reactivex.Observer;
10+
import io.reactivex.android.schedulers.AndroidSchedulers;
11+
import io.reactivex.disposables.Disposable;
12+
import io.reactivex.schedulers.Schedulers;
513

614
public class MainActivity extends AppCompatActivity {
715

816
@Override
917
protected void onCreate(Bundle savedInstanceState) {
1018
super.onCreate(savedInstanceState);
1119
setContentView(R.layout.activity_main);
20+
NetEngine.request(
21+
NetParams.builder()
22+
.baseUrl("http://www.baidu.com")
23+
.noVersion()
24+
.api("")
25+
.get()
26+
.result(String.class)
27+
.build())
28+
.observable()
29+
.subscribeOn(Schedulers.io())
30+
.observeOn(AndroidSchedulers.mainThread())
31+
.subscribe(new Observer<String>() {
32+
@Override
33+
public void onSubscribe(Disposable d) {
34+
35+
}
36+
37+
@Override
38+
public void onNext(String s) {
39+
40+
}
41+
42+
@Override
43+
public void onError(Throwable e) {
44+
45+
}
46+
47+
@Override
48+
public void onComplete() {
49+
50+
}
51+
});
1252
}
1353
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.egeio.network;
2+
3+
import io.reactivex.Observable;
4+
import retrofit2.http.GET;
5+
6+
public interface RestApi {
7+
8+
@GET
9+
public Observable<String> baidu();
10+
11+
}

build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ buildscript {
55
repositories {
66
google()
77
jcenter()
8+
maven { url "https://jitpack.io" }
89
}
910
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.1.0'
11-
11+
classpath 'com.android.tools.build:gradle:3.1.2'
1212

1313
// NOTE: Do not place your application dependencies here; they belong
1414
// in the individual module build.gradle files
15+
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
1516
}
1617
}
1718

@@ -25,3 +26,8 @@ allprojects {
2526
task clean(type: Delete) {
2627
delete rootProject.buildDir
2728
}
29+
30+
subprojects {
31+
apply plugin: 'com.github.dcendents.android-maven'
32+
group = 'com.github.wanpg'
33+
}

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

Lines changed: 0 additions & 3 deletions
This file was deleted.

jitpack-aar.gradle

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// build a jar with source files
2+
task sourcesJar(type: Jar) {
3+
from android.sourceSets.main.java.srcDirs
4+
classifier = 'sources'
5+
}
6+
7+
task javadoc(type: Javadoc) {
8+
failOnError false
9+
source = android.sourceSets.main.java.sourceFiles
10+
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
11+
classpath += configurations.compile
12+
}
13+
14+
// build a jar with javadoc
15+
task javadocJar(type: Jar, dependsOn: javadoc) {
16+
classifier = 'javadoc'
17+
from javadoc.destinationDir
18+
}
19+
20+
artifacts {
21+
archives sourcesJar
22+
archives javadocJar
23+
}

jitpack-jar.gradle

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// build a jar with source files
2+
task sourcesJar(type: Jar) {
3+
from sourceSets.main.allJava
4+
classifier = 'sources'
5+
}
6+
7+
// build a jar with javadoc
8+
task javadocJar(type: Jar, dependsOn: javadoc) {
9+
classifier = 'javadoc'
10+
from javadoc.destinationDir
11+
}
12+
13+
artifacts {
14+
archives sourcesJar
15+
archives javadocJar
16+
}
File renamed without changes.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ apply plugin: 'com.android.library'
33
android {
44
compileSdkVersion 27
55

6-
7-
86
defaultConfig {
97
minSdkVersion 14
108
targetSdkVersion 27
@@ -26,11 +24,13 @@ android {
2624

2725
dependencies {
2826
implementation fileTree(dir: 'libs', include: ['*.jar'])
29-
30-
implementation 'com.android.support:appcompat-v7:27.1.1'
27+
compileOnly 'com.android.support:appcompat-v7:27.1.1'
3128
testImplementation 'junit:junit:4.12'
3229
androidTestImplementation 'com.android.support.test:runner:1.0.1'
3330
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
34-
implementation "io.reactivex.rxjava2:rxjava:2.1.6"
35-
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
31+
compileOnly "io.reactivex.rxjava2:rxjava:2.1.12"
32+
compileOnly 'io.reactivex.rxjava2:rxandroid:2.0.2'
3633
}
34+
35+
36+
apply from: '../jitpack-aar.gradle'

0 commit comments

Comments
 (0)