From 8b35abf95f4cc017a36943e4a18620432669cec8 Mon Sep 17 00:00:00 2001 From: yale8848 Date: Wed, 29 Nov 2017 09:43:55 +0800 Subject: [PATCH] add rx2 --- app/build.gradle | 10 +-- gradle/wrapper/gradle-wrapper.properties | 3 +- .../.gitignore | 0 .../LICENSE | 0 .../build.gradle | 0 .../config/RetrofitCache.gradle | 0 .../proguard-rules.pro | 0 .../src/main/AndroidManifest.xml | 0 .../CacheInterceptorListener.java | 0 .../android/retrofitcachelib/MethodInfo.java | 0 .../retrofitcachelib/RetrofitCache.java | 0 .../retrofitcachelib/RetrofitCache2.java | 0 .../android/retrofitcachelib/anno/Cache.java | 0 .../android/retrofitcachelib/anno/Mock.java | 0 .../factory/CacheFactory.java | 0 .../intercept/BaseInterceptor.java | 0 .../intercept/CacheForceInterceptorNoNet.java | 0 .../intercept/CacheInterceptorOnNet.java | 0 .../retrofit2/ParameterHandler.java | 0 .../retrofit2/RequestBuilder.java | 0 .../retrofit2/ServiceMethod.java | 0 .../retrofitcachelib/retrofit2/Utils.java | 0 .../transformer/CacheTransformer.java | 0 .../retrofitcachelib/util/LogUtil.java | 0 .../retrofitcachelib/util/NetUtils.java | 0 retrofitcachelibrx2/.gitignore | 1 + retrofitcachelibrx2/build.gradle | 38 +++++++++ .../config/RetrofitCache.gradle | 78 +++++++++++++++++++ retrofitcachelibrx2/proguard-rules.pro | 21 +++++ .../src/main/AndroidManifest.xml | 2 + .../src/main/res/values/strings.xml | 3 + .../retrofitcachelibrx2/ExampleUnitTest.java | 17 ++++ settings.gradle | 2 +- 33 files changed, 168 insertions(+), 7 deletions(-) rename {retrofitcachelibRX1 => retrofitcachelib}/.gitignore (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/LICENSE (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/build.gradle (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/config/RetrofitCache.gradle (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/proguard-rules.pro (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/AndroidManifest.xml (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/CacheInterceptorListener.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/MethodInfo.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache2.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/anno/Cache.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/anno/Mock.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/factory/CacheFactory.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/intercept/BaseInterceptor.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheForceInterceptorNoNet.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheInterceptorOnNet.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ParameterHandler.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/RequestBuilder.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ServiceMethod.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/Utils.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/transformer/CacheTransformer.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/util/LogUtil.java (100%) rename {retrofitcachelibRX1 => retrofitcachelib}/src/main/java/ren/yale/android/retrofitcachelib/util/NetUtils.java (100%) create mode 100644 retrofitcachelibrx2/.gitignore create mode 100644 retrofitcachelibrx2/build.gradle create mode 100644 retrofitcachelibrx2/config/RetrofitCache.gradle create mode 100644 retrofitcachelibrx2/proguard-rules.pro create mode 100644 retrofitcachelibrx2/src/main/AndroidManifest.xml create mode 100644 retrofitcachelibrx2/src/main/res/values/strings.xml create mode 100644 retrofitcachelibrx2/src/test/java/com/daoxuehao/android/retrofitcachelibrx2/ExampleUnitTest.java diff --git a/app/build.gradle b/app/build.gradle index 0503969..9882f8c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,14 +26,14 @@ android { dependencies { - implementation project(':retrofitcachelibRX1') - implementation 'io.reactivex:rxjava:1.2.4' + implementation project(':retrofitcachelib') implementation 'io.reactivex:rxandroid:1.2.1' - implementation 'com.squareup.retrofit2:retrofit:2.1.0' - implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0' + implementation 'com.squareup.retrofit2:converter-gson:2.1.0' - implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.4.1' implementation 'com.squareup.okio:okio:1.11.0' + + + implementation 'com.alibaba:fastjson:1.1.55.android' implementation 'com.android.support:appcompat-v7:26.0.2' implementation 'com.android.support.constraint:constraint-layout:1.0.0-alpha9' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 09f79b9..b7765ca 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +#distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip +distributionUrl=file:///C:/YaleSoftFiles/Develop/gradle-4.2.1-all.zip diff --git a/retrofitcachelibRX1/.gitignore b/retrofitcachelib/.gitignore similarity index 100% rename from retrofitcachelibRX1/.gitignore rename to retrofitcachelib/.gitignore diff --git a/retrofitcachelibRX1/LICENSE b/retrofitcachelib/LICENSE similarity index 100% rename from retrofitcachelibRX1/LICENSE rename to retrofitcachelib/LICENSE diff --git a/retrofitcachelibRX1/build.gradle b/retrofitcachelib/build.gradle similarity index 100% rename from retrofitcachelibRX1/build.gradle rename to retrofitcachelib/build.gradle diff --git a/retrofitcachelibRX1/config/RetrofitCache.gradle b/retrofitcachelib/config/RetrofitCache.gradle similarity index 100% rename from retrofitcachelibRX1/config/RetrofitCache.gradle rename to retrofitcachelib/config/RetrofitCache.gradle diff --git a/retrofitcachelibRX1/proguard-rules.pro b/retrofitcachelib/proguard-rules.pro similarity index 100% rename from retrofitcachelibRX1/proguard-rules.pro rename to retrofitcachelib/proguard-rules.pro diff --git a/retrofitcachelibRX1/src/main/AndroidManifest.xml b/retrofitcachelib/src/main/AndroidManifest.xml similarity index 100% rename from retrofitcachelibRX1/src/main/AndroidManifest.xml rename to retrofitcachelib/src/main/AndroidManifest.xml diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/CacheInterceptorListener.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/CacheInterceptorListener.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/CacheInterceptorListener.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/CacheInterceptorListener.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/MethodInfo.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/MethodInfo.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/MethodInfo.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/MethodInfo.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache2.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache2.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache2.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/RetrofitCache2.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/anno/Cache.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/anno/Cache.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/anno/Cache.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/anno/Cache.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/anno/Mock.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/anno/Mock.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/anno/Mock.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/anno/Mock.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/factory/CacheFactory.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/factory/CacheFactory.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/factory/CacheFactory.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/factory/CacheFactory.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/intercept/BaseInterceptor.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/intercept/BaseInterceptor.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/intercept/BaseInterceptor.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/intercept/BaseInterceptor.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheForceInterceptorNoNet.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheForceInterceptorNoNet.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheForceInterceptorNoNet.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheForceInterceptorNoNet.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheInterceptorOnNet.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheInterceptorOnNet.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheInterceptorOnNet.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/intercept/CacheInterceptorOnNet.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ParameterHandler.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ParameterHandler.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ParameterHandler.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ParameterHandler.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/RequestBuilder.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/RequestBuilder.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/RequestBuilder.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/RequestBuilder.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ServiceMethod.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ServiceMethod.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ServiceMethod.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/ServiceMethod.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/Utils.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/Utils.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/Utils.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/retrofit2/Utils.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/transformer/CacheTransformer.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/transformer/CacheTransformer.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/transformer/CacheTransformer.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/transformer/CacheTransformer.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/util/LogUtil.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/util/LogUtil.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/util/LogUtil.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/util/LogUtil.java diff --git a/retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/util/NetUtils.java b/retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/util/NetUtils.java similarity index 100% rename from retrofitcachelibRX1/src/main/java/ren/yale/android/retrofitcachelib/util/NetUtils.java rename to retrofitcachelib/src/main/java/ren/yale/android/retrofitcachelib/util/NetUtils.java diff --git a/retrofitcachelibrx2/.gitignore b/retrofitcachelibrx2/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/retrofitcachelibrx2/.gitignore @@ -0,0 +1 @@ +/build diff --git a/retrofitcachelibrx2/build.gradle b/retrofitcachelibrx2/build.gradle new file mode 100644 index 0000000..8a33f6a --- /dev/null +++ b/retrofitcachelibrx2/build.gradle @@ -0,0 +1,38 @@ +apply plugin: 'com.android.library' + +android { + compileSdkVersion 26 + + + + defaultConfig { + minSdkVersion 14 + targetSdkVersion 26 + versionCode 1 + versionName "1.0" + + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation 'com.android.support:appcompat-v7:26.1.0' + testImplementation 'junit:junit:4.12' + + implementation'io.reactivex.rxjava2:rxjava:2.0.7' + implementation'io.reactivex.rxjava2:rxandroid:2.0.1' + implementation'com.squareup.retrofit2:retrofit:2.2.0' + implementation'com.squareup.retrofit2:converter-gson:2.2.0' + implementation'com.squareup.retrofit2:adapter-rxjava2:2.2.0' + +} +apply from: './config/RetrofitCache.gradle' \ No newline at end of file diff --git a/retrofitcachelibrx2/config/RetrofitCache.gradle b/retrofitcachelibrx2/config/RetrofitCache.gradle new file mode 100644 index 0000000..6bd7e78 --- /dev/null +++ b/retrofitcachelibrx2/config/RetrofitCache.gradle @@ -0,0 +1,78 @@ + +//jcenter upload +apply plugin: 'com.github.dcendents.android-maven' +apply plugin: 'com.jfrog.bintray' + + +version = '0.0.1' + +repositories { + jcenter() +} +def siteUrl = 'https://github.com/yale8848/RetrofitCache' // 项目的主页 +def gitUrl = 'https://github.com/yale8848/RetrofitCache.git' // Git仓库的url + +group = "ren.yale.android" +install { + repositories.mavenInstaller { + pom { + project { + packaging 'aar' + name 'retrofitcacherx2' //项目描述 + url siteUrl + licenses { + license { + name 'The Apache Software License, Version 2.0' + url 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id 'Yale' //填写的一些基本信息 + name 'Yale' + email 'royal8848@163.com' + } + } + scm { + connection gitUrl + developerConnection gitUrl + url siteUrl + } + } + } + } +} + +task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' +} +task javadoc(type: Javadoc) { + options.encoding = "utf-8" + source = android.sourceSets.main.java.srcDirs + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} +artifacts { + //archives javadocJar + archives sourcesJar +} + +Properties properties = new Properties() +properties.load(project.rootProject.file('local.properties').newDataInputStream()) +bintray { + user = properties.getProperty("bintray.user") + key = properties.getProperty("bintray.apikey") + configurations = ['archives'] + pkg { + repo = "maven" + name = "retrofitcacherx2" //发布到JCenter上的项目名字 + websiteUrl = siteUrl + vcsUrl = gitUrl + licenses = ["Apache-2.0"] + publish = true + } +} \ No newline at end of file diff --git a/retrofitcachelibrx2/proguard-rules.pro b/retrofitcachelibrx2/proguard-rules.pro new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ b/retrofitcachelibrx2/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/retrofitcachelibrx2/src/main/AndroidManifest.xml b/retrofitcachelibrx2/src/main/AndroidManifest.xml new file mode 100644 index 0000000..ade76e9 --- /dev/null +++ b/retrofitcachelibrx2/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + diff --git a/retrofitcachelibrx2/src/main/res/values/strings.xml b/retrofitcachelibrx2/src/main/res/values/strings.xml new file mode 100644 index 0000000..753bd58 --- /dev/null +++ b/retrofitcachelibrx2/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + retrofitcachelibRX2 + diff --git a/retrofitcachelibrx2/src/test/java/com/daoxuehao/android/retrofitcachelibrx2/ExampleUnitTest.java b/retrofitcachelibrx2/src/test/java/com/daoxuehao/android/retrofitcachelibrx2/ExampleUnitTest.java new file mode 100644 index 0000000..8a012eb --- /dev/null +++ b/retrofitcachelibrx2/src/test/java/com/daoxuehao/android/retrofitcachelibrx2/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.daoxuehao.android.retrofitcachelibrx2; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 55c3128..b2125f3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -include ':app', ':retrofitcachelibRX1' +include ':app', ':retrofitcachelib', ':retrofitcachelibrx2'