From ce20716e8dfa54ea0190bb0d51abab64c88ac804 Mon Sep 17 00:00:00 2001 From: Grigory Rylov Date: Wed, 6 Jul 2022 12:55:35 +0300 Subject: [PATCH] v 22.07.06.0 Enable "Select parent view on next click" by default Force protocol v2 --- build.gradle | 7 ++++--- .../android/layoutinspector/parser/LayoutFileDataParser.kt | 2 +- .../com/android/layoutinspector/parser/ViewNodeParser.kt | 6 +++--- .../layoutinspector/process/LayoutInspectorCaptureTask.kt | 3 +-- .../kotlin/com/github/grishberg/android/li/PluginState.kt | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build.gradle b/build.gradle index ca557fc..ff64168 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'com.github.grishberg.android' -version '22.06.29.0' +version '22.07.06.0' sourceCompatibility = 11 targetCompatibility = 11 @@ -35,7 +35,7 @@ if (!hasProperty('studioCompilePath')) { intellij { updateSinceUntilBuild true plugins 'android' - version "212-EAP-SNAPSHOT" + version "213-EAP-SNAPSHOT" } runIde { @@ -84,6 +84,7 @@ task(verifySetup) { patchPluginXml { sinceBuild("211") changeNotes """ - Added 'Round dimensions' menu item to settings.
+ Enable "Select parent view on next click" feature by default.
+ Force use protocol level 2.
""" } diff --git a/src/main/kotlin/com/android/layoutinspector/parser/LayoutFileDataParser.kt b/src/main/kotlin/com/android/layoutinspector/parser/LayoutFileDataParser.kt index 61be033..aa309a8 100644 --- a/src/main/kotlin/com/android/layoutinspector/parser/LayoutFileDataParser.kt +++ b/src/main/kotlin/com/android/layoutinspector/parser/LayoutFileDataParser.kt @@ -44,7 +44,7 @@ object LayoutFileDataParser { ): LayoutFileData { val bufferedImage: BufferedImage? var node: ViewNode? = null - var options = LayoutInspectorCaptureOptions() + val options = LayoutInspectorCaptureOptions() var previewBytes = ByteArray(0) ObjectInputStream(ByteArrayInputStream(bytes)).use { input -> // Parse options diff --git a/src/main/kotlin/com/android/layoutinspector/parser/ViewNodeParser.kt b/src/main/kotlin/com/android/layoutinspector/parser/ViewNodeParser.kt index 9cae682..537f154 100644 --- a/src/main/kotlin/com/android/layoutinspector/parser/ViewNodeParser.kt +++ b/src/main/kotlin/com/android/layoutinspector/parser/ViewNodeParser.kt @@ -101,15 +101,15 @@ object ViewNodeParser { if (delimIndex < 0) { throw IllegalArgumentException("Invalid format for ViewNode, missing @: $data") } - var name = data.substring(0, delimIndex) + val name = data.substring(0, delimIndex) data = data.substring(delimIndex + 1) delimIndex = data.indexOf(' ') val hash = data.substring(0, delimIndex) val node = ViewNode(parent, name, hash) - node.index = if (parent == null) 0 else parent!!.children.size + node.index = parent?.children?.size ?: 0 if (data.length > delimIndex + 1) { loadProperties(node, data.substring(delimIndex + 1), skippedProperties) - node.id = node.getProperty("mID", "id")!!.value + node.id = node.getProperty("mID", "id")?.value } node.displayInfo = DisplayInfoFactory.createDisplayInfoFromNode(node) parent?.let { diff --git a/src/main/kotlin/com/github/grishberg/android/layoutinspector/process/LayoutInspectorCaptureTask.kt b/src/main/kotlin/com/github/grishberg/android/layoutinspector/process/LayoutInspectorCaptureTask.kt index 29964ac..e79a622 100644 --- a/src/main/kotlin/com/github/grishberg/android/layoutinspector/process/LayoutInspectorCaptureTask.kt +++ b/src/main/kotlin/com/github/grishberg/android/layoutinspector/process/LayoutInspectorCaptureTask.kt @@ -25,8 +25,7 @@ class LayoutInspectorCaptureTask( try { val version: ProtocolVersion = determineProtocolVersion( - client.device.version.apiLevel, - StudioFlags.LAYOUT_INSPECTOR_V2_PROTOCOL_ENABLED.get() + client.device.version.apiLevel, true ) val options = LayoutInspectorCaptureOptions() options.version = version diff --git a/src/main/kotlin/com/github/grishberg/android/li/PluginState.kt b/src/main/kotlin/com/github/grishberg/android/li/PluginState.kt index 2bad22c..fbedd7e 100644 --- a/src/main/kotlin/com/github/grishberg/android/li/PluginState.kt +++ b/src/main/kotlin/com/github/grishberg/android/li/PluginState.kt @@ -15,7 +15,7 @@ class PluginState : SettingsFacade { override var fileNamePrefix: String = "" - override var ignoreLastClickedView: Boolean = false + override var ignoreLastClickedView: Boolean = true override var roundDimensions: Boolean = true