Skip to content

Commit 9c44895

Browse files
committed
Fix #162- Bug (v1.6.11): for a project with multiple modules, it always asks on which to perform any operation
1 parent 8d5f52f commit 9c44895

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

CHANGELOG.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## [[Unreleased]]
44

5+
## [1.6.14] - 2024-03-17
6+
- Fix [#162](https://github.com/pbreault/adb-idea/issues/162) : Bug (v1.6.11): for a project with multiple modules, it always asks on which to perform any operation
7+
58
## [1.6.13] - 2023-12-05
69
- Compatibility with AS Iguana Canary 16
710

@@ -196,7 +199,8 @@
196199
- Command to clear data
197200
- Command to clear data and restart
198201

199-
[Unreleased]: https://github.com/pbreault/adb-idea/compare/1.6.13...HEAD
202+
[Unreleased]: https://github.com/pbreault/adb-idea/compare/1.6.14...HEAD
203+
[1.6.14]: https://github.com/pbreault/adb-idea/compare/1.6.13...1.6.14
200204
[1.6.13]: https://github.com/pbreault/adb-idea/compare/1.6.12...1.6.13
201205
[1.6.12]: https://github.com/pbreault/adb-idea/compare/1.6.11...1.6.12
202206
[1.6.11]: https://github.com/pbreault/adb-idea/compare/1.6.10...1.6.11

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Android Studio Version
22
# Get it from `list-studio-versions.sh`
3-
ideVersion=2023.2.1.16
3+
ideVersion=2023.2.1.23
44

55
# Minimum Intellij PLatform version supported by this plugin
66
# see https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html

src/main/kotlin/com/developerphil/adbidea/adb/DeviceResultFetcher.kt

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.developerphil.adbidea.adb
22

33
import com.android.ddmlib.IDevice
4+
import com.android.tools.idea.insights.isAndroidApp
45
import com.android.tools.idea.model.AndroidModel
56
import com.android.tools.idea.util.androidFacet
67
import com.developerphil.adbidea.adb.DeviceResult.DeviceNotFound
@@ -49,19 +50,17 @@ class DeviceResultFetcher constructor(
4950
return null
5051
}
5152

52-
private fun getFacet(_facets: List<AndroidFacet>): AndroidFacet? {
53-
val facets = _facets.mapNotNull { it.holderModule.androidFacet }.distinct()
54-
val facet: AndroidFacet?
55-
if (facets.size > 1) {
56-
facet = ModuleChooserDialogHelper.showDialogForFacets(project, facets)
57-
if (facet == null) {
58-
return null
59-
}
53+
private fun getFacet(facets: List<AndroidFacet>): AndroidFacet? {
54+
val appFacets = facets
55+
.filter { it.holderModule.isAndroidApp }
56+
.mapNotNull { it.holderModule.androidFacet }
57+
.distinct()
58+
59+
return if (appFacets.size > 1) {
60+
ModuleChooserDialogHelper.showDialogForFacets(project, appFacets)
6061
} else {
61-
facet = facets[0]
62+
appFacets[0]
6263
}
63-
64-
return facet
6564
}
6665

6766
private fun showDeviceChooserDialog(facet: AndroidFacet, packageName: String): DeviceResult {

src/main/kotlin/com/developerphil/adbidea/ui/ModuleChooserDialogHelper.kt

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ object ModuleChooserDialogHelper {
2828
with(ChooseModulesDialog(project, modules, "Choose Module", "")) {
2929
setSingleSelectionMode()
3030
getSizeForTableContainer(preferredFocusedComponent)?.let {
31-
setSize(it.width, it.height)
31+
// Set the height to 0 to allow the dialog to resize itself to fit the content.
32+
setSize(it.width, 0)
3233
}
3334
previousSelectedModule?.let { selectElements(listOf(it)) }
3435
return showAndGetResult().firstOrNull()
@@ -45,10 +46,8 @@ object ModuleChooserDialogHelper {
4546
for (table in tables) {
4647
val tableSize = table.preferredSize
4748
size.width = size.width.coerceAtLeast(tableSize.width)
48-
size.height = size.height.coerceAtLeast(tableSize.height + size.height - table.parent.height)
4949
}
50-
size.width = 1000.coerceAtMost(600.coerceAtLeast(size.width))
51-
size.height = 800.coerceAtMost(size.height)
50+
size.width = size.width.coerceIn(600, 1000)
5251
return size
5352
}
5453

0 commit comments

Comments
 (0)