Skip to content

Updating android to 26 #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.1.0-beta-38'
ext.kotlin_coroutines_version = '0.7-beta'
ext.kotlin_version = '1.1.4-3'
ext.kotlin_coroutines_version = '0.18'
repositories {
jcenter()
maven {
url "https://dl.bintray.com/kotlin/kotlin-eap-1.1"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
Expand All @@ -18,9 +15,6 @@ buildscript {
allprojects {
repositories {
jcenter()
maven {
url "https://dl.bintray.com/kotlin/kotlin-eap-1.1"
}
}
}

14 changes: 7 additions & 7 deletions coroutines-android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName project.version
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

compileOptions {
targetCompatibility = '1.6'
sourceCompatibility = '1.6'
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
}

sourceSets {
Expand All @@ -29,7 +29,7 @@ android {
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
testCompile 'junit:junit:4.12'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object MainThread : CoroutineDispatcher(), Delay {

*/
handler.postDelayed(runnable, unit.toMillis(time))
continuation.onCompletion { handler.removeCallbacks(runnable) }
continuation.invokeOnCompletion { handler.removeCallbacks(runnable) }
}
}

Expand All @@ -73,7 +73,7 @@ fun CoroutineLifecycle.mainAsync(
context: CoroutineContext? = null, // Using EmptyCoroutineContext by default here will safe an `if` below
block: suspend CoroutineScope.() -> Unit
): Job {
if (isEventSupported(cancelEvent)) {
if (!isEventSupported(cancelEvent)) {
throw IllegalStateException("Cancel event $cancelEvent doesn't supported by CoroutineLifecycle $this")
}
val job = launch(if (context == null) MainThread else context + MainThread) {
Expand All @@ -82,7 +82,7 @@ fun CoroutineLifecycle.mainAsync(
val listener: () -> Unit = {
job.cancel()
}
job.onCompletion { removeListener(listener) }
job.invokeOnCompletion { removeListener(listener) }
addListener(Destroy, listener)
return job
}
4 changes: 2 additions & 2 deletions coroutines-retrofit/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ sourceSets {
test.java.srcDirs += 'src/test/kotlin'
}

targetCompatibility = '1.6'
sourceCompatibility = '1.6'
targetCompatibility = '1.7'
sourceCompatibility = '1.7'

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ suspend fun <T> Call<T>.await(): T {
continuation.resumeWithException(t)
}
})

registerOnCompletion(continuation)
}
}
Expand Down Expand Up @@ -58,7 +57,7 @@ suspend fun <T> Call<T>.awaitResult(): Result<T> {
}

private fun Call<*>.registerOnCompletion(continuation: CancellableContinuation<*>) {
continuation.onCompletion {
continuation.invokeOnCompletion {
if (continuation.isCancelled)
try {
cancel()
Expand Down
12 changes: 6 additions & 6 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "ru.gildor.coroutines.android.sample"
minSdkVersion 15
targetSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

compileOptions {
targetCompatibility = '1.6'
sourceCompatibility = '1.6'
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
}

sourceSets {
Expand All @@ -26,7 +26,7 @@ android {
}

dependencies {
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
compile 'com.squareup.retrofit2:retrofit:2.1.0'
Expand Down