Skip to content

Commit

Permalink
Released 3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyr committed Jul 22, 2020
1 parent 4e02517 commit cd4ea40
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 7 deletions.
Binary file modified GoogleLibraryVersionQuerier.zip
Binary file not shown.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@

### 更新日志:

- **3.3** 修复兼容性问题,现最低兼容到AndroidStudio3.0;优化体验:右键菜单选项『Query available versions』只在编辑.gradle文件时显示;『Query available versions』的快捷键改为『CTRL ALT Q』,因原来的『ALT Q』与其他快捷键有冲突;

- **3.2** 优化查询,彻底修复编辑gradle文件卡顿的问题;查询可用版本改为倒序排序;加入监听ESC键关闭版本选择对话框。

- **3.1** 修复键入任何字符和在任何文件下也会弹提示的Bug,加入限制:只有在.gradle文件中的dependencies作用域内才会搜索仓库。
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.wuyr.google_library_query</id>
<name>Google Library Version Querier</name>
<version>3.2</version>
<version>3.3</version>
<vendor email="ifxcyr@gmail.com" url="https://www.github.com/wuyr">陈小缘</vendor>

<description><![CDATA[
Expand All @@ -13,6 +13,8 @@
]]></description>

<change-notes><![CDATA[
<p><li><strong>3.3 </strong>Compatibility issues fixes.</li></p>
<p><li><strong>3.2 </strong>Bug fixes.</li></p>
<p><li><strong>3.1 </strong>Bug fixes.</li></p>
Expand All @@ -27,7 +29,7 @@
<br>
]]></change-notes>

<idea-version since-build="173.0"/>
<idea-version since-build="171.0"/>

<depends>com.intellij.modules.lang</depends>

Expand All @@ -40,7 +42,7 @@
<action id="com.wuyr.google_library_query.QueryAction" class="com.wuyr.google_library_query.QueryAction"
text="Query Available Versions" description="Query available versions">
<add-to-group group-id="XmlGenerateToolsGroup"/>
<keyboard-shortcut keymap="$default" first-keystroke="alt Q"/>
<keyboard-shortcut keymap="$default" first-keystroke="control alt Q"/>
</action>
</actions>

Expand Down
8 changes: 5 additions & 3 deletions resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.wuyr.google_library_query</id>
<name>Google Library Version Querier</name>
<version>3.2</version>
<version>3.3</version>
<vendor email="ifxcyr@gmail.com" url="https://www.github.com/wuyr">陈小缘</vendor>

<description><![CDATA[
Expand All @@ -13,6 +13,8 @@
]]></description>

<change-notes><![CDATA[
<p><li><strong>3.3 </strong>Compatibility issues fixes.</li></p>
<p><li><strong>3.2 </strong>Bug fixes.</li></p>
<p><li><strong>3.1 </strong>Bug fixes.</li></p>
Expand All @@ -27,7 +29,7 @@
<br>
]]></change-notes>

<idea-version since-build="173.0"/>
<idea-version since-build="171.0"/>

<depends>com.intellij.modules.lang</depends>

Expand All @@ -40,7 +42,7 @@
<action id="com.wuyr.google_library_query.QueryAction" class="com.wuyr.google_library_query.QueryAction"
text="Query Available Versions" description="Query available versions">
<add-to-group group-id="XmlGenerateToolsGroup"/>
<keyboard-shortcut keymap="$default" first-keystroke="alt Q"/>
<keyboard-shortcut keymap="$default" first-keystroke="control alt Q"/>
</action>
</actions>

Expand Down
2 changes: 1 addition & 1 deletion src/com/wuyr/google_library_query/GradleContributor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ class GradleContributor : CompletionContributor() {
WriteCommandAction.runWriteCommandAction(context.project) {
context.document.replaceString(lineStartPosition + additionalIndex, lineEndPosition - 1, item.lookupString)
}
}.withTypeIconRightAligned(true)
}
}
8 changes: 8 additions & 0 deletions src/com/wuyr/google_library_query/NetworkRequstter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
package com.wuyr.google_library_query

import com.google.gson.Gson
import java.io.ByteArrayOutputStream
import java.io.InputStream
import java.net.SocketTimeoutException
import java.net.URL
import java.net.URLDecoder
Expand Down Expand Up @@ -153,6 +155,12 @@ fun String.getAPIResponse(retryCount: Int): String? {
exception?.let { throw exception } ?: return null
}

private fun InputStream.readBytes(): ByteArray {
val buffer = ByteArrayOutputStream(maxOf(DEFAULT_BUFFER_SIZE, this.available()))
copyTo(buffer)
return buffer.toByteArray()
}

inline fun <T, R> T.runSafely(block: (T) -> R) = try {
block(this)
} catch (e: Exception) {
Expand Down
12 changes: 12 additions & 0 deletions src/com/wuyr/google_library_query/QueryAction.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ class QueryAction : AnAction() {
v2.length - v1.length
}

private val acceptFilesType = arrayOf(".gradle")

override fun update(event: AnActionEvent) {
acceptFilesType.any { event.getData(CommonDataKeys.PSI_FILE)?.name?.endsWith(it) ?: false }.let { enable ->
event.presentation.run {
isEnabled = enable
isVisible = enable
}
}
super.update(event)
}

override fun actionPerformed(event: AnActionEvent) {
thread {
event.getData(CommonDataKeys.EDITOR)?.let { editor ->
Expand Down

0 comments on commit cd4ea40

Please sign in to comment.