Skip to content

Commit

Permalink
Remove rxjava dependency, shrink plugin size
Browse files Browse the repository at this point in the history
  • Loading branch information
alvince committed Jan 21, 2018
1 parent ba5f5a8 commit 659c635
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
8 changes: 3 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.1.3-2'
ext.kotlin_version = '1.2.10'

repositories {
mavenCentral()
Expand Down Expand Up @@ -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'
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,7 +29,7 @@ import java.util.concurrent.Executors
* Created by alvince on 2017/6/28.
*
* @author [email protected]
* @version 1.0.1, 7/21/2017
* @version 1.0.1, 1/21/2018
* @since 1.0
*/
class TinyPicUploadAction : TinifyAction() {
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -109,6 +100,16 @@ class TinyPicUploadAction : TinifyAction() {
}


internal inner class FilePickTask(private val files: Array<VirtualFile>) : 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)
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.alvincezy.TinyPic2</id>
<name>Tinify Picture</name>
<version>1.0.1</version>
<version>1.0.2</version>
<vendor email="[email protected]" url="https://github.com/alvince/TinyPic2">alvince</vendor>

<description><![CDATA[
Expand All @@ -26,7 +26,8 @@
]]></description>

<change-notes><![CDATA[
Fix compat android studio.<br/>
<h3>1.0.2 - Shrink plugin size</h3>
<h3>1.0.1 - Fix compat android studio</h3>
]]>
</change-notes>

Expand Down

0 comments on commit 659c635

Please sign in to comment.