Skip to content

Commit c78a53d

Browse files
Merge pull request #8 from agilecontent/androidx
migrated to androidx
2 parents 360ce07 + e873c36 commit c78a53d

File tree

7 files changed

+27
-26
lines changed

7 files changed

+27
-26
lines changed

.idea/encodings.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.21'
4+
ext.kotlin_version = '1.3.60'
55
repositories {
66
google()
77
jcenter()
88
maven { url "https://jitpack.io" }
99
}
1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.2.1'
11+
classpath 'com.android.tools.build:gradle:3.5.2'
1212
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1313
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
1414
// NOTE: Do not place your application dependencies here; they belong

gradle.properties

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
# http://www.gradle.org/docs/current/userguide/build_environment.html
77
# Specifies the JVM arguments used for the daemon process.
88
# The setting is particularly useful for tweaking memory settings.
9+
android.enableJetifier=true
10+
android.useAndroidX=true
911
org.gradle.jvmargs=-Xmx1536m
1012
# When configured, Gradle will run in incubating parallel mode.
1113
# This option should only be used with decoupled projects. More details, visit
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Feb 20 14:44:56 BRT 2019
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.6-all.zip
1+
#Mon Nov 25 19:00:51 BRST 2019
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-5.4.1-all.zip

grapqhqlkotlin/build.gradle

+10-10
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ android {
1313
targetSdkVersion 28
1414
versionCode 1
1515
versionName "1.0"
16-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
16+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1717

1818
}
1919

@@ -27,16 +27,16 @@ android {
2727
}
2828
dependencies {
2929
implementation fileTree(dir: 'libs', include: ['*.jar'])
30-
implementation 'com.android.support:appcompat-v7:28.0.0'
30+
implementation 'androidx.appcompat:appcompat:1.1.0'
3131
testImplementation 'junit:junit:4.12'
32-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
33-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
34-
implementation "com.google.code.gson:gson:2.8.5"
35-
implementation "com.squareup.okhttp3:okhttp:3.11.0"
36-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13"
37-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.27.0-eap13"
38-
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:0.27.0-eap13"
39-
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.21"
32+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
33+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
34+
implementation "com.google.code.gson:gson:2.8.6"
35+
implementation "com.squareup.okhttp3:okhttp:3.12.5"
36+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2"
37+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.2"
38+
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.2"
39+
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.60"
4040
}
4141
repositories {
4242
mavenCentral()

grapqhqlkotlin/src/main/java/com/agilecontent/grapqhqlkotlin/CacheInterceptor.kt

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ class CacheInterceptor : Interceptor {
1010
override fun intercept(chain: Interceptor.Chain): Response {
1111
val response = chain.proceed(chain.request())
1212
val cacheControl = CacheControl.Builder().maxAge(1, TimeUnit.HOURS).build()
13-
1413
return response.newBuilder().header("Cache-Control", cacheControl.toString()).build()
1514
}
1615
}

grapqhqlkotlin/src/main/java/com/agilecontent/grapqhqlkotlin/GraphQLQueryService.kt

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.agilecontent.grapqhqlkotlin
22

33
import android.content.Context
4-
import android.util.Log
54
import com.google.gson.Gson
65
import com.google.gson.JsonObject
76
import kotlinx.coroutines.CoroutineScope
87
import kotlinx.coroutines.Dispatchers
9-
import kotlinx.coroutines.async
8+
import kotlinx.coroutines.withContext
109
import okhttp3.*
11-
1210
import java.io.File
1311
import java.net.URLEncoder
1412

@@ -26,8 +24,7 @@ open class GraphQLQueryService(val url: String, val auth: String? = null, val co
2624
.post(body)
2725
.url(url)
2826
.build()
29-
val deferred = CoroutineScope(Dispatchers.Default).async { client.newCall(request).execute() }
30-
val response = deferred.await()
27+
val response = withContext(CoroutineScope(Dispatchers.Default).coroutineContext) { client.newCall(request).execute() }
3128
return Gson().fromJson(response.body()?.string(), JsonObject::class.java)?.getAsJsonObject("data")
3229
}
3330

@@ -39,8 +36,7 @@ open class GraphQLQueryService(val url: String, val auth: String? = null, val co
3936
.get()
4037
.url(HttpUrl.parse(url)?.newBuilder()?.addEncodedQueryParameter("query", URLEncoder.encode(query).replace("%5C",""))?.build()!!)
4138
.build()
42-
val deferred = CoroutineScope(Dispatchers.Default).async { client.newCall(request).execute() }
43-
val response = deferred.await()
39+
val response = withContext(CoroutineScope(Dispatchers.Default).coroutineContext) { client.newCall(request).execute() }
4440
return Gson().fromJson(response.body()?.string(), JsonObject::class.java)?.getAsJsonObject("data")
4541
}
4642

0 commit comments

Comments
 (0)