diff --git a/README.md b/README.md index cb30fee..7f0cacb 100644 --- a/README.md +++ b/README.md @@ -88,9 +88,9 @@ allprojects { And add our dependency to your app `bundle.gradle`. ```gradle -implementation 'com.devrapid.jieyi:kotlinknifer:2.0.5' +implementation 'com.devrapid.jieyi:kotlinknifer:2.1.0' -implementation 'com.devrapid.jieyi:kotlinshaver:1.0.5' +implementation 'com.devrapid.jieyi:kotlinshaver:1.1.0' ``` Then you can use it!!! @@ -101,14 +101,14 @@ Then you can use it!!! com.devrapid.jieyi kotlinknifer - 2.0.5 + 2.1.0 pom com.devrapid.jieyi kotlinshaver - 1.0.5 + 1.1.0 pom ``` @@ -123,20 +123,20 @@ Then you can use it!!! ## kotlinshaver ### For Androidx -1. RxJava 2.2.1 +1. RxJava 2.2.3 2. RxKotlin 2.3.0 If you'd not like to use them to your project, you can add the exclude as like below ```gradle -implementation('com.devrapid.jieyi:kotlinknifer:2.0.5', { +implementation('com.devrapid.jieyi:kotlinknifer:2.1.0', { exclude group: 'com.google.code.gson', module: 'gson' exclude group: 'com.github.bumptech.glide', module: 'glide' }) ``` ```gradle -implementation('com.devrapid.jieyi:kotlinshaverr:1.0.5', { +implementation('com.devrapid.jieyi:kotlinshaverr:1.1.0', { exclude group: 'io.reactivex.rxjava2', module: 'rxjava' exclude group: 'io.reactivex.rxjava2', module: 'rxkotlin' }) diff --git a/build.gradle b/build.gradle index eb6c779..8f09f3c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,15 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.2.61' + ext.kotlin_version = '1.3.0' + ext.kotlin_coroutine_version = '1.0.0' repositories { jcenter() google() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.0-beta04' + classpath 'com.android.tools.build:gradle:3.2.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/gradle.properties b/gradle.properties index aaa86bb..55c1d3a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ proj_name=kotlinknifer proj_libname=KotlinKnifer proj_group=com.devrapid.jieyi proj_artifactid=kotlinknifer -proj_version=2.0.5 +proj_version=2.1.0 proj_description=For developing an Android conveniently and rapidly. proj_websiteurl=https://github.com/pokk/KotlinKnifer proj_issuetrackerurl=https://github.com/pokk/KotlinKnifer/issues @@ -39,4 +39,4 @@ developer_email=pokkbaby@gmail.com proj_kotlin_name=kotlinshaver proj_kotlin_libname=KotlinShaver proj_kotlin_artifactid=kotlinshaver -proj_kotlin_version=1.0.5 +proj_kotlin_version=1.1.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cf10787..47e406e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/kotlinknifer/build.gradle b/kotlinknifer/build.gradle index 8d21ca8..88438e7 100644 --- a/kotlinknifer/build.gradle +++ b/kotlinknifer/build.gradle @@ -25,17 +25,17 @@ kotlin { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" // 'compile' can also import to the new project with this. - compile 'com.google.code.gson:gson:2.8.5' - compile 'com.github.bumptech.glide:glide:4.8.0' + compile "com.google.code.gson:gson:2.8.5" + compile "com.github.bumptech.glide:glide:4.8.0" // 'implementation' can't import to the new project. - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.25.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:0.25.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.25.0' - implementation 'org.jetbrains.anko:anko-commons:0.10.5' - implementation 'androidx.appcompat:appcompat:1.0.0-rc02' - implementation 'androidx.recyclerview:recyclerview:1.0.0-rc01' - implementation 'androidx.palette:palette:1.0.0-rc02' - compile project(':kotlinshaver') + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutine_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutine_version" + implementation "org.jetbrains.anko:anko-commons:0.10.7-rc13" + implementation "androidx.appcompat:appcompat:1.0.0" + implementation "androidx.recyclerview:recyclerview:1.0.0-rc01" + implementation "androidx.palette:palette:1.0.0" + compile project(":kotlinshaver") } apply from: 'https://raw.githubusercontent.com/pokk/JCenterUploader/master/Uploader.gradle' diff --git a/kotlinknifer/src/main/java/com/devrapid/kotlinknifer/Coroutine.kt b/kotlinknifer/src/main/java/com/devrapid/kotlinknifer/Coroutine.kt index 334105c..3961f90 100644 --- a/kotlinknifer/src/main/java/com/devrapid/kotlinknifer/Coroutine.kt +++ b/kotlinknifer/src/main/java/com/devrapid/kotlinknifer/Coroutine.kt @@ -1,11 +1,16 @@ +@file:Suppress("NOTHING_TO_INLINE") + package com.devrapid.kotlinknifer -import kotlinx.coroutines.experimental.CoroutineScope -import kotlinx.coroutines.experimental.android.UI -import kotlinx.coroutines.experimental.launch +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers.Default +import kotlinx.coroutines.Dispatchers.IO +import kotlinx.coroutines.Dispatchers.Main +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.launch + +inline fun ui(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Main, block = block) + +inline fun bkg(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(Default, block = block) -/** - * @author Jieyi Wu - * @since 2018/04/04 - */ -fun ui(block: suspend CoroutineScope.() -> Unit) = launch(UI, block = block) \ No newline at end of file +inline fun io(noinline block: suspend CoroutineScope.() -> Unit) = GlobalScope.launch(IO, block = block) diff --git a/kotlinshaver/build.gradle b/kotlinshaver/build.gradle index 908595c..4bba54f 100644 --- a/kotlinshaver/build.gradle +++ b/kotlinshaver/build.gradle @@ -3,11 +3,11 @@ apply plugin: 'kotlin' dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.25.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core-common:0.25.0' + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutine_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutine_version" - compile 'io.reactivex.rxjava2:rxkotlin:2.3.0' - compile 'io.reactivex.rxjava2:rxjava:2.2.1' + compile "io.reactivex.rxjava2:rxkotlin:2.3.0" + compile "io.reactivex.rxjava2:rxjava:2.2.3" } sourceCompatibility = "1.8" diff --git a/kotlinshaver/src/main/java/com/devrapid/kotlinshaver/ArrayList.kt b/kotlinshaver/src/main/java/com/devrapid/kotlinshaver/ArrayList.kt index 982c9a8..9d8fbf4 100644 --- a/kotlinshaver/src/main/java/com/devrapid/kotlinshaver/ArrayList.kt +++ b/kotlinshaver/src/main/java/com/devrapid/kotlinshaver/ArrayList.kt @@ -5,10 +5,10 @@ package com.devrapid.kotlinshaver * @since 11/8/17 */ fun ArrayList.removeRange(from: Int, to: Int): Boolean = - if (!(from in 0..size - 1 && to in 0..size - 1 && from > to)) { + if (!(from in 0 until size && to in 0 until size && from > to)) { false } else { subList(from, to).clear() true - } \ No newline at end of file + } diff --git a/sample/build.gradle b/sample/build.gradle index 1632a66..73725d8 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -21,7 +21,7 @@ android { dependencies { implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'androidx.appcompat:appcompat:1.0.0-rc02' + implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation project(':kotlinknifer')