-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from Grigory-Rylov/view_dumper
View dumper
- Loading branch information
Showing
49 changed files
with
2,104 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
src/main/kotlin/com/android/layoutinspector/GerHierarchyException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package com.android.layoutinspector | ||
|
||
class GerHierarchyException: LayoutParserException() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/main/kotlin/com/android/layoutinspector/LayoutParserException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.android.layoutinspector | ||
|
||
open class LayoutParserException : Exception { | ||
constructor() : super() | ||
|
||
constructor(message: String) : super(message) | ||
|
||
constructor(e: Throwable) : super(e) | ||
|
||
constructor(message: String, t: Throwable) : super(message) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/main/kotlin/com/android/layoutinspector/model/TreePathUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.android.layoutinspector.model | ||
|
||
import com.github.grishberg.android.layoutinspector.domain.AbstractViewNode | ||
import com.google.common.collect.Lists | ||
import javax.swing.tree.TreePath | ||
|
||
object TreePathUtils { | ||
|
||
/** Finds the path from node to the root. */ | ||
@JvmStatic | ||
fun getPath(node: AbstractViewNode): TreePath { | ||
return getPathImpl(node, null) | ||
} | ||
|
||
/** Finds the path from node to the parent. */ | ||
@JvmStatic | ||
fun getPathFromParent(node: AbstractViewNode, root: AbstractViewNode): TreePath { | ||
return getPathImpl(node, root) | ||
} | ||
|
||
private fun getPathImpl(node: AbstractViewNode, root: AbstractViewNode?): TreePath { | ||
var node: AbstractViewNode? = node | ||
val nodes = Lists.newArrayList<Any>() | ||
do { | ||
nodes.add(0, node) | ||
node = node?.parent as AbstractViewNode? | ||
} while (node != null && node !== root) | ||
if (root != null && node === root) { | ||
nodes.add(0, root) | ||
} | ||
return TreePath(nodes.toTypedArray()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.