From a0c30859a3c1b6ae321402a638fae9c4ea0c40c9 Mon Sep 17 00:00:00 2001 From: paveltech Date: Fri, 21 Dec 2018 22:24:20 +0600 Subject: [PATCH] library version downgrade --- .../java/com/pavel/responsecode/MainActivity.java | 4 +++- responsecode/build.gradle | 8 +++----- .../com/pavel/response/code/HttpResponseCode.java | 12 ------------ 3 files changed, 6 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/com/pavel/responsecode/MainActivity.java b/app/src/main/java/com/pavel/responsecode/MainActivity.java index 7dbfc6f..3264772 100644 --- a/app/src/main/java/com/pavel/responsecode/MainActivity.java +++ b/app/src/main/java/com/pavel/responsecode/MainActivity.java @@ -31,12 +31,14 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void onClick(View view) { - if (!httpResponseCode.checkResponse(530)){ + if (!httpResponseCode.checkResponse(201)){ + /** * * do what ever you want if status code is not 200 then automaticaly status will show through a toast * */ + } } }); diff --git a/responsecode/build.gradle b/responsecode/build.gradle index 30507c2..7bb775b 100644 --- a/responsecode/build.gradle +++ b/responsecode/build.gradle @@ -1,13 +1,11 @@ apply plugin: 'com.android.library' android { - compileSdkVersion 28 - - + compileSdkVersion 26 defaultConfig { minSdkVersion 16 - targetSdkVersion 28 + targetSdkVersion 26 versionCode 1 versionName "1.0" @@ -35,7 +33,7 @@ android { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'com.android.support:appcompat-v7:28.0.0' + implementation 'com.android.support:appcompat-v7:26.0.2' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' diff --git a/responsecode/src/main/java/com/pavel/response/code/HttpResponseCode.java b/responsecode/src/main/java/com/pavel/response/code/HttpResponseCode.java index c8189b5..dda71f8 100644 --- a/responsecode/src/main/java/com/pavel/response/code/HttpResponseCode.java +++ b/responsecode/src/main/java/com/pavel/response/code/HttpResponseCode.java @@ -11,7 +11,6 @@ public class HttpResponseCode { public boolean isShowStatus; public HttpResponseCode(){ - } public HttpResponseCode(Context context , boolean isShowStatus){ @@ -21,14 +20,11 @@ public HttpResponseCode(Context context , boolean isShowStatus){ public boolean checkResponse(int responseCode){ - boolean returnResponse = false; - if (responseCode == 200){ returnResponse = true; } - else if(responseCode == 100 ){ returnResponse = false; showStatus("Server continue working"); @@ -49,44 +45,36 @@ else if(responseCode == 201 ){ showStatus("Server resources are created"); } - else if(responseCode == 202 ){ returnResponse = false; showStatus("Server request accepted"); } - - else if(responseCode == 203 ){ returnResponse = false; showStatus("Server Non-Authoritative Information "); } - else if(responseCode == 204 ){ returnResponse = false; showStatus("The server successfully processed the request and is not returning any content."); } - else if(responseCode == 205 ){ returnResponse = false; showStatus("Server is no returning any content"); } - else if(responseCode == 206 ){ returnResponse = false; showStatus("The server is delivering only part of the resource "); } - else if(responseCode == 207 ){ returnResponse = false; showStatus(" XML message and can contain a number"); } - else if(responseCode == 208 ){ returnResponse = false; showStatus("The members of a DAV binding have already been enumerated");