Skip to content

Commit

Permalink
update gradle to version 5.2
Browse files Browse the repository at this point in the history
update gradle from groovy to kotlin
add upload File Into Post Method
  • Loading branch information
alishatergholi committed Feb 18, 2019
1 parent e2c4dd3 commit b6ecb68
Show file tree
Hide file tree
Showing 23 changed files with 368 additions and 357 deletions.
Binary file removed .idea/caches/gradle_models.ser
Binary file not shown.
4 changes: 1 addition & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 6 additions & 39 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@ Type-safe HTTP client for Android and Java by Square, Inc.
implement Basic Authorization



download
======

Gradle

latest version on jitpack [![](https://jitpack.io/v/alishatergholi/RestClient.svg)](https://jitpack.io/#alishatergholi/RestClient)

```groovy
repositories{
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.alishatergholi:restclient:latest_version'
implementation 'com.github.alishatergholi:rest-client:latest_version'
}
```

Expand All @@ -30,22 +27,20 @@ How do i use RestClient
=======================
```java
RestClient client = new RestClient
.Builder(context)

/* you can add Accept encoding for encode your response */
/* for now we just support gzip */
.setAcceptEnconding(EncodingType.GZIP)

/* for add custom header you need
.Builder(context)
/* you can add Accept encoding for encode your response */
/* for now we just support gzip */
.setAcceptEnconding(EncodingType.GZIP)
/* for add custom header you need
ArrayMap<String,String> header = new ArrayMap<>();
header.put("appid","0e8f8fd2-1acb-11e7-8ab0-ac162d7938f0");
header.put("accept-language", "fa");
.setHeader(header)
.setHeader(header)
*/
/* for add Authorization Header */
.setAuthorization("Authorization url","clientId","client",AuthType.BASIC_AUTH)
.setUserInfo("username for Authorization","password for Authorization")
.build();
.build();

//for add body use.
RequestParams params = new RequestParams(RequestBodyType.FormData);
Expand Down
33 changes: 0 additions & 33 deletions app/build.gradle

This file was deleted.

38 changes: 38 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id("com.android.application")
}

android {
compileSdkVersion(28)
defaultConfig {
minSdkVersion(15)
targetSdkVersion(28)
buildToolsVersion = "28.0.3"
versionCode = 8
versionName = "1.0.8"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
getByName("release"){
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

dependencies {
implementation(fileTree(mapOf("include" to listOf("*.jar"), "dir" to "libs")))
implementation("androidx.appcompat:appcompat:1.0.2")
// implementation("com.github.alishatergholi:rest-client:v1.0.8")
testImplementation("junit:junit:4.12")
implementation(project(":library"))
androidTestImplementation("androidx.test:runner:1.1.1")
androidTestImplementation("androidx.test.espresso:espresso-core:3.1.1")
}



2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package com.github.restclient;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;

import static org.junit.Assert.*;

/**
Expand Down
19 changes: 6 additions & 13 deletions app/src/main/java/com/github/restclient/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import androidx.appcompat.app.AppCompatActivity;
import androidx.collection.ArrayMap;

import com.github.library.RestClient;

import com.github.library.enums.AuthType;
Expand All @@ -35,20 +36,14 @@ protected void onCreate(Bundle savedInstanceState) {
RequestParams params = new RequestParams(RequestBodyType.FormData);
params.put("page", "1");

restClient.POST("https://google.com", "", new RequestParams(), new ResponseJsonHandler() {
@Override
protected void onSuccess(JSONObject result) {
Log.d(TAG, "response " + result);
}

@Override
protected void onSuccess(JSONArray result) {

}
restClient.POST("https://google.com",
"",
new RequestParams(),
new ResponseJsonHandler() {

@Override
protected void onSuccess(String result) {

Log.d(TAG, "response " + result);
}

@Override
Expand All @@ -66,11 +61,9 @@ private void initRestClient() {
header.put("accept-language", "en");

restClient = new RestClient.Builder(this)

.setAuthorization("http://sandbox.vaslapp.com/oauth/token",
"c3bdf6c5-508f-48ae-9af4-243a24072e31", "LnDbEo3yDDcswKMC3h4H", AuthType.BASIC_AUTH)
.setUserInfo("android-XoaM8ODAYVcKnB16ob8N", "DOI0qOIa0KT6ViYmS1k6")

.setHeader(header)
.build();

Expand Down
36 changes: 0 additions & 36 deletions build.gradle

This file was deleted.

27 changes: 27 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven("https://jitpack.io")
}
dependencies {
classpath("com.android.tools.build:gradle:3.3.1")
classpath("com.github.dcendents:android-maven-gradle-plugin:2.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven("https://jitpack.io")
}

}

task<Delete>("clean") {
delete(rootProject.buildDir)
}
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Feb 02 14:19:07 IRST 2019
#Mon Feb 18 12:25:12 IRST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2-all.zip
36 changes: 0 additions & 36 deletions library/build.gradle

This file was deleted.

Loading

0 comments on commit b6ecb68

Please sign in to comment.