Skip to content

Commit

Permalink
Fix #162- Bug (v1.6.11): for a project with multiple modules, it alwa…
Browse files Browse the repository at this point in the history
…ys asks on which to perform any operation
  • Loading branch information
pbreault committed Mar 17, 2024
1 parent 8d5f52f commit 9c44895
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## [[Unreleased]]

## [1.6.14] - 2024-03-17
- 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

## [1.6.13] - 2023-12-05
- Compatibility with AS Iguana Canary 16

Expand Down Expand Up @@ -196,7 +199,8 @@
- Command to clear data
- Command to clear data and restart

[Unreleased]: https://github.com/pbreault/adb-idea/compare/1.6.13...HEAD
[Unreleased]: https://github.com/pbreault/adb-idea/compare/1.6.14...HEAD
[1.6.14]: https://github.com/pbreault/adb-idea/compare/1.6.13...1.6.14
[1.6.13]: https://github.com/pbreault/adb-idea/compare/1.6.12...1.6.13
[1.6.12]: https://github.com/pbreault/adb-idea/compare/1.6.11...1.6.12
[1.6.11]: https://github.com/pbreault/adb-idea/compare/1.6.10...1.6.11
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Android Studio Version
# Get it from `list-studio-versions.sh`
ideVersion=2023.2.1.16
ideVersion=2023.2.1.23

# Minimum Intellij PLatform version supported by this plugin
# see https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.developerphil.adbidea.adb

import com.android.ddmlib.IDevice
import com.android.tools.idea.insights.isAndroidApp
import com.android.tools.idea.model.AndroidModel
import com.android.tools.idea.util.androidFacet
import com.developerphil.adbidea.adb.DeviceResult.DeviceNotFound
Expand Down Expand Up @@ -49,19 +50,17 @@ class DeviceResultFetcher constructor(
return null
}

private fun getFacet(_facets: List<AndroidFacet>): AndroidFacet? {
val facets = _facets.mapNotNull { it.holderModule.androidFacet }.distinct()
val facet: AndroidFacet?
if (facets.size > 1) {
facet = ModuleChooserDialogHelper.showDialogForFacets(project, facets)
if (facet == null) {
return null
}
private fun getFacet(facets: List<AndroidFacet>): AndroidFacet? {
val appFacets = facets
.filter { it.holderModule.isAndroidApp }
.mapNotNull { it.holderModule.androidFacet }
.distinct()

return if (appFacets.size > 1) {
ModuleChooserDialogHelper.showDialogForFacets(project, appFacets)
} else {
facet = facets[0]
appFacets[0]
}

return facet
}

private fun showDeviceChooserDialog(facet: AndroidFacet, packageName: String): DeviceResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ object ModuleChooserDialogHelper {
with(ChooseModulesDialog(project, modules, "Choose Module", "")) {
setSingleSelectionMode()
getSizeForTableContainer(preferredFocusedComponent)?.let {
setSize(it.width, it.height)
// Set the height to 0 to allow the dialog to resize itself to fit the content.
setSize(it.width, 0)
}
previousSelectedModule?.let { selectElements(listOf(it)) }
return showAndGetResult().firstOrNull()
Expand All @@ -45,10 +46,8 @@ object ModuleChooserDialogHelper {
for (table in tables) {
val tableSize = table.preferredSize
size.width = size.width.coerceAtLeast(tableSize.width)
size.height = size.height.coerceAtLeast(tableSize.height + size.height - table.parent.height)
}
size.width = 1000.coerceAtMost(600.coerceAtLeast(size.width))
size.height = 800.coerceAtMost(size.height)
size.width = size.width.coerceIn(600, 1000)
return size
}

Expand Down

0 comments on commit 9c44895

Please sign in to comment.