mirror of
https://gitee.com/zhangsken/AndroidIDE.git
synced 2026-10-16 07:49:44 +08:00
fix: file tree state is not restored on application resume
This commit is contained in:
@@ -227,11 +227,16 @@ class FileTreeFragment :
|
||||
}
|
||||
val projectDirPath = getProjectDirPath()
|
||||
val projectDir = File(projectDirPath)
|
||||
mRoot = TreeNode.root(projectDir)
|
||||
mRoot?.viewHolder = FileTreeViewHolder(context)
|
||||
mRoot = TreeNode(File(""))
|
||||
mRoot!!.viewHolder = FileTreeViewHolder(requireContext())
|
||||
|
||||
val projectRoot = TreeNode.root(projectDir)
|
||||
projectRoot.viewHolder = FileTreeViewHolder(context)
|
||||
mRoot!!.addChild(projectRoot)
|
||||
|
||||
binding!!.horizontalCroll.visibility = View.GONE
|
||||
binding!!.horizontalCroll.visibility = View.VISIBLE
|
||||
executeAsync(FileTreeCallable(context, mRoot, projectDir)) {
|
||||
executeAsync(FileTreeCallable(context, projectRoot, projectDir)) {
|
||||
if (binding == null) {
|
||||
// Fragment has been destroyed
|
||||
return@executeAsync
|
||||
@@ -252,12 +257,9 @@ class FileTreeFragment :
|
||||
}
|
||||
|
||||
private fun createTreeView(node: TreeNode?): AndroidTreeView? {
|
||||
val root = TreeNode(File(""))
|
||||
root.viewHolder = FileTreeViewHolder(requireContext())
|
||||
root.addChild(node)
|
||||
return if (context == null) {
|
||||
null
|
||||
} else AndroidTreeView(context, root, drawable.bg_ripple).also { mFileTreeView = it }
|
||||
} else AndroidTreeView(context, node, drawable.bg_ripple).also { mFileTreeView = it }
|
||||
}
|
||||
|
||||
private fun tryRestoreState(state: String? = mTreeState) {
|
||||
|
||||
Reference in New Issue
Block a user