Make ChooseFolderActivity also return the folder ID of the selected folder

This commit is contained in:
cketti 2020-04-25 22:18:11 +02:00
parent c26037c534
commit a0d9b8be01
2 changed files with 7 additions and 3 deletions

View file

@ -94,7 +94,7 @@ class ChooseFolderActivity : K9Activity() {
val folderListAdapter = FastAdapter.with(itemAdapter).apply {
setHasStableIds(true)
onClickListener = { _, _, item: FolderListItem, _ ->
returnResult(item.serverId, item.displayName)
returnResult(item.databaseId, item.serverId, item.displayName)
true
}
}
@ -191,8 +191,9 @@ class ChooseFolderActivity : K9Activity() {
}
}
private fun returnResult(folderServerId: String, displayName: String) {
private fun returnResult(folderId: Long, folderServerId: String, displayName: String) {
val result = Intent().apply {
putExtra(RESULT_SELECTED_FOLDER_ID, folderId)
putExtra(RESULT_SELECTED_FOLDER, folderServerId)
putExtra(RESULT_FOLDER_DISPLAY_NAME, displayName)
putExtra(RESULT_MESSAGE_REFERENCE, messageReference)
@ -220,7 +221,9 @@ class ChooseFolderActivity : K9Activity() {
private const val EXTRA_SCROLL_TO_FOLDER = "scrollToFolder"
private const val EXTRA_MESSAGE_REFERENCE = "messageReference"
private const val EXTRA_SHOW_DISPLAYABLE_ONLY = "showDisplayableOnly"
@Deprecated(message = "Use RESULT_SELECTED_FOLDER_ID instead")
const val RESULT_SELECTED_FOLDER = "selectedFolder"
const val RESULT_SELECTED_FOLDER_ID = "selectedFolderId"
const val RESULT_FOLDER_DISPLAY_NAME = "folderDisplayName"
const val RESULT_MESSAGE_REFERENCE = "messageReference"

View file

@ -8,11 +8,12 @@ import com.fsck.k9.ui.R
import com.mikepenz.fastadapter.items.AbstractItem
class FolderListItem(
override var identifier: Long,
val databaseId: Long,
private val folderIconResource: Int,
val displayName: String,
val serverId: String
) : AbstractItem<FolderListViewHolder>() {
override var identifier = databaseId
override val layoutRes = R.layout.folder_list_item
override val type: Int = 1