Honor 'scrollToFolder' argument in 'ChooseFolderActivity'
This commit is contained in:
parent
8325d2b532
commit
c1a301523d
1 changed files with 15 additions and 1 deletions
|
@ -33,6 +33,7 @@ class ChooseFolderActivity : K9Activity() {
|
|||
private val folderNameFormatter: FolderNameFormatter by inject()
|
||||
private val folderIconProvider by lazy { FolderIconProvider(theme) }
|
||||
|
||||
private lateinit var recyclerView: RecyclerView
|
||||
private lateinit var itemAdapter: ItemAdapter<FolderListItem>
|
||||
private lateinit var account: Account
|
||||
private var currentFolder: String? = null
|
||||
|
@ -87,7 +88,7 @@ class ChooseFolderActivity : K9Activity() {
|
|||
}
|
||||
}
|
||||
|
||||
val recyclerView = findViewById<RecyclerView>(R.id.folderList)
|
||||
recyclerView = findViewById(R.id.folderList)
|
||||
recyclerView.adapter = folderListAdapter
|
||||
}
|
||||
|
||||
|
@ -111,6 +112,19 @@ class ChooseFolderActivity : K9Activity() {
|
|||
.toList()
|
||||
|
||||
itemAdapter.set(folderListItems)
|
||||
|
||||
scrollToFolder(folderListItems)
|
||||
}
|
||||
|
||||
private fun scrollToFolder(folders: List<FolderListItem>) {
|
||||
if (scrollToFolder == null) return
|
||||
|
||||
val index = folders.indexOfFirst { it.serverId == scrollToFolder }
|
||||
if (index != -1) {
|
||||
recyclerView.scrollToPosition(index)
|
||||
}
|
||||
|
||||
scrollToFolder = null
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
|
|
Loading…
Reference in a new issue