├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable │ │ │ │ ├── ic_toys_black_24dp.png │ │ │ │ ├── ic_error_outline_black_24dp.png │ │ │ │ └── photogrid_list_selector.xml │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ ├── activity_web_socket.xml │ │ │ │ └── image_grid_fragment.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── networking │ │ │ │ ├── model │ │ │ │ └── User.java │ │ │ │ ├── ApiEndPoint.java │ │ │ │ ├── ImageGridActivity.java │ │ │ │ ├── MyApplication.java │ │ │ │ └── utils │ │ │ │ └── Utils.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── androidnetworking │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── androidnetworking │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── rxsampleapp ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ └── layout │ │ │ │ └── activity_subscription.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── rxsampleapp │ │ │ │ ├── model │ │ │ │ ├── ApiUser.java │ │ │ │ ├── UserDetail.java │ │ │ │ └── User.java │ │ │ │ ├── ApiEndPoint.java │ │ │ │ ├── RxMyApplication.java │ │ │ │ ├── utils │ │ │ │ └── Utils.java │ │ │ │ └── SubscriptionActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── rxsampleapp │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── rxsampleapp │ │ └── ApplicationTest.java ├── proguard-rules.pro └── build.gradle ├── rx2sampleapp ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ └── layout │ │ │ │ └── activity_subscription.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── rx2sampleapp │ │ │ │ ├── model │ │ │ │ ├── ApiUser.java │ │ │ │ ├── UserDetail.java │ │ │ │ └── User.java │ │ │ │ ├── ApiEndPoint.java │ │ │ │ ├── Rx2MyApplication.java │ │ │ │ ├── utils │ │ │ │ └── Utils.java │ │ │ │ └── SubscriptionActivity.java │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── rx2sampleapp │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── rx2sampleapp │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── android-networking ├── .gitignore ├── src │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── androidnetworking │ │ │ │ ├── model │ │ │ │ ├── MultipartStringBody.java │ │ │ │ ├── MultipartFileBody.java │ │ │ │ └── Progress.java │ │ │ │ ├── common │ │ │ │ ├── RequestType.java │ │ │ │ ├── ResponseType.java │ │ │ │ ├── Method.java │ │ │ │ ├── ConnectionQuality.java │ │ │ │ ├── Priority.java │ │ │ │ ├── ANConstants.java │ │ │ │ ├── ANResponse.java │ │ │ │ └── RequestBuilder.java │ │ │ │ ├── interfaces │ │ │ │ ├── UploadProgressListener.java │ │ │ │ ├── DownloadProgressListener.java │ │ │ │ ├── AnalyticsListener.java │ │ │ │ ├── DownloadListener.java │ │ │ │ ├── StringRequestListener.java │ │ │ │ ├── ConnectionQualityChangeListener.java │ │ │ │ ├── BitmapRequestListener.java │ │ │ │ ├── JSONArrayRequestListener.java │ │ │ │ ├── JSONObjectRequestListener.java │ │ │ │ ├── ParsedRequestListener.java │ │ │ │ ├── OkHttpResponseListener.java │ │ │ │ ├── OkHttpResponseAndParsedRequestListener.java │ │ │ │ ├── OkHttpResponseAndStringRequestListener.java │ │ │ │ ├── OkHttpResponseAndBitmapRequestListener.java │ │ │ │ ├── OkHttpResponseAndJSONArrayRequestListener.java │ │ │ │ ├── OkHttpResponseAndJSONObjectRequestListener.java │ │ │ │ └── Parser.java │ │ │ │ ├── core │ │ │ │ ├── ExecutorSupplier.java │ │ │ │ ├── MainThreadExecutor.java │ │ │ │ ├── Core.java │ │ │ │ ├── PriorityThreadFactory.java │ │ │ │ └── DefaultExecutorSupplier.java │ │ │ │ ├── utils │ │ │ │ ├── SourceCloseUtil.java │ │ │ │ └── ParseUtil.java │ │ │ │ ├── cache │ │ │ │ └── LruBitmapCache.java │ │ │ │ ├── gsonparserfactory │ │ │ │ ├── GsonResponseBodyParser.java │ │ │ │ ├── GsonRequestBodyParser.java │ │ │ │ └── GsonParserFactory.java │ │ │ │ ├── internal │ │ │ │ ├── UploadProgressHandler.java │ │ │ │ ├── DownloadProgressHandler.java │ │ │ │ ├── RequestProgressBody.java │ │ │ │ └── ResponseProgressBody.java │ │ │ │ ├── interceptors │ │ │ │ └── GzipRequestInterceptor.java │ │ │ │ └── error │ │ │ │ └── ANError.java │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ └── AndroidManifest.xml │ ├── androidTest │ │ ├── java │ │ │ └── com │ │ │ │ └── androidnetworking │ │ │ │ └── model │ │ │ │ └── User.java │ │ └── AndroidManifest.xml │ └── test │ │ └── java │ │ └── com │ │ └── androidnetworking │ │ └── ExampleUnitTest.java ├── proguard-rules.pro ├── build.gradle └── upload.gradle ├── rx-android-networking ├── .gitignore ├── proguard-rules.pro ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── rxandroidnetworking │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── rxandroidnetworking │ │ └── ApplicationTest.java ├── build.gradle └── rx-upload.gradle ├── jackson-android-networking ├── .gitignore ├── proguard-rules.pro ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── jacksonandroidnetworking │ │ │ ├── JacksonResponseBodyParser.java │ │ │ └── JacksonRequestBodyParser.java │ ├── androidTest │ │ ├── java │ │ │ └── com │ │ │ │ └── jacksonandroidnetworking │ │ │ │ └── model │ │ │ │ └── User.java │ │ └── AndroidManifest.xml │ └── test │ │ └── java │ │ └── com │ │ └── jacksonandroidnetworking │ │ └── ExampleUnitTest.java └── build.gradle ├── rx2-android-networking ├── .gitignore ├── proguard-rules.pro ├── src │ ├── main │ │ ├── res │ │ │ └── values │ │ │ │ └── strings.xml │ │ └── AndroidManifest.xml │ ├── androidTest │ │ ├── java │ │ │ └── com │ │ │ │ └── rx2androidnetworking │ │ │ │ └── model │ │ │ │ └── User.java │ │ └── AndroidManifest.xml │ └── test │ │ └── java │ │ └── com │ │ └── rx2androidnetworking │ │ └── ExampleUnitTest.java └── build.gradle ├── assets ├── get_started.png ├── rxjavacomponent.png └── androidnetworking.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── CONTRIBUTING.md ├── settings.gradle ├── .travis.yml ├── gradle.properties ├── gradlew.bat └── CHANGELOG.md /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /rxsampleapp/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /rx2sampleapp/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /android-networking/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /rx-android-networking/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /jackson-android-networking/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /rx2-android-networking/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /assets/get_started.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/assets/get_started.png -------------------------------------------------------------------------------- /assets/rxjavacomponent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/assets/rxjavacomponent.png -------------------------------------------------------------------------------- /assets/androidnetworking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/assets/androidnetworking.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | /.idea 10 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_toys_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/app/src/main/res/drawable/ic_toys_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rx2sampleapp/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rx2sampleapp/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rx2sampleapp/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rxsampleapp/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rxsampleapp/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rxsampleapp/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rxsampleapp/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rx2sampleapp/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rx2sampleapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/rxsampleapp/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_error_outline_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wutongke/Fast-Android-Networking/master/app/src/main/res/drawable/ic_error_outline_black_24dp.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Apr 12 21:48:48 IST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | 1. Fork it! 4 | 2. Checkout the development branch: `git checkout development` 5 | 3. Create your feature branch: `git checkout -b my-new-feature` 6 | 4. Add your changes to the index: `git add .` 7 | 5. Commit your changes: `git commit -m 'Add some feature'` 8 | 6. Push to the branch: `git push origin my-new-feature` 9 | 7. Submit a pull request against the `development` branch 10 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/model/MultipartStringBody.java: -------------------------------------------------------------------------------- 1 | package com.androidnetworking.model; 2 | 3 | public class MultipartStringBody { 4 | 5 | public final String value; 6 | public final String contentType; 7 | 8 | public MultipartStringBody(String value, String contentType) { 9 | this.value = value; 10 | this.contentType = contentType; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/model/MultipartFileBody.java: -------------------------------------------------------------------------------- 1 | package com.androidnetworking.model; 2 | 3 | import java.io.File; 4 | 5 | public class MultipartFileBody { 6 | 7 | public final File file; 8 | public final String contentType; 9 | 10 | public MultipartFileBody(File file, String contentType) { 11 | this.file = file; 12 | this.contentType = contentType; 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/amitshekhar/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 | -------------------------------------------------------------------------------- /rx2sampleapp/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/amitshekhar/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 | -------------------------------------------------------------------------------- /rxsampleapp/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\Psych Inc\AppData\Local\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 | -------------------------------------------------------------------------------- /rx-android-networking/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/amitshekhar/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 | -------------------------------------------------------------------------------- /rx2-android-networking/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/amitshekhar/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 | -------------------------------------------------------------------------------- /jackson-android-networking/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/amitshekhar/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 | -------------------------------------------------------------------------------- /android-networking/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/amitshekhar/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 | # For OkHttp 20 | -dontwarn okio.** 21 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | AndroidNetworking 20 | 21 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | RxSampleApp 20 | 21 | -------------------------------------------------------------------------------- /android-networking/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | Android Networking 20 | 21 | -------------------------------------------------------------------------------- /rx-android-networking/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | rxandroidnetworking 20 | 21 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | include ':app', ':android-networking', ':rx-android-networking', ':rxsampleapp', ':jackson-android-networking', ':rx2-android-networking', ':rx2sampleapp' 19 | -------------------------------------------------------------------------------- /android-networking/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /rx-android-networking/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | Rx2SampleApp 22 | 23 | -------------------------------------------------------------------------------- /rx2-android-networking/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | Rx2AndroidNetworking 22 | 23 | -------------------------------------------------------------------------------- /jackson-android-networking/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | JacksonAndroidNetworking 22 | 23 | -------------------------------------------------------------------------------- /rx2-android-networking/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 22 | 23 | -------------------------------------------------------------------------------- /jackson-android-networking/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 22 | 23 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | #3F51B5 21 | #303F9F 22 | #FF4081 23 | 24 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/common/RequestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.common; 19 | 20 | /** 21 | * Created by amitshekhar on 04/04/16. 22 | */ 23 | public interface RequestType { 24 | int SIMPLE = 0; 25 | int DOWNLOAD = 1; 26 | int MULTIPART = 2; 27 | } 28 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/UploadProgressListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | /** 21 | * Created by amitshekhar on 21/04/16. 22 | */ 23 | public interface UploadProgressListener { 24 | void onProgress(long bytesUploaded, long totalBytes); 25 | } 26 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/DownloadProgressListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | /** 21 | * Created by amitshekhar on 30/03/16. 22 | */ 23 | public interface DownloadProgressListener { 24 | void onProgress(long bytesDownloaded, long totalBytes); 25 | } 26 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/java/com/rx2sampleapp/model/ApiUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rx2sampleapp.model; 21 | 22 | /** 23 | * Created by amitshekhar on 02/08/16. 24 | */ 25 | public class ApiUser { 26 | public long id; 27 | public String firstname; 28 | public String lastname; 29 | } 30 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/java/com/rxsampleapp/model/ApiUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rxsampleapp.model; 21 | 22 | /** 23 | * Created by amitshekhar on 02/08/16. 24 | */ 25 | public class ApiUser { 26 | public long id; 27 | public String firstname; 28 | public String lastname; 29 | } 30 | -------------------------------------------------------------------------------- /android-networking/src/androidTest/java/com/androidnetworking/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.model; 21 | 22 | /** 23 | * Created by amitshekhar on 10/04/17. 24 | */ 25 | 26 | public class User { 27 | 28 | public String firstName; 29 | public String lastName; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/common/ResponseType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.common; 19 | 20 | /** 21 | * Created by amitshekhar on 26/03/16. 22 | */ 23 | public enum ResponseType { 24 | STRING, 25 | JSON_OBJECT, 26 | JSON_ARRAY, 27 | OK_HTTP_RESPONSE, 28 | BITMAP, 29 | PREFETCH, 30 | PARSED 31 | } 32 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 20 | 21 | 22 | #3F51B5 23 | #303F9F 24 | #FF4081 25 | 26 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 16dp 23 | 16dp 24 | 25 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/java/com/rxsampleapp/model/UserDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rxsampleapp.model; 21 | 22 | /** 23 | * Created by amitshekhar on 02/08/16. 24 | */ 25 | public class UserDetail { 26 | 27 | public long id; 28 | public String firstname; 29 | public String lastname; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/AnalyticsListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | /** 21 | * Created by amitshekhar on 31/05/16. 22 | */ 23 | public interface AnalyticsListener { 24 | 25 | void onReceived(long timeTakenInMillis, long bytesSent, long bytesReceived, boolean isFromCache); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /rx2-android-networking/src/androidTest/java/com/rx2androidnetworking/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rx2androidnetworking.model; 21 | 22 | /** 23 | * Created by amitshekhar on 26/04/17. 24 | */ 25 | 26 | public class User { 27 | 28 | public String firstName; 29 | public String lastName; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/java/com/rx2sampleapp/model/UserDetail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rx2sampleapp.model; 21 | 22 | /** 23 | * Created by amitshekhar on 02/08/16. 24 | */ 25 | public class UserDetail { 26 | 27 | public long id; 28 | public String firstname; 29 | public String lastname; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/networking/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.networking.model; 21 | 22 | /** 23 | * Created by amitshekhar on 31/07/16. 24 | */ 25 | public class User { 26 | 27 | public long id; 28 | public String firstname; 29 | public String lastname; 30 | public boolean isFollowing; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/common/Method.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.common; 19 | 20 | /** 21 | * Created by amitshekhar on 26/03/16. 22 | */ 23 | public interface Method { 24 | int GET = 0; 25 | int POST = 1; 26 | int PUT = 2; 27 | int DELETE = 3; 28 | int HEAD = 4; 29 | int PATCH = 5; 30 | int OPTIONS = 6; 31 | } 32 | -------------------------------------------------------------------------------- /jackson-android-networking/src/androidTest/java/com/jacksonandroidnetworking/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.jacksonandroidnetworking.model; 21 | 22 | /** 23 | * Created by amitshekhar on 05/05/17. 24 | */ 25 | 26 | public class User { 27 | 28 | public String firstName; 29 | public String lastName; 30 | 31 | } 32 | -------------------------------------------------------------------------------- /android-networking/src/androidTest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/DownloadListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | import com.androidnetworking.error.ANError; 21 | 22 | /** 23 | * Created by amitshekhar on 29/04/16. 24 | */ 25 | public interface DownloadListener { 26 | 27 | void onDownloadComplete(); 28 | 29 | void onError(ANError anError); 30 | } 31 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | 3 | env: 4 | global: 5 | - ADB_INSTALL_TIMEOUT=30 6 | # Using the new Container-Based Infrastructure 7 | - sudo: false 8 | # Turning off caching to avoid caching Issues 9 | - cache: false 10 | # Initiating clean Gradle output 11 | - TERM=dumb 12 | # Giving even more memory to Gradle JVM 13 | - GRADLE_OPTS="-Xmx2048m -XX:MaxPermSize=1024m" 14 | 15 | android: 16 | components: 17 | - tools 18 | - platform-tools 19 | - build-tools-27.0.3 20 | - android-27 21 | - android-24 22 | - android-23 23 | - android-22 24 | - extra-google-google_play_services 25 | - extra-google-m2repository 26 | - extra-android-m2repository 27 | - sys-img-armeabi-v7a-android-22 28 | 29 | # Emulator Management: Create, Start and Wait 30 | before_script: 31 | - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a -c 32M 32 | - emulator -avd test -no-audio -no-window & 33 | - android-wait-for-emulator 34 | - sleep 180 35 | - adb devices 36 | - adb shell input keyevent 82 & 37 | 38 | script: 39 | - ./gradlew connectedAndroidTest 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 20 | #3F51B5 21 | #303F9F 22 | #FF4081 23 | #1Affffff 24 | #80000000 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 16dp 21 | 16dp 22 | 23 | 100dp 24 | 1dp 25 | 26 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 16dp 21 | 16dp 22 | 23 | 100dp 24 | 1dp 25 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/StringRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | import com.androidnetworking.error.ANError; 21 | 22 | /** 23 | * Created by amitshekhar on 23/05/16. 24 | */ 25 | public interface StringRequestListener { 26 | 27 | void onResponse(String response); 28 | 29 | void onError(ANError anError); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/core/ExecutorSupplier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.core; 19 | 20 | import java.util.concurrent.Executor; 21 | 22 | /** 23 | * Created by amitshekhar on 22/03/16. 24 | */ 25 | public interface ExecutorSupplier { 26 | 27 | ANExecutor forNetworkTasks(); 28 | 29 | ANExecutor forImmediateNetworkTasks(); 30 | 31 | Executor forMainThreadTasks(); 32 | } 33 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/ConnectionQualityChangeListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | import com.androidnetworking.common.ConnectionQuality; 21 | 22 | /** 23 | * Created by amitshekhar on 29/05/16. 24 | */ 25 | public interface ConnectionQualityChangeListener { 26 | 27 | void onChange(ConnectionQuality currentConnectionQuality, int currentBandwidth); 28 | } 29 | -------------------------------------------------------------------------------- /rxsampleapp/src/test/java/com/rxsampleapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.rxsampleapp; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.*; 23 | 24 | /** 25 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 26 | */ 27 | public class ExampleUnitTest { 28 | @Test 29 | public void addition_isCorrect() throws Exception { 30 | assertEquals(4, 2 + 2); 31 | } 32 | } -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 22 | 64dp 23 | 24 | -------------------------------------------------------------------------------- /app/src/test/java/com/androidnetworking/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.*; 23 | 24 | /** 25 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 26 | */ 27 | public class ExampleUnitTest { 28 | @Test 29 | public void addition_isCorrect() throws Exception { 30 | assertEquals(4, 2 + 2); 31 | } 32 | } -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/BitmapRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | import android.graphics.Bitmap; 21 | 22 | import com.androidnetworking.error.ANError; 23 | 24 | /** 25 | * Created by amitshekhar on 23/05/16. 26 | */ 27 | public interface BitmapRequestListener { 28 | 29 | void onResponse(Bitmap response); 30 | 31 | void onError(ANError anError); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/JSONArrayRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | import com.androidnetworking.error.ANError; 21 | 22 | import org.json.JSONArray; 23 | 24 | /** 25 | * Created by amitshekhar on 23/05/16. 26 | */ 27 | public interface JSONArrayRequestListener { 28 | 29 | void onResponse(JSONArray response); 30 | 31 | void onError(ANError anError); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /android-networking/src/test/java/com/androidnetworking/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.*; 23 | 24 | /** 25 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 26 | */ 27 | public class ExampleUnitTest { 28 | @Test 29 | public void addition_isCorrect() throws Exception { 30 | assertEquals(4, 2 + 2); 31 | } 32 | } -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/JSONObjectRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.interfaces; 19 | 20 | import com.androidnetworking.error.ANError; 21 | 22 | import org.json.JSONObject; 23 | 24 | /** 25 | * Created by amitshekhar on 23/05/16. 26 | */ 27 | public interface JSONObjectRequestListener { 28 | 29 | void onResponse(JSONObject response); 30 | 31 | void onError(ANError anError); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/ParsedRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import com.androidnetworking.error.ANError; 23 | 24 | /** 25 | * Created by amitshekhar on 31/07/16. 26 | */ 27 | public interface ParsedRequestListener { 28 | 29 | void onResponse(T response); 30 | 31 | void onError(ANError anError); 32 | 33 | } -------------------------------------------------------------------------------- /rx-android-networking/src/test/java/com/rxandroidnetworking/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.rxandroidnetworking; 19 | 20 | import org.junit.Test; 21 | 22 | import static org.junit.Assert.*; 23 | 24 | /** 25 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 26 | */ 27 | public class ExampleUnitTest { 28 | @Test 29 | public void addition_isCorrect() throws Exception { 30 | assertEquals(4, 2 + 2); 31 | } 32 | } -------------------------------------------------------------------------------- /rx2-android-networking/src/androidTest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /jackson-android-networking/src/androidTest/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /rxsampleapp/src/androidTest/java/com/rxsampleapp/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.rxsampleapp; 19 | 20 | import android.app.Application; 21 | import android.test.ApplicationTestCase; 22 | 23 | /** 24 | * Testing Fundamentals 25 | */ 26 | public class ApplicationTest extends ApplicationTestCase { 27 | public ApplicationTest() { 28 | super(Application.class); 29 | } 30 | } -------------------------------------------------------------------------------- /app/src/androidTest/java/com/androidnetworking/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking; 19 | 20 | import android.app.Application; 21 | import android.test.ApplicationTestCase; 22 | 23 | /** 24 | * Testing Fundamentals 25 | */ 26 | public class ApplicationTest extends ApplicationTestCase { 27 | public ApplicationTest() { 28 | super(Application.class); 29 | } 30 | } -------------------------------------------------------------------------------- /rxsampleapp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /rx-android-networking/src/androidTest/java/com/rxandroidnetworking/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.rxandroidnetworking; 19 | 20 | import android.app.Application; 21 | import android.test.ApplicationTestCase; 22 | 23 | /** 24 | * Testing Fundamentals 25 | */ 26 | public class ApplicationTest extends ApplicationTestCase { 27 | public ApplicationTest() { 28 | super(Application.class); 29 | } 30 | } -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/OkHttpResponseListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import com.androidnetworking.error.ANError; 23 | 24 | import okhttp3.Response; 25 | 26 | /** 27 | * Created by amitshekhar on 22/08/16. 28 | */ 29 | public interface OkHttpResponseListener { 30 | 31 | void onResponse(Response response); 32 | 33 | void onError(ANError anError); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 24 | 64dp 25 | 26 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/model/Progress.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.model; 19 | 20 | import java.io.Serializable; 21 | 22 | /** 23 | * Created by amitshekhar on 24/05/16. 24 | */ 25 | 26 | public class Progress implements Serializable { 27 | 28 | public long currentBytes; 29 | public long totalBytes; 30 | 31 | public Progress(long currentBytes, long totalBytes) { 32 | this.currentBytes = currentBytes; 33 | this.totalBytes = totalBytes; 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /jackson-android-networking/src/test/java/com/jacksonandroidnetworking/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.jacksonandroidnetworking; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.junit.Assert.*; 25 | 26 | /** 27 | * To work on unit tests, switch the Test Artifact in the Build Variants view. 28 | */ 29 | public class ExampleUnitTest { 30 | @Test 31 | public void addition_isCorrect() throws Exception { 32 | assertEquals(4, 2 + 2); 33 | } 34 | } -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/OkHttpResponseAndParsedRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import com.androidnetworking.error.ANError; 23 | 24 | import okhttp3.Response; 25 | 26 | /** 27 | * Created by amitshekhar on 31/07/16. 28 | */ 29 | public interface OkHttpResponseAndParsedRequestListener { 30 | 31 | void onResponse(Response okHttpResponse, T response); 32 | 33 | void onError(ANError anError); 34 | 35 | } -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/java/com/rxsampleapp/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rxsampleapp.model; 21 | 22 | /** 23 | * Created by amitshekhar on 31/07/16. 24 | */ 25 | public class User { 26 | public long id; 27 | public String firstname; 28 | public String lastname; 29 | public boolean isFollowing; 30 | 31 | public User(ApiUser apiUser) { 32 | this.id = apiUser.id; 33 | this.firstname = apiUser.firstname; 34 | this.lastname = apiUser.lastname; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/OkHttpResponseAndStringRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import com.androidnetworking.error.ANError; 23 | 24 | import okhttp3.Response; 25 | 26 | /** 27 | * Created by amitshekhar on 23/05/16. 28 | */ 29 | public interface OkHttpResponseAndStringRequestListener { 30 | 31 | void onResponse(Response okHttpResponse, String response); 32 | 33 | void onError(ANError anError); 34 | 35 | } 36 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/java/com/rx2sampleapp/model/User.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rx2sampleapp.model; 21 | 22 | /** 23 | * Created by amitshekhar on 31/07/16. 24 | */ 25 | public class User { 26 | public long id; 27 | public String firstname; 28 | public String lastname; 29 | public boolean isFollowing; 30 | 31 | public User(ApiUser apiUser) { 32 | this.id = apiUser.id; 33 | this.firstname = apiUser.firstname; 34 | this.lastname = apiUser.lastname; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/core/MainThreadExecutor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.core; 19 | 20 | import android.os.Handler; 21 | import android.os.Looper; 22 | 23 | import java.util.concurrent.Executor; 24 | 25 | /** 26 | * Created by amitshekhar on 22/03/16. 27 | */ 28 | public class MainThreadExecutor implements Executor { 29 | 30 | private final Handler handler = new Handler(Looper.getMainLooper()); 31 | 32 | @Override 33 | public void execute(Runnable runnable) { 34 | handler.post(runnable); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_web_socket.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 23 | 24 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /rx2sampleapp/src/test/java/com/rx2sampleapp/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rx2sampleapp; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.junit.Assert.*; 25 | 26 | /** 27 | * Example local unit test, which will execute on the development machine (host). 28 | * 29 | * @see Testing documentation 30 | */ 31 | public class ExampleUnitTest { 32 | @Test 33 | public void addition_isCorrect() throws Exception { 34 | assertEquals(4, 2 + 2); 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/photogrid_list_selector.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/OkHttpResponseAndBitmapRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import android.graphics.Bitmap; 23 | 24 | import com.androidnetworking.error.ANError; 25 | 26 | import okhttp3.Response; 27 | 28 | /** 29 | * Created by amitshekhar on 23/05/16. 30 | */ 31 | public interface OkHttpResponseAndBitmapRequestListener { 32 | 33 | void onResponse(Response okHttpResponse, Bitmap response); 34 | 35 | void onError(ANError anError); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/OkHttpResponseAndJSONArrayRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import com.androidnetworking.error.ANError; 23 | 24 | import org.json.JSONArray; 25 | 26 | import okhttp3.Response; 27 | 28 | /** 29 | * Created by amitshekhar on 23/05/16. 30 | */ 31 | public interface OkHttpResponseAndJSONArrayRequestListener { 32 | 33 | void onResponse(Response okHttpResponse, JSONArray response); 34 | 35 | void onError(ANError anError); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/OkHttpResponseAndJSONObjectRequestListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import com.androidnetworking.error.ANError; 23 | 24 | import org.json.JSONObject; 25 | 26 | import okhttp3.Response; 27 | 28 | /** 29 | * Created by amitshekhar on 23/05/16. 30 | */ 31 | public interface OkHttpResponseAndJSONObjectRequestListener { 32 | 33 | void onResponse(Response okHttpResponse, JSONObject response); 34 | 35 | void onError(ANError anError); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /rx2-android-networking/src/test/java/com/rx2androidnetworking/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rx2androidnetworking; 21 | 22 | import org.junit.Test; 23 | 24 | import static org.junit.Assert.*; 25 | 26 | /** 27 | * Example local unit test, which will execute on the development machine (host). 28 | * 29 | * @see Testing documentation 30 | */ 31 | public class ExampleUnitTest { 32 | @Test 33 | public void addition_isCorrect() throws Exception { 34 | assertEquals(4, 2 + 2); 35 | } 36 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/image_grid_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/networking/ApiEndPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.networking; 19 | 20 | /** 21 | * Created by amitshekhar on 29/03/16. 22 | */ 23 | public class ApiEndPoint { 24 | 25 | public static final String BASE_URL = "https://fierce-cove-29863.herokuapp.com"; 26 | public static final String GET_JSON_ARRAY = "/getAllUsers/{pageNumber}"; 27 | public static final String GET_JSON_OBJECT = "/getAnUserDetail/{userId}"; 28 | public static final String CHECK_FOR_HEADER = "/checkForHeader"; 29 | public static final String POST_CREATE_AN_USER = "/createAnUser"; 30 | public static final String UPLOAD_IMAGE = "/uploadImage"; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/java/com/rxsampleapp/ApiEndPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.rxsampleapp; 19 | 20 | /** 21 | * Created by amitshekhar on 29/03/16. 22 | */ 23 | public class ApiEndPoint { 24 | 25 | public static final String BASE_URL = "https://fierce-cove-29863.herokuapp.com"; 26 | public static final String GET_JSON_ARRAY = "/getAllUsers/{pageNumber}"; 27 | public static final String GET_JSON_OBJECT = "/getAnUserDetail/{userId}"; 28 | public static final String CHECK_FOR_HEADER = "/checkForHeader"; 29 | public static final String POST_CREATE_AN_USER = "/createAnUser"; 30 | public static final String UPLOAD_IMAGE = "/uploadImage"; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/java/com/rx2sampleapp/ApiEndPoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.rx2sampleapp; 19 | 20 | /** 21 | * Created by amitshekhar on 29/03/16. 22 | */ 23 | public class ApiEndPoint { 24 | 25 | public static final String BASE_URL = "https://fierce-cove-29863.herokuapp.com"; 26 | public static final String GET_JSON_ARRAY = "/getAllUsers/{pageNumber}"; 27 | public static final String GET_JSON_OBJECT = "/getAnUserDetail/{userId}"; 28 | public static final String CHECK_FOR_HEADER = "/checkForHeader"; 29 | public static final String POST_CREATE_AN_USER = "/createAnUser"; 30 | public static final String UPLOAD_IMAGE = "/uploadImage"; 31 | 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 19 | 20 | 21 | 27 | 28 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/common/ConnectionQuality.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.common; 19 | 20 | /** 21 | * Created by amitshekhar on 29/05/16. 22 | */ 23 | public enum ConnectionQuality { 24 | /** 25 | * Bandwidth under 150 kbps. 26 | */ 27 | POOR, 28 | /** 29 | * Bandwidth between 150 and 550 kbps. 30 | */ 31 | MODERATE, 32 | /** 33 | * Bandwidth between 550 and 2000 kbps. 34 | */ 35 | GOOD, 36 | /** 37 | * EXCELLENT - Bandwidth over 2000 kbps. 38 | */ 39 | EXCELLENT, 40 | /** 41 | * Placeholder for unknown bandwidth. This is the initial value and will stay at this value 42 | * if a bandwidth cannot be accurately found. 43 | */ 44 | UNKNOWN 45 | } 46 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2016 Amit Shekhar 3 | # Copyright (C) 2011 Android Open Source Project 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | # Project-wide Gradle settings. 19 | 20 | # IDE (e.g. Android Studio) users: 21 | # Gradle settings configured through the IDE *will override* 22 | # any settings specified in this file. 23 | 24 | # For more details on how to configure your build environment visit 25 | # http://www.gradle.org/docs/current/userguide/build_environment.html 26 | 27 | # Specifies the JVM arguments used for the daemon process. 28 | # The setting is particularly useful for tweaking memory settings. 29 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 30 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 31 | 32 | # When configured, Gradle will run in incubating parallel mode. 33 | # This option should only be used with decoupled projects. More details, visit 34 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 35 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/java/com/networking/ImageGridActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.networking; 19 | 20 | import android.os.Bundle; 21 | import android.support.v4.app.FragmentActivity; 22 | import android.support.v4.app.FragmentTransaction; 23 | 24 | import com.networking.fragments.ImageGridFragment; 25 | 26 | /** 27 | * Created by amitshekhar on 23/03/16. 28 | */ 29 | public class ImageGridActivity extends FragmentActivity { 30 | private static final String TAG = "ImageGridActivity"; 31 | 32 | @Override 33 | protected void onCreate(Bundle savedInstanceState) { 34 | super.onCreate(savedInstanceState); 35 | 36 | if (getSupportFragmentManager().findFragmentByTag(TAG) == null) { 37 | final FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); 38 | ft.add(android.R.id.content, new ImageGridFragment(), TAG); 39 | ft.commit(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/utils/SourceCloseUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.utils; 21 | 22 | import com.androidnetworking.common.ANRequest; 23 | import com.androidnetworking.common.ResponseType; 24 | 25 | import okhttp3.Response; 26 | 27 | /** 28 | * Created by amitshekhar on 15/09/16. 29 | */ 30 | public final class SourceCloseUtil { 31 | 32 | private SourceCloseUtil() { 33 | } 34 | 35 | public static void close(Response response, ANRequest request) { 36 | if (request.getResponseAs() != ResponseType.OK_HTTP_RESPONSE && 37 | response != null && response.body() != null && 38 | response.body().source() != null) { 39 | try { 40 | response.body().source().close(); 41 | } catch (Exception ignore) { 42 | 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /jackson-android-networking/src/main/java/com/jacksonandroidnetworking/JacksonResponseBodyParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.jacksonandroidnetworking; 21 | 22 | import com.androidnetworking.interfaces.Parser; 23 | import com.fasterxml.jackson.databind.ObjectReader; 24 | 25 | import java.io.IOException; 26 | 27 | import okhttp3.ResponseBody; 28 | 29 | /** 30 | * Created by amitshekhar on 15/09/16. 31 | */ 32 | final class JacksonResponseBodyParser implements Parser { 33 | 34 | private final ObjectReader adapter; 35 | 36 | JacksonResponseBodyParser(ObjectReader adapter) { 37 | this.adapter = adapter; 38 | } 39 | 40 | @Override 41 | public T convert(ResponseBody value) throws IOException { 42 | try { 43 | return adapter.readValue(value.charStream()); 44 | } finally { 45 | value.close(); 46 | } 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/utils/ParseUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.utils; 21 | 22 | import com.androidnetworking.gsonparserfactory.GsonParserFactory; 23 | import com.androidnetworking.interfaces.Parser; 24 | import com.google.gson.Gson; 25 | 26 | /** 27 | * Created by amitshekhar on 15/09/16. 28 | */ 29 | public class ParseUtil { 30 | 31 | private static Parser.Factory mParserFactory; 32 | 33 | public static void setParserFactory(Parser.Factory parserFactory) { 34 | mParserFactory = parserFactory; 35 | } 36 | 37 | public static Parser.Factory getParserFactory() { 38 | if (mParserFactory == null) { 39 | mParserFactory = new GsonParserFactory(new Gson()); 40 | } 41 | return mParserFactory; 42 | } 43 | 44 | public static void shutDown() { 45 | mParserFactory = null; 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | apply plugin: 'com.android.application' 19 | 20 | android { 21 | compileSdkVersion rootProject.ext.compileSdkVersion 22 | buildToolsVersion rootProject.ext.buildToolsVersion 23 | 24 | defaultConfig { 25 | applicationId "com.networking" 26 | minSdkVersion rootProject.ext.minSdkVersion 27 | targetSdkVersion rootProject.ext.targetSdkVersion 28 | versionCode 1 29 | versionName "1.0" 30 | } 31 | buildTypes { 32 | release { 33 | minifyEnabled false 34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 35 | } 36 | } 37 | } 38 | 39 | dependencies { 40 | compile fileTree(dir: 'libs', include: ['*.jar']) 41 | testCompile "junit:junit:$rootProject.ext.jUnitVersion" 42 | compile "com.android.support:appcompat-v7:$rootProject.ext.supportAppCompatVersion" 43 | compile project(':android-networking') 44 | } 45 | -------------------------------------------------------------------------------- /rxsampleapp/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | apply plugin: 'com.android.application' 19 | 20 | android { 21 | compileSdkVersion rootProject.ext.compileSdkVersion 22 | buildToolsVersion rootProject.ext.buildToolsVersion 23 | 24 | defaultConfig { 25 | applicationId "com.rxsampleapp" 26 | minSdkVersion rootProject.ext.minSdkVersion 27 | targetSdkVersion rootProject.ext.targetSdkVersion 28 | versionCode 1 29 | versionName "1.0" 30 | } 31 | buildTypes { 32 | release { 33 | minifyEnabled false 34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 35 | } 36 | } 37 | } 38 | 39 | dependencies { 40 | compile fileTree(dir: 'libs', include: ['*.jar']) 41 | testCompile "junit:junit:$rootProject.ext.jUnitVersion" 42 | compile "com.android.support:appcompat-v7:$rootProject.ext.supportAppCompatVersion" 43 | compile project(':rx-android-networking') 44 | } 45 | -------------------------------------------------------------------------------- /rx2sampleapp/src/androidTest/java/com/rx2sampleapp/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.rx2sampleapp; 21 | 22 | import android.content.Context; 23 | import android.support.test.InstrumentationRegistry; 24 | import android.support.test.runner.AndroidJUnit4; 25 | 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | 29 | import static org.junit.Assert.*; 30 | 31 | /** 32 | * Instrumentation test, which will execute on an Android device. 33 | * 34 | * @see Testing documentation 35 | */ 36 | @RunWith(AndroidJUnit4.class) 37 | public class ExampleInstrumentedTest { 38 | @Test 39 | public void useAppContext() throws Exception { 40 | // Context of the app under test. 41 | Context appContext = InstrumentationRegistry.getTargetContext(); 42 | 43 | assertEquals("com.rx2sampleapp", appContext.getPackageName()); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/common/Priority.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.common; 19 | 20 | /** 21 | * Created by amitshekhar on 22/03/16. 22 | */ 23 | 24 | 25 | /** 26 | * Priority levels recognized by the request server. 27 | */ 28 | public enum Priority { 29 | /** 30 | * NOTE: DO NOT CHANGE ORDERING OF THOSE CONSTANTS UNDER ANY CIRCUMSTANCES. 31 | * Doing so will make ordering incorrect. 32 | */ 33 | 34 | /** 35 | * Lowest priority level. Used for prefetches of data. 36 | */ 37 | LOW, 38 | 39 | /** 40 | * Medium priority level. Used for warming of data that might soon get visible. 41 | */ 42 | MEDIUM, 43 | 44 | /** 45 | * Highest priority level. Used for data that are currently visible on screen. 46 | */ 47 | HIGH, 48 | 49 | /** 50 | * Highest priority level. Used for data that are required instantly(mainly for emergency). 51 | */ 52 | IMMEDIATE 53 | 54 | } 55 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/core/Core.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.core; 19 | 20 | /** 21 | * Created by amitshekhar on 22/03/16. 22 | */ 23 | public class Core { 24 | 25 | private static Core sInstance = null; 26 | private final ExecutorSupplier mExecutorSupplier; 27 | 28 | private Core() { 29 | this.mExecutorSupplier = new DefaultExecutorSupplier(); 30 | } 31 | 32 | public static Core getInstance() { 33 | if (sInstance == null) { 34 | synchronized (Core.class) { 35 | if (sInstance == null) { 36 | sInstance = new Core(); 37 | } 38 | } 39 | } 40 | return sInstance; 41 | } 42 | 43 | public ExecutorSupplier getExecutorSupplier() { 44 | return mExecutorSupplier; 45 | } 46 | 47 | public static void shutDown() { 48 | if (sInstance != null) { 49 | sInstance = null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /rx-android-networking/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | apply plugin: 'com.android.library' 19 | 20 | android { 21 | compileSdkVersion rootProject.ext.compileSdkVersion 22 | buildToolsVersion rootProject.ext.buildToolsVersion 23 | 24 | defaultConfig { 25 | minSdkVersion rootProject.ext.minSdkVersion 26 | targetSdkVersion rootProject.ext.targetSdkVersion 27 | versionCode 1 28 | versionName "1.0" 29 | } 30 | buildTypes { 31 | release { 32 | minifyEnabled false 33 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 34 | } 35 | } 36 | } 37 | 38 | dependencies { 39 | compile fileTree(dir: 'libs', include: ['*.jar']) 40 | testCompile "junit:junit:$rootProject.ext.jUnitVersion" 41 | compile "io.reactivex:rxandroid:$rootProject.ext.rxJavaAndroidVersion" 42 | compile "io.reactivex:rxjava:$rootProject.ext.rxJavaVersion" 43 | compile project(':android-networking') 44 | } 45 | //apply from: 'rx-upload.gradle' 46 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/common/ANConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.common; 19 | 20 | /** 21 | * Created by amitshekhar on 29/03/16. 22 | */ 23 | public final class ANConstants { 24 | public static final int MAX_CACHE_SIZE = 10 * 1024 * 1024; 25 | public static final int UPDATE = 0x01; 26 | public static final String CACHE_DIR_NAME = "cache_an"; 27 | public static final String CONNECTION_ERROR = "connectionError"; 28 | public static final String RESPONSE_FROM_SERVER_ERROR = "responseFromServerError"; 29 | public static final String REQUEST_CANCELLED_ERROR = "requestCancelledError"; 30 | public static final String PARSE_ERROR = "parseError"; 31 | public static final String PREFETCH = "prefetch"; 32 | public static final String FAST_ANDROID_NETWORKING = "FastAndroidNetworking"; 33 | public static final String USER_AGENT = "User-Agent"; 34 | public static final String SUCCESS = "success"; 35 | public static final String OPTIONS = "OPTIONS"; 36 | } 37 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/core/PriorityThreadFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.core; 19 | 20 | /** 21 | * Created by amitshekhar on 22/03/16. 22 | */ 23 | 24 | 25 | import android.os.Process; 26 | 27 | import java.util.concurrent.ThreadFactory; 28 | 29 | public class PriorityThreadFactory implements ThreadFactory { 30 | 31 | private final int mThreadPriority; 32 | 33 | public PriorityThreadFactory(int threadPriority) { 34 | mThreadPriority = threadPriority; 35 | } 36 | 37 | @Override 38 | public Thread newThread(final Runnable runnable) { 39 | Runnable wrapperRunnable = new Runnable() { 40 | @Override 41 | public void run() { 42 | try { 43 | Process.setThreadPriority(mThreadPriority); 44 | } catch (Throwable t) { 45 | 46 | } 47 | runnable.run(); 48 | } 49 | }; 50 | return new Thread(wrapperRunnable); 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /jackson-android-networking/src/main/java/com/jacksonandroidnetworking/JacksonRequestBodyParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.jacksonandroidnetworking; 21 | 22 | import com.androidnetworking.interfaces.Parser; 23 | import com.fasterxml.jackson.databind.ObjectWriter; 24 | 25 | import java.io.IOException; 26 | 27 | import okhttp3.MediaType; 28 | import okhttp3.RequestBody; 29 | 30 | /** 31 | * Created by amitshekhar on 15/09/16. 32 | */ 33 | final class JacksonRequestBodyParser implements Parser { 34 | 35 | private static final MediaType MEDIA_TYPE = MediaType.parse("application/json; charset=UTF-8"); 36 | 37 | private final ObjectWriter adapter; 38 | 39 | JacksonRequestBodyParser(ObjectWriter adapter) { 40 | this.adapter = adapter; 41 | } 42 | 43 | @Override 44 | public RequestBody convert(T value) throws IOException { 45 | byte[] bytes = adapter.writeValueAsBytes(value); 46 | return RequestBody.create(MEDIA_TYPE, bytes); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/cache/LruBitmapCache.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.androidnetworking.cache; 19 | 20 | import android.graphics.Bitmap; 21 | 22 | import com.androidnetworking.internal.ANImageLoader; 23 | 24 | /** 25 | * Created by amitshekhar on 24/03/16. 26 | */ 27 | public class LruBitmapCache extends LruCache 28 | implements ANImageLoader.ImageCache { 29 | 30 | public LruBitmapCache(int maxSize) { 31 | super(maxSize); 32 | } 33 | 34 | @Override 35 | protected int sizeOf(String key, Bitmap value) { 36 | return value.getRowBytes() * value.getHeight(); 37 | } 38 | 39 | @Override 40 | public Bitmap getBitmap(String key) { 41 | return get(key); 42 | } 43 | 44 | @Override 45 | public void evictBitmap(String key) { 46 | remove(key); 47 | } 48 | 49 | @Override 50 | public void evictAllBitmap() { 51 | evictAll(); 52 | } 53 | 54 | @Override 55 | public void putBitmap(String url, Bitmap bitmap) { 56 | put(url, bitmap); 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/gsonparserfactory/GsonResponseBodyParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.gsonparserfactory; 21 | 22 | import com.androidnetworking.interfaces.Parser; 23 | import com.google.gson.Gson; 24 | import com.google.gson.TypeAdapter; 25 | import com.google.gson.stream.JsonReader; 26 | 27 | import java.io.IOException; 28 | 29 | import okhttp3.ResponseBody; 30 | 31 | /** 32 | * Created by amitshekhar on 31/07/16. 33 | */ 34 | final class GsonResponseBodyParser implements Parser { 35 | private final Gson gson; 36 | private final TypeAdapter adapter; 37 | 38 | GsonResponseBodyParser(Gson gson, TypeAdapter adapter) { 39 | this.gson = gson; 40 | this.adapter = adapter; 41 | } 42 | 43 | @Override 44 | public T convert(ResponseBody value) throws IOException { 45 | JsonReader jsonReader = gson.newJsonReader(value.charStream()); 46 | try { 47 | return adapter.read(jsonReader); 48 | } finally { 49 | value.close(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /android-networking/src/main/java/com/androidnetworking/interfaces/Parser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | package com.androidnetworking.interfaces; 21 | 22 | import java.io.IOException; 23 | import java.lang.reflect.Type; 24 | import java.util.HashMap; 25 | 26 | import okhttp3.RequestBody; 27 | import okhttp3.ResponseBody; 28 | 29 | /** 30 | * Created by amitshekhar on 31/07/16. 31 | */ 32 | public interface Parser { 33 | 34 | T convert(F value) throws IOException; 35 | 36 | abstract class Factory { 37 | 38 | public Parser responseBodyParser(Type type) { 39 | return null; 40 | } 41 | 42 | public Parser requestBodyParser(Type type) { 43 | return null; 44 | } 45 | 46 | public Object getObject(String string, Type type) { 47 | return null; 48 | } 49 | 50 | public String getString(Object object) { 51 | return null; 52 | } 53 | 54 | public HashMap getStringMap(Object object) { 55 | return null; 56 | } 57 | 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /rx2-android-networking/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | apply plugin: 'com.android.library' 21 | 22 | android { 23 | compileSdkVersion rootProject.ext.compileSdkVersion 24 | buildToolsVersion rootProject.ext.buildToolsVersion 25 | 26 | defaultConfig { 27 | minSdkVersion rootProject.ext.minSdkVersion 28 | targetSdkVersion rootProject.ext.targetSdkVersion 29 | versionCode 1 30 | versionName "1.0" 31 | } 32 | buildTypes { 33 | release { 34 | minifyEnabled false 35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 36 | } 37 | } 38 | } 39 | 40 | dependencies { 41 | compile fileTree(dir: 'libs', include: ['*.jar']) 42 | testCompile "junit:junit:$rootProject.ext.jUnitVersion" 43 | androidTestCompile "com.squareup.okhttp3:mockwebserver:$rootProject.ext.mockWebServerVersion" 44 | compile "io.reactivex.rxjava2:rxandroid:$rootProject.ext.rxJava2AndroidVersion" 45 | compile "io.reactivex.rxjava2:rxjava:$rootProject.ext.rxJava2Version" 46 | compile project(':android-networking') 47 | } 48 | //apply from: 'rx2-upload.gradle' 49 | -------------------------------------------------------------------------------- /rx2sampleapp/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 22 | 23 | 24 | 25 | 26 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 21 | 22 | 23 | 24 | 25 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /android-networking/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | apply plugin: 'com.android.library' 19 | 20 | android { 21 | compileSdkVersion rootProject.ext.compileSdkVersion 22 | buildToolsVersion rootProject.ext.buildToolsVersion 23 | 24 | defaultConfig { 25 | minSdkVersion rootProject.ext.minSdkVersion 26 | targetSdkVersion rootProject.ext.targetSdkVersion 27 | versionCode 1 28 | versionName "1.0" 29 | consumerProguardFiles 'proguard-rules.pro' 30 | } 31 | buildTypes { 32 | release { 33 | minifyEnabled false 34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 35 | } 36 | } 37 | lintOptions { 38 | abortOnError false 39 | } 40 | } 41 | 42 | dependencies { 43 | compile fileTree(dir: 'libs', include: ['*.jar']) 44 | testCompile "junit:junit:$rootProject.ext.jUnitVersion" 45 | androidTestCompile "com.squareup.okhttp3:mockwebserver:$rootProject.ext.mockWebServerVersion" 46 | compile "com.squareup.okhttp3:okhttp:$rootProject.ext.okHttp3Version" 47 | compile "com.google.code.gson:gson:$rootProject.ext.gsonVersion" 48 | compile "com.android.support:appcompat-v7:$rootProject.ext.supportAppCompatVersion" 49 | } 50 | //apply from: 'upload.gradle' 51 | -------------------------------------------------------------------------------- /rx2sampleapp/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * * Copyright (C) 2016 Amit Shekhar 4 | * * Copyright (C) 2011 Android Open Source Project 5 | * * 6 | * * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * * you may not use this file except in compliance with the License. 8 | * * You may obtain a copy of the License at 9 | * * 10 | * * http://www.apache.org/licenses/LICENSE-2.0 11 | * * 12 | * * Unless required by applicable law or agreed to in writing, software 13 | * * distributed under the License is distributed on an "AS IS" BASIS, 14 | * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * * See the License for the specific language governing permissions and 16 | * * limitations under the License. 17 | * 18 | */ 19 | 20 | apply plugin: 'com.android.application' 21 | 22 | android { 23 | compileSdkVersion rootProject.ext.compileSdkVersion 24 | buildToolsVersion rootProject.ext.buildToolsVersion 25 | 26 | defaultConfig { 27 | applicationId "com.rx2sampleapp" 28 | minSdkVersion rootProject.ext.minSdkVersion 29 | targetSdkVersion rootProject.ext.targetSdkVersion 30 | versionCode 1 31 | versionName "1.0" 32 | 33 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 34 | 35 | } 36 | buildTypes { 37 | release { 38 | minifyEnabled false 39 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 40 | } 41 | } 42 | } 43 | 44 | dependencies { 45 | compile fileTree(dir: 'libs', include: ['*.jar']) 46 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 47 | exclude group: 'com.android.support', module: 'support-annotations' 48 | }) 49 | compile "com.android.support:appcompat-v7:$rootProject.ext.supportAppCompatVersion" 50 | testCompile "junit:junit:$rootProject.ext.jUnitVersion" 51 | compile project(':rx2-android-networking') 52 | } 53 | -------------------------------------------------------------------------------- /rxsampleapp/src/main/java/com/rxsampleapp/RxMyApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.rxsampleapp; 18 | 19 | import android.app.Application; 20 | import android.util.Log; 21 | 22 | import com.androidnetworking.AndroidNetworking; 23 | import com.androidnetworking.common.ConnectionQuality; 24 | import com.androidnetworking.interfaces.ConnectionQualityChangeListener; 25 | 26 | public class RxMyApplication extends Application { 27 | 28 | private static final String TAG = RxMyApplication.class.getSimpleName(); 29 | private static RxMyApplication appInstance = null; 30 | 31 | public static RxMyApplication getInstance() { 32 | return appInstance; 33 | } 34 | 35 | @Override 36 | public void onCreate() { 37 | super.onCreate(); 38 | appInstance = this; 39 | AndroidNetworking.initialize(getApplicationContext()); 40 | AndroidNetworking.enableLogging(); 41 | AndroidNetworking.setConnectionQualityChangeListener(new ConnectionQualityChangeListener() { 42 | @Override 43 | public void onChange(ConnectionQuality currentConnectionQuality, int currentBandwidth) { 44 | Log.d(TAG, "onChange: currentConnectionQuality : " + currentConnectionQuality + " currentBandwidth : " + currentBandwidth); 45 | } 46 | }); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /rx2sampleapp/src/main/java/com/rx2sampleapp/Rx2MyApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 Amit Shekhar 3 | * Copyright (C) 2011 Android Open Source Project 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.rx2sampleapp; 18 | 19 | import android.app.Application; 20 | import android.util.Log; 21 | 22 | import com.androidnetworking.AndroidNetworking; 23 | import com.androidnetworking.common.ConnectionQuality; 24 | import com.androidnetworking.interfaces.ConnectionQualityChangeListener; 25 | 26 | public class Rx2MyApplication extends Application { 27 | 28 | private static final String TAG = Rx2MyApplication.class.getSimpleName(); 29 | private static Rx2MyApplication appInstance = null; 30 | 31 | public static Rx2MyApplication getInstance() { 32 | return appInstance; 33 | } 34 | 35 | @Override 36 | public void onCreate() { 37 | super.onCreate(); 38 | appInstance = this; 39 | AndroidNetworking.initialize(getApplicationContext()); 40 | AndroidNetworking.enableLogging(); 41 | AndroidNetworking.setConnectionQualityChangeListener(new ConnectionQualityChangeListener() { 42 | @Override 43 | public void onChange(ConnectionQuality currentConnectionQuality, int currentBandwidth) { 44 | Log.d(TAG, "onChange: currentConnectionQuality : " + currentConnectionQuality + " currentBandwidth : " + currentBandwidth); 45 | } 46 | }); 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /rx2sampleapp/src/main/res/layout/activity_subscription.xml: -------------------------------------------------------------------------------- 1 | 19 | 20 | 23 | 24 | 32 | 33 | 37 | 38 |