Skip to content

Commit ee35fd1

Browse files
committed
Merge branch 'master' of https://github.com/pbreault/adb-idea into pbreault-master
# Conflicts: # build.gradle # src/main/kotlin/com/developerphil/adbidea/adb/AdbFacade.kt # src/main/kotlin/com/developerphil/adbidea/debugger/Debugger.kt # src/main/kotlin/com/developerphil/adbidea/ui/DeviceChooserDialog.kt # src/main/kotlin/com/developerphil/adbidea/ui/NotificationHelper.kt # src/main/resources/META-INF/plugin.xml
1 parent eacce3c commit ee35fd1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+521
-412
lines changed

DEVELOP.md

+14-13
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,35 @@ Run/Debug
22
=========
33

44
* Open project in intellij
5+
* Create gradle.properties file, use [instruction](gradle.properties.change_me)
56
* Open _edit configurations_ to create a new run/debug configuration
6-
* Choose a new gradle configuration and name it `build and run` that runs <code>./gradlew buildPlugin runIdea</code>
7+
* Choose a new gradle configuration and name it `build and run` that runs `./gradlew buildPlugin runIde`
78
![Create debug configuration](website/debug_howto.png)
89
* hit debug button as usual
910

1011
Running from command line
1112
-------------------------
12-
<code>
13-
./gradlew buildPlugin runIdea
14-
</code>
13+
* Create gradle.properties file, use [instruction](gradle.properties.change_me)
14+
* Execute command
15+
```shell script
16+
./gradlew buildPlugin runIde
17+
```
1518

1619
Create new menu item
1720
====================
1821

19-
* Add entry to plugin.xml (below line 100)
20-
<code>
21-
22+
* Add entry to plugin.xml inside actions tab (below line 100)
23+
```xml
2224
<action id="com.developerphil.adbidea.action.NewAction"
2325
class="com.developerphil.adbidea.action.NewAction"
2426
text="New Action"
2527
description="Playing with the plugin">
2628
</action>
27-
</code>
29+
```
2830

2931
* Create and implement a new `NewAction` class that extends from `AdbAction` (you can create that from the plugin view, right click on the class name and choose `create class`
3032
* implement its abstract methods
31-
* add new entry in `QuickListAction.java` like this
32-
<code>
33-
34-
addAction("com.developerphil.adbidea.action.NewAction", group);
35-
</code>
33+
* add new entry in `QuickListAction.kt` like this
34+
```kotlin
35+
addAction("com.developerphil.adbidea.action.NewAction", group)
36+
```

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22

3-
ext.kotlin_version = '1.3.41'
3+
ext.kotlin_version = '1.3.61'
44

55
repositories {
66
mavenCentral()

src/main/java/com/developerphil/adbidea/ui/ApplicationManagementFrame.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void mouseClicked(MouseEvent e) {
239239
Utils.Companion.append2TextPane("Monkey test of " + name + " :\n", JBColor.BLUE,tp);
240240
}
241241
String countStr = JOptionPane.showInputDialog("Enter test count(only integers):");
242-
if (countStr.isEmpty()) {
242+
if (countStr==null||countStr.isEmpty()) {
243243
HelperMethodsKt.showErrorMsg("count can not empty");
244244
return;
245245
}

src/main/java/com/developerphil/adbidea/ui/DeviceChooserDialog.java

-154
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package com.developerphil.adbidea
2+
3+
import com.developerphil.adbidea.preference.ApplicationPreferences
4+
import com.developerphil.adbidea.preference.accessor.PreferenceAccessorImpl
5+
import com.developerphil.adbidea.ui.NotificationHelper
6+
import com.intellij.ide.plugins.PluginManager
7+
import com.intellij.ide.util.PropertiesComponent
8+
import com.intellij.openapi.components.ApplicationComponent
9+
import com.intellij.openapi.extensions.PluginId
10+
import com.intellij.util.text.SemVer
11+
12+
13+
private val pluginPackage = "com.developerphil.adbidea"
14+
15+
// This is more of a service locator than a proper DI framework.
16+
// It's not used often enough in the codebase to warrant the complexity of a DI solution like dagger.
17+
class Application : ApplicationComponent {
18+
private val applicationPreferencesAccessor = PreferenceAccessorImpl(PropertiesComponent.getInstance())
19+
private val applicationPreferences = ApplicationPreferences(applicationPreferencesAccessor)
20+
21+
override fun initComponent() {
22+
try {
23+
val version = PluginManager.getPlugin(PluginId.getId(pluginPackage))!!.version!!
24+
applicationPreferences.savePreviousPluginVersion(SemVer.parseFromText(version)!!)
25+
} catch (e: Exception) {
26+
NotificationHelper.error("Couldn't initialize ADB Idea: ${e.message}")
27+
}
28+
}
29+
}

src/main/kotlin/com/developerphil/adbidea/ObjectGraph.kt

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package com.developerphil.adbidea
22

3-
import com.developerphil.adbidea.accessor.preference.ProjectPreferenceAccessor
43
import com.developerphil.adbidea.adb.BridgeImpl
54
import com.developerphil.adbidea.adb.DeviceResultFetcher
65
import com.developerphil.adbidea.adb.UseSameDevicesHelper
6+
import com.developerphil.adbidea.preference.ProjectPreferences
7+
import com.developerphil.adbidea.preference.accessor.PreferenceAccessorImpl
8+
import com.intellij.ide.util.PropertiesComponent
79
import com.intellij.openapi.components.ProjectComponent
810
import com.intellij.openapi.project.Project
911

@@ -12,10 +14,10 @@ import com.intellij.openapi.project.Project
1214
class ObjectGraph(private val project: Project) : ProjectComponent {
1315

1416
val deviceResultFetcher by lazy { DeviceResultFetcher(project, useSameDevicesHelper, bridge) }
15-
val pluginPreferences: PluginPreferences by lazy { PluginPreferencesImpl(preferenceAccessor) }
17+
val projectPreferences: ProjectPreferences by lazy { ProjectPreferences(projectPreferenceAccessor) }
1618

17-
private val useSameDevicesHelper by lazy { UseSameDevicesHelper(pluginPreferences, bridge) }
18-
private val preferenceAccessor by lazy { ProjectPreferenceAccessor(project) }
19+
private val useSameDevicesHelper by lazy { UseSameDevicesHelper(projectPreferences, bridge) }
20+
private val projectPreferenceAccessor by lazy { PreferenceAccessorImpl(PropertiesComponent.getInstance(project)) }
1921
private val bridge by lazy { BridgeImpl(project) }
2022

2123

src/main/kotlin/com/developerphil/adbidea/PluginPreferences.kt

-28
This file was deleted.

src/main/kotlin/com/developerphil/adbidea/accessor/preference/ProjectPreferenceAccessor.kt

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.developerphil.adbidea.action
2+
3+
import com.developerphil.adbidea.adb.AdbFacade
4+
import com.developerphil.adbidea.adb.AdbUtil
5+
import com.intellij.openapi.actionSystem.AnActionEvent
6+
import com.intellij.openapi.project.Project
7+
8+
class ClearDataAndRestartWithDebuggerAction : AdbAction() {
9+
override fun actionPerformed(e: AnActionEvent, project: Project) = AdbFacade.clearDataAndRestartWithDebugger(project)
10+
11+
override fun update(e: AnActionEvent) {
12+
e.presentation.isEnabled = AdbUtil.isDebuggingAvailable
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.developerphil.adbidea.action
2+
3+
import com.developerphil.adbidea.adb.AdbFacade
4+
import com.intellij.openapi.actionSystem.AnActionEvent
5+
import com.intellij.openapi.project.Project
6+
7+
class DisableMobileAction : AdbAction() {
8+
override fun actionPerformed(e: AnActionEvent, project: Project) = AdbFacade.disableMobile(project)
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.developerphil.adbidea.action
2+
3+
import com.developerphil.adbidea.adb.AdbFacade
4+
import com.intellij.openapi.actionSystem.AnActionEvent
5+
import com.intellij.openapi.project.Project
6+
7+
class DisableWifiAction : AdbAction() {
8+
override fun actionPerformed(e: AnActionEvent, project: Project) = AdbFacade.disableWifi(project)
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.developerphil.adbidea.action
2+
3+
import com.developerphil.adbidea.adb.AdbFacade
4+
import com.intellij.openapi.actionSystem.AnActionEvent
5+
import com.intellij.openapi.project.Project
6+
7+
class EnableMobileAction : AdbAction() {
8+
override fun actionPerformed(e: AnActionEvent, project: Project) = AdbFacade.enableMobile(project)
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.developerphil.adbidea.action
2+
3+
import com.developerphil.adbidea.adb.AdbFacade
4+
import com.intellij.openapi.actionSystem.AnActionEvent
5+
import com.intellij.openapi.project.Project
6+
7+
class EnableWifiAction : AdbAction() {
8+
override fun actionPerformed(e: AnActionEvent, project: Project) = AdbFacade.enableWifi(project)
9+
}

src/main/kotlin/com/developerphil/adbidea/action/extend/ScreenRecordAction.kt

+8-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,14 @@ class ScreenRecordAction : AdbAction() {
3333
}
3434
val dialog = RecordOptionDialog { deleteRemoteFile ->
3535
saveDirChooserDescriptor.title = "Select $videoName save to..."
36-
val choose = FileChooserDialogImpl(saveDirChooserDescriptor, project)
37-
.choose(project, selectedFile)
36+
val chooserDialogImpl = FileChooserDialogImpl(saveDirChooserDescriptor, project)
37+
val choose = if (selectedFile != null) {
38+
chooserDialogImpl
39+
.choose(project, selectedFile!!)
40+
} else {
41+
chooserDialogImpl
42+
.choose(project)
43+
}
3844
if (choose.isNotEmpty()) {
3945
selectedFile = choose[0]
4046
AdbFacade.pullFile(project, remotePath, File(selectedFile?.canonicalPath, videoName), deleteRemoteFile)

0 commit comments

Comments
 (0)