From 659c6356be464db64c19ba8028d9e6687d1cc6ba Mon Sep 17 00:00:00 2001 From: alvince Date: Sun, 21 Jan 2018 22:12:51 +0800 Subject: [PATCH] Remove rxjava dependency, shrink plugin size --- build.gradle | 8 +++---- .../tinypic2/actions/TinyPicUploadAction.kt | 23 ++++++++++--------- src/main/resources/META-INF/plugin.xml | 5 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 621cd85..5763231 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.1.3-2' + ext.kotlin_version = '1.2.10' repositories { mavenCentral() @@ -35,12 +35,10 @@ intellij { dependencies { compile 'com.google.code.gson:gson:2.8.1' - compile 'com.tinify:tinify:1.5.0' - compile 'io.reactivex:rxjava:1.3.0' -// compile 'io.reactivex:rxkotlin:1.0.0' + compile 'com.tinify:tinify:1.5.1' } apply plugin: 'idea' group 'com.alvincezy' -version '1.0.1' +version '1.0.2' diff --git a/src/main/kotlin/com/alvincezy/tinypic2/actions/TinyPicUploadAction.kt b/src/main/kotlin/com/alvincezy/tinypic2/actions/TinyPicUploadAction.kt index a909488..82213d0 100644 --- a/src/main/kotlin/com/alvincezy/tinypic2/actions/TinyPicUploadAction.kt +++ b/src/main/kotlin/com/alvincezy/tinypic2/actions/TinyPicUploadAction.kt @@ -21,8 +21,6 @@ import com.intellij.openapi.vfs.VirtualFile import com.intellij.openapi.vfs.VirtualFileVisitor import com.tinify.Tinify import org.apache.commons.lang.StringUtils -import rx.Observable -import rx.schedulers.Schedulers import java.io.IOException import java.util.* import java.util.concurrent.Executors @@ -31,7 +29,7 @@ import java.util.concurrent.Executors * Created by alvince on 2017/6/28. * * @author alvince.zy@gmail.com - * @version 1.0.1, 7/21/2017 + * @version 1.0.1, 1/21/2018 * @since 1.0 */ class TinyPicUploadAction : TinifyAction() { @@ -60,14 +58,7 @@ class TinyPicUploadAction : TinifyAction() { tinifySource.clear() val descriptor = FileChooserDescriptor(true, true, false, false, false, true) val selectedFiles = FileChooser.chooseFiles(descriptor, project, project.baseDir) - Observable.just(selectedFiles) - .subscribeOn(Schedulers.io()) - .filter { selectedFiles.isNotEmpty() } - .subscribe({ - selectedFiles.forEach { parseFilePicked(it) } -// logger.debug("${tinifySource.toArray()}") - uploadAndTinify() - }, { it.printStackTrace() }) + FilePickTask(selectedFiles).start() } @Suppress("name_shadowing") @@ -109,6 +100,16 @@ class TinyPicUploadAction : TinifyAction() { } + internal inner class FilePickTask(private val files: Array) : Thread() { + override fun run() { + super.run() + if (files.isNotEmpty()) { + files.forEach { parseFilePicked(it) } + uploadAndTinify() + } + } + } + internal inner class TaskRunnable(file: VirtualFile) : Runnable { private val name: String = file.path private val flowable: TinifyFlowable = TinifyFlowable(file) diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index d51d2c5..19b5b69 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.alvincezy.TinyPic2 Tinify Picture - 1.0.1 + 1.0.2 alvince +

1.0.2 - Shrink plugin size

+

1.0.1 - Fix compat android studio

]]>