Skip to content

Commit 659c635

Browse files
committed
Remove rxjava dependency, shrink plugin size
1 parent ba5f5a8 commit 659c635

3 files changed

Lines changed: 18 additions & 18 deletions

File tree

build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
buildscript {
2-
ext.kotlin_version = '1.1.3-2'
2+
ext.kotlin_version = '1.2.10'
33

44
repositories {
55
mavenCentral()
@@ -35,12 +35,10 @@ intellij {
3535

3636
dependencies {
3737
compile 'com.google.code.gson:gson:2.8.1'
38-
compile 'com.tinify:tinify:1.5.0'
39-
compile 'io.reactivex:rxjava:1.3.0'
40-
// compile 'io.reactivex:rxkotlin:1.0.0'
38+
compile 'com.tinify:tinify:1.5.1'
4139
}
4240

4341
apply plugin: 'idea'
4442

4543
group 'com.alvincezy'
46-
version '1.0.1'
44+
version '1.0.2'

src/main/kotlin/com/alvincezy/tinypic2/actions/TinyPicUploadAction.kt

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import com.intellij.openapi.vfs.VirtualFile
2121
import com.intellij.openapi.vfs.VirtualFileVisitor
2222
import com.tinify.Tinify
2323
import org.apache.commons.lang.StringUtils
24-
import rx.Observable
25-
import rx.schedulers.Schedulers
2624
import java.io.IOException
2725
import java.util.*
2826
import java.util.concurrent.Executors
@@ -31,7 +29,7 @@ import java.util.concurrent.Executors
3129
* Created by alvince on 2017/6/28.
3230
*
3331
* @author alvince.zy@gmail.com
34-
* @version 1.0.1, 7/21/2017
32+
* @version 1.0.1, 1/21/2018
3533
* @since 1.0
3634
*/
3735
class TinyPicUploadAction : TinifyAction() {
@@ -60,14 +58,7 @@ class TinyPicUploadAction : TinifyAction() {
6058
tinifySource.clear()
6159
val descriptor = FileChooserDescriptor(true, true, false, false, false, true)
6260
val selectedFiles = FileChooser.chooseFiles(descriptor, project, project.baseDir)
63-
Observable.just(selectedFiles)
64-
.subscribeOn(Schedulers.io())
65-
.filter { selectedFiles.isNotEmpty() }
66-
.subscribe({
67-
selectedFiles.forEach { parseFilePicked(it) }
68-
// logger.debug("${tinifySource.toArray()}")
69-
uploadAndTinify()
70-
}, { it.printStackTrace() })
61+
FilePickTask(selectedFiles).start()
7162
}
7263

7364
@Suppress("name_shadowing")
@@ -109,6 +100,16 @@ class TinyPicUploadAction : TinifyAction() {
109100
}
110101

111102

103+
internal inner class FilePickTask(private val files: Array<VirtualFile>) : Thread() {
104+
override fun run() {
105+
super.run()
106+
if (files.isNotEmpty()) {
107+
files.forEach { parseFilePicked(it) }
108+
uploadAndTinify()
109+
}
110+
}
111+
}
112+
112113
internal inner class TaskRunnable(file: VirtualFile) : Runnable {
113114
private val name: String = file.path
114115
private val flowable: TinifyFlowable = TinifyFlowable(file)

src/main/resources/META-INF/plugin.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin>
22
<id>com.alvincezy.TinyPic2</id>
33
<name>Tinify Picture</name>
4-
<version>1.0.1</version>
4+
<version>1.0.2</version>
55
<vendor email="alvince.zy@gmail.com" url="https://github.com/alvince/TinyPic2">alvince</vendor>
66

77
<description><![CDATA[
@@ -26,7 +26,8 @@
2626
]]></description>
2727

2828
<change-notes><![CDATA[
29-
Fix compat android studio.<br/>
29+
<h3>1.0.2 - Shrink plugin size</h3>
30+
<h3>1.0.1 - Fix compat android studio</h3>
3031
]]>
3132
</change-notes>
3233

0 commit comments

Comments
 (0)