Skip to content

Commit 65c9427

Browse files
committed
downgrade kotlin version to 1.3.72.
1 parent 920241d commit 65c9427

File tree

10 files changed

+123
-145
lines changed

10 files changed

+123
-145
lines changed

build.gradle

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
plugins {
22
id 'java'
33
id 'org.jetbrains.intellij' version '1.3.0'
4-
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
4+
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
55
}
66

77
group 'io.github.bytebeats'
@@ -33,28 +33,24 @@ dependencies {
3333
intellij {
3434
pluginName = 'OkHttpAnalyzer'
3535
updateSinceUntilBuild = false
36-
// version = '2021.3'
37-
// version = '211.7628.21'
38-
// type = 'IC'
39-
// plugins = ['android']
36+
version = '211.7628.21'
37+
plugins = ['android']
4038
localPath = project.hasProperty("StudioRunPath") ? StudioRunPath : StudioCompilePath
4139
instrumentCode {
42-
compilerVersion = "213.6461.79"
43-
// compilerVersion = "211.7628.21"
40+
compilerVersion = "211.7628.21"
4441
}
4542
//
4643
instrumentTestCode {
47-
compilerVersion = "213.6461.79"
48-
// compilerVersion = "211.7628.21"
44+
compilerVersion = "211.7628.21"
4945
}
5046
}
5147

52-
//runIde {
53-
// // Absolute path to installed target 3.5 Android Studio to use as IDE Development Instance
54-
// // The "Contents" directory is macOS specific.
55-
// def dir = project.hasProperty("StudioRunPath") ? StudioRunPath : StudioCompilePath
56-
// ideDir = file(dir)
57-
//}
48+
runIde {
49+
// Absolute path to installed target 3.5 Android Studio to use as IDE Development Instance
50+
// The "Contents" directory is macOS specific.
51+
def dir = project.hasProperty("StudioRunPath") ? StudioRunPath : StudioCompilePath
52+
ideDir = file(dir)
53+
}
5854

5955
compileKotlin {
6056
kotlinOptions.jvmTarget = "1.8"

gradle.copy.properties

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copy this file as gradle.properties
2+
# It will be used for both compiling and running the adb-idea plugin.
3+
4+
5+
# Path to a downloaded instance of Android Studio
6+
# This is used to add the android plugin dependencies to the project.
7+
# must point to the latest version of Android Studio.
8+
# You'll know it's right if you can find "$StudioCompilePath/lib/idea.jar"
9+
#StudioCompilePath=/Applications/Android Studio.app/Contents
10+
StudioCompilePath=/Users/tiger/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401/Android Studio.app/Contents
11+
12+
13+
# Determines which IDE to run when using the "./gradlew runIdea" command.
14+
# This is useful to test the plugin on older versions of Android Studio or Intellij
15+
# Default value: $StudioCompilePath
16+
#StudioRunPath=/Applications/Android Studio.app/Contents
17+
StudioRunPath=/Users/tiger/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/211.7628.21.2111.8193401/Android Studio.app/Contents

src/main/java/me/bytebeats/asp/analyzer/MainForm.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public class MainForm {
2929
private JPanel panel;
3030
private JComboBox<DebugDevice> deviceList;
3131
private JComboBox<DebugProcess> appList;
32+
private JComboBox<String> methodList;
3233
private JPanel mainContainer;
3334
private JEditorPane initialHtml;
3435
private JPanel buttonContainer;
35-
private JComboBox<String> methodList;
3636
private JTextField keywordFilter;
3737
private final JButton scrollToBottomButton;
3838
private final JButton clearButton;
@@ -47,20 +47,23 @@ public MainForm() {
4747
donateButton = new JButton();
4848
donateButton.setPreferredSize(new Dimension(30, 30));
4949
donateButton.setIcon(ResourcesKt.getIcon("donate.png"));
50+
donateButton.setToolTipText(ResourcesKt.getString("donate"));
5051
GridBagConstraints donateButtonConstraints = new GridBagConstraints();
5152
donateButtonConstraints.gridx = 1;
5253
donateButtonConstraints.gridy = 0;
5354

5455
scrollToBottomButton = new JButton();
5556
scrollToBottomButton.setIcon(ResourcesKt.getIcon("scroll.png"));
5657
scrollToBottomButton.setPreferredSize(new Dimension(30, 30));
58+
scrollToBottomButton.setToolTipText(ResourcesKt.getString("scroll_to_bottom"));
5759
GridBagConstraints scrollConstraints = new GridBagConstraints();
5860
scrollConstraints.gridx = 2;
5961
scrollConstraints.gridy = 0;
6062

6163
clearButton = new JButton();
6264
clearButton.setPreferredSize(new Dimension(30, 30));
6365
clearButton.setIcon(ResourcesKt.getIcon("delete.png"));
66+
clearButton.setToolTipText(ResourcesKt.getString("clear"));
6467
GridBagConstraints clearConstraints = new GridBagConstraints();
6568
clearConstraints.gridx = 3;
6669
clearConstraints.gridy = 0;
@@ -160,7 +163,6 @@ public void updateMethodList(String method) {
160163
if (!methods.contains(method)) {
161164
methods.add(method);
162165
methodList.setModel(new DefaultComboBoxModel<>(new Vector<>(methods)));
163-
methodList.addItemListener(methodItemListener);
164166
}
165167
}
166168
}

src/main/kotlin/me/bytebeats/asp/analyzer/AdbManager.kt

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import me.bytebeats.asp.analyzer.data.RequestDataSource
1212
import me.bytebeats.asp.analyzer.enums.MessageType
1313
import me.bytebeats.asp.analyzer.util.TAG_DELIMITER
1414
import me.bytebeats.asp.analyzer.util.TAG_KEY
15+
import me.bytebeats.asp.analyzer.util.info
1516
import me.bytebeats.asp.analyzer.view.FormViewManager
1617
import org.jetbrains.android.sdk.AndroidSdkUtils
1718
import java.awt.event.ActionEvent
@@ -57,8 +58,8 @@ class AdbManager(
5758
val debugRequest = RequestDataSource.getRequestFromMessage(id, messageType, line.message)
5859
if (debugRequest != null) {
5960
try {
60-
mainForm.updateMethodList(debugRequest.method)
6161
SwingUtilities.invokeLater {
62+
mainForm.updateMethodList(debugRequest.method)
6263
requestTableManager.insertOrUpdate(debugRequest)
6364
}
6465
} catch (e: Exception) {
@@ -73,6 +74,10 @@ class AdbManager(
7374

7475
init {
7576
initDeviceList(project)
77+
initMethodList()
78+
}
79+
80+
private fun initMethodList() {
7681
mainForm.setMethodItemListener {
7782
if (it.stateChange == ItemEvent.SELECTED) {
7883
requestTableManager.methodFilter = mainForm.methodList.selectedItem as String
@@ -88,36 +93,36 @@ class AdbManager(
8893
private fun initDeviceList(project: Project) {
8994
AndroidDebugBridge.addDeviceChangeListener(object : AndroidDebugBridge.IDeviceChangeListener {
9095
override fun deviceChanged(device: IDevice?, p1: Int) {
91-
log("deviceChanged $device")
96+
info("deviceChanged $device")
9297
device?.let {
9398
attachToDevice(it)
9499
}
95100
}
96101

97102
override fun deviceConnected(device: IDevice?) {
98-
log("deviceConnected $device")
103+
info("deviceConnected $device")
99104
updateDeviceList(AndroidDebugBridge.getBridge()?.devices)
100105
}
101106

102107
override fun deviceDisconnected(device: IDevice?) {
103-
log("deviceDisconnected $device")
108+
info("deviceDisconnected $device")
104109
updateDeviceList(AndroidDebugBridge.getBridge()?.devices)
105110
}
106111
})
107112
AndroidDebugBridge.addDebugBridgeChangeListener {
108113
val devices = it?.devices
109114
if (devices?.isNotEmpty() == true) {
110-
log("addDebugBridgeChangeListener $it")
115+
info("addDebugBridgeChangeListener $it")
111116
updateDeviceList(devices)
112117
} else {
113-
log("addDebugBridgeChangeListener EMPTY $it and connected ${it?.isConnected}")
118+
info("addDebugBridgeChangeListener EMPTY $it and connected ${it?.isConnected}")
114119
}
115120
}
116121
AndroidDebugBridge.addClientChangeListener { client: Client?, _: Int ->
117122
updateClient(client)
118123
}
119124
val bridge0: AndroidDebugBridge? = AndroidSdkUtils.getDebugBridge(project)
120-
log("initDeviceList bridge0 ${bridge0?.isConnected}")
125+
info("initDeviceList bridge0 ${bridge0?.isConnected}")
121126
}
122127

123128
private fun updateClient(client: Client?) {
@@ -128,7 +133,7 @@ class AdbManager(
128133
for (i in 0 until clientModel.size) {
129134
val model = clientModel.getElementAt(i)
130135
if (model.pid == clientData.pid) {
131-
log("updateClient ${clientData.pid}")
136+
info("updateClient ${clientData.pid}")
132137
model.process = clientData.packageName
133138
model.clientDescription = clientData.clientDescription
134139
if (model.getClientKey() == prefSelectedPackage) {
@@ -144,7 +149,7 @@ class AdbManager(
144149
}
145150

146151
private fun updateDeviceList(devices: Array<IDevice>?) {
147-
log("updateDeviceList ${devices?.size}")
152+
info("updateDeviceList ${devices?.size}")
148153
val selectedDeviceName = preferences.selectedDevice
149154
var selectedDevice: IDevice? = null
150155
if (devices != null) {
@@ -161,7 +166,7 @@ class AdbManager(
161166
list.model = model
162167
list.addItemListener {
163168
if (it.stateChange == ItemEvent.SELECTED) {
164-
log("Selected ${list.selectedItem}")
169+
info("Selected ${list.selectedItem}")
165170
val device = list.selectedItem as DebugDevice
166171
attachToDevice(device.device)
167172
preferences.selectedDevice = device.device.name
@@ -186,21 +191,21 @@ class AdbManager(
186191
}
187192

188193
private fun createProcessList(device: IDevice) {
189-
val prefSelectedPackage = preferences.selectedProcess
194+
val prefSelectedProcess = preferences.selectedProcess
190195
var defaultSelection: DebugProcess? = null
191196
val debugProcessList = ArrayList<DebugProcess>()
192-
log("createProcessList ${device.clients.size}")
197+
info("createProcessList ${device.clients.size}")
193198
for (client in device.clients) {
194199
val clientData = client.clientData
195200
val process = DebugProcess(
196201
clientData.pid,
197202
clientData.packageName,
198203
clientData.clientDescription
199204
)
200-
if (prefSelectedPackage == process.getClientKey()) {
205+
if (prefSelectedProcess == process.getClientKey()) {
201206
defaultSelection = process
202207
}
203-
log("addClient $process")
208+
info("addClient $process")
204209
debugProcessList.add(process)
205210
}
206211
val model = DefaultComboBoxModel(debugProcessList.toTypedArray())
@@ -211,7 +216,7 @@ class AdbManager(
211216
preferences.selectedProcess = client.getClientKey()
212217
defaultSelection = client
213218
selectedProcess = client
214-
log("selectedProcess $defaultSelection")
219+
info("selectedProcess $defaultSelection")
215220
requestTableManager.clear()
216221
// requestTableManager.addAll(RequestDataSource.r(client.getClientKey()))
217222
mainForm.resetMethodList()
@@ -226,12 +231,8 @@ class AdbManager(
226231
}
227232

228233

229-
private fun log(text: String) {
230-
println(text)
231-
}
232-
233234
private fun setListener(device: IDevice) {
234-
log(device.toString())
235+
info(device.toString())
235236
val prevDevice = selectedDevice
236237
if (prevDevice != null) {
237238
logcatService.removeListener(prevDevice, logcatListener)

src/main/kotlin/me/bytebeats/asp/analyzer/Preferences.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package me.bytebeats.asp.analyzer
22

33
import com.intellij.ide.util.PropertiesComponent
44
import me.bytebeats.asp.analyzer.util.SELECTED_DEVICE
5+
import me.bytebeats.asp.analyzer.util.SELECTED_METHOD
56
import me.bytebeats.asp.analyzer.util.SELECTED_PID
67
import me.bytebeats.asp.analyzer.util.SELECTED_TAB
78

@@ -32,4 +33,10 @@ class Preferences(private val properties: PropertiesComponent) {
3233
set(value) {
3334
properties.setValue(SELECTED_TAB, value)
3435
}
36+
37+
var selectedMethod: String?
38+
get() = properties.getValue(SELECTED_METHOD)
39+
set(value) {
40+
properties.setValue(SELECTED_METHOD, value)
41+
}
3542
}

src/main/kotlin/me/bytebeats/asp/analyzer/util/Consts.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const val BUNDLE_STRINGS = "strings"
1616
const val SELECTED_DEVICE = "selected_device"
1717
const val SELECTED_PID = "selected_pid"
1818
const val SELECTED_TAB = "selected_tab"
19+
const val SELECTED_METHOD = "selected_method"
1920
const val NEW_LINE = "\r\n"
2021
const val SPACE = " "
2122

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package me.bytebeats.asp.analyzer.util
2+
3+
import com.intellij.notification.NotificationGroup
4+
import com.intellij.notification.NotificationType
5+
import com.intellij.openapi.project.ex.ProjectManagerEx
6+
7+
8+
/**
9+
* @Author bytebeats
10+
* @Email <[email protected]>
11+
* @Github https://github.com/bytebeats
12+
* @Created at 2022/3/4 14:50
13+
* @Version 1.0
14+
* @Description TO-DO
15+
*/
16+
private const val NOTIFICATION_TITLE = "OkHttp Analyzer"
17+
private val LOG_NOTIFICATION_GROUP = NotificationGroup.logOnlyGroup("$NOTIFICATION_TITLE Log")
18+
private val BALLOON_NOTIFICATION_GROUP = NotificationGroup.balloonGroup("$NOTIFICATION_TITLE Balloon")
19+
private val TOOL_WINDOW_NOTIFICATION_GROUP =
20+
NotificationGroup.toolWindowGroup("$NOTIFICATION_TITLE Tool Window", "$NOTIFICATION_TITLE Tool Window")
21+
22+
/**
23+
* messages on Event Log Window
24+
*
25+
* @param message
26+
*/
27+
fun info(message: String) {
28+
LOG_NOTIFICATION_GROUP.createNotification(NOTIFICATION_TITLE, message, NotificationType.INFORMATION, null)
29+
.notify(ProjectManagerEx.getInstance().defaultProject)
30+
}
31+
32+
/**
33+
* messages on Event Log Window in balloon style
34+
*
35+
* @param message
36+
*/
37+
fun infoBalloon(message: String) {
38+
BALLOON_NOTIFICATION_GROUP.createNotification(NOTIFICATION_TITLE, message, NotificationType.WARNING, null)
39+
.notify(ProjectManagerEx.getInstance().defaultProject)
40+
}
41+
42+
/**
43+
* messages on Tool Window
44+
*
45+
* @param message
46+
*/
47+
fun infoToolWindow(message: String) {
48+
TOOL_WINDOW_NOTIFICATION_GROUP.createNotification(NOTIFICATION_TITLE, message, NotificationType.ERROR, null)
49+
.notify(ProjectManagerEx.getInstance().defaultProject)
50+
}

0 commit comments

Comments
 (0)