Skip to content

Commit

Permalink
library version downgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsust committed Dec 21, 2018
1 parent 5daafe1 commit a0c3085
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/com/pavel/responsecode/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
*/

}
}
});
Expand Down
8 changes: 3 additions & 5 deletions responsecode/build.gradle
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ public class HttpResponseCode {
public boolean isShowStatus;

public HttpResponseCode(){

}

public HttpResponseCode(Context context , boolean isShowStatus){
Expand All @@ -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");
Expand All @@ -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");
Expand Down

0 comments on commit a0c3085

Please sign in to comment.