Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 jiangyy
Copyright (c) 2019-2023 jiangyy

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# AutoGradle

[![Github](https://img.shields.io/badge/github-AutoGradle-blue.svg)](https://www.github.com/jyygithub/AutoGradle)
[![Issue](https://img.shields.io/badge/issue-AutoGradle-red.svg)](https://github.com/jyygithub/AutoGradle/issues)
[![Version](https://img.shields.io/badge/version-1.3.1-lightgrey.svg)](https://plugins.jetbrains.com/plugin/12061-autogradle)
![Support](https://img.shields.io/badge/support-Android%20Studio-green.svg)

## Get libraries and implementation quickly.
<p align="center">
<a target="_blank">
<img width="128" src="https://raw.githubusercontent.com/jyygithub/AutoGradle/d05df84cdf71cdb2d107cd179090ad949a20ee33/src/main/resources/META-INF/pluginIcon.svg" alt="logo">
</a>
</p>
<p align="center">
<img src="https://img.shields.io/github/v/release/jyygithub/AutoGradle" alt="release">
<img src="https://img.shields.io/github/repo-size/jyygithub/AutoGradle?color=orange&label=size" alt="size">
</p>
<h2 align="center">
Get libraries and implementation quickly.
</h2>

## Usage

Expand Down
10 changes: 5 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
plugins {
id("java")
id("org.jetbrains.kotlin.jvm") version "1.7.10"
id("org.jetbrains.intellij") version "1.9.0"
id("org.jetbrains.kotlin.jvm") version "1.8.10"
id("org.jetbrains.intellij") version "1.13.3"
}

group = "com.jiangyy"
version = "1.3.1"
version = "1.3.2"

repositories {
mavenCentral()
}

dependencies {
implementation("com.squareup.okhttp3:okhttp:4.10.0")
implementation("com.google.code.gson:gson:2.9.0")
implementation("com.google.code.gson:gson:2.10.1")
}

// Configure Gradle IntelliJ Plugin
Expand All @@ -37,7 +37,7 @@ tasks {

patchPluginXml {
sinceBuild.set("213")
untilBuild.set("223.*")
untilBuild.set("232.*")
}

signPlugin {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.jiangyy.autogradle.entity

class Reponse(
class ApiResponse(
val code: Int,
val message: String,
val data: MutableList<Repository>
Expand Down
26 changes: 13 additions & 13 deletions src/main/kotlin/com/jiangyy/autogradle/ui/EntranceDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.intellij.ui.components.JBScrollPane
import com.intellij.ui.layout.panel
import com.intellij.ui.table.JBTable
import com.intellij.util.ui.JBDimension
import com.jiangyy.autogradle.entity.Reponse
import com.jiangyy.autogradle.entity.ApiResponse
import com.jiangyy.autogradle.entity.Repository
import com.jiangyy.autogradle.utils.orDefault
import okhttp3.*
Expand All @@ -33,7 +33,7 @@ import javax.swing.event.DocumentListener
import javax.swing.text.BadLocationException

class EntranceDialog(@Nullable private val event: AnActionEvent) : DialogWrapper(true), DocumentListener,
MouseListener, ItemListener {
MouseListener, ItemListener {

private var bindData = mutableListOf<Repository>()
private var originalData = mutableListOf<Repository>()
Expand Down Expand Up @@ -90,9 +90,9 @@ class EntranceDialog(@Nullable private val event: AnActionEvent) : DialogWrapper
}

val keys = arrayOf(
"All", "Androidx", "Cache", "Chart", "CustomView", "Debug", "Dialog", "Http",
"Image", "Json", "Kit", "Log", "Permission", "Picker", "RecyclerView", "Subscribe",
"WebView"
"All", "Androidx", "Cache", "Chart", "CustomView", "Debug", "Dialog", "Http",
"Image", "Json", "Kit", "Log", "Permission", "Picker", "RecyclerView", "Subscribe",
"WebView"
)

comboBox = ComboBox<String>().apply {
Expand Down Expand Up @@ -222,7 +222,7 @@ class EntranceDialog(@Nullable private val event: AnActionEvent) : DialogWrapper
for (i in originalData.indices) {
val item = originalData[i]
if (
item.nickname.orEmpty().lowercase().contains(input.orEmpty())
item.nickname.orEmpty().lowercase().contains(input.orEmpty())
) {
bindData.add(originalData[i])
}
Expand All @@ -233,9 +233,9 @@ class EntranceDialog(@Nullable private val event: AnActionEvent) : DialogWrapper
for (i in originalData.indices) {
val item = originalData[i]
if (
item.nickname.orEmpty().lowercase().contains(input.orEmpty())
&&
item.key.orEmpty().lowercase() == key.orEmpty().lowercase()
item.nickname.orEmpty().lowercase().contains(input.orEmpty())
&&
item.key.orEmpty().lowercase() == key.orEmpty().lowercase()
) {
bindData.add(originalData[i])
}
Expand Down Expand Up @@ -288,14 +288,14 @@ class EntranceDialog(@Nullable private val event: AnActionEvent) : DialogWrapper

private fun listRepos() {
OkHttpClient().newCall(
Request.Builder()
.addHeader("factory-api-version", "v2.0")
.url("https://plugins.95factory.com/api/autogradle/repository").get().build()
Request.Builder()
.addHeader("factory-api-version", "v2.0")
.url("https://plugins.95factory.com/api/autogradle/repository").get().build()
).enqueue(object : Callback {
override fun onFailure(call: Call, e: IOException) {}

override fun onResponse(call: Call, response: Response) {
Gson().fromJson<Reponse>(response.body?.string(), Reponse::class.java)?.let { result ->
Gson().fromJson<ApiResponse>(response.body?.string(), ApiResponse::class.java)?.let { result ->
originalData = result.data
bindData.clear()
bindData.addAll(result.data)
Expand Down