Make ChooseFolderActivity also return the folder ID of the selected folder
This commit is contained in:
parent
c26037c534
commit
a0d9b8be01
2 changed files with 7 additions and 3 deletions
|
@ -94,7 +94,7 @@ class ChooseFolderActivity : K9Activity() {
|
||||||
val folderListAdapter = FastAdapter.with(itemAdapter).apply {
|
val folderListAdapter = FastAdapter.with(itemAdapter).apply {
|
||||||
setHasStableIds(true)
|
setHasStableIds(true)
|
||||||
onClickListener = { _, _, item: FolderListItem, _ ->
|
onClickListener = { _, _, item: FolderListItem, _ ->
|
||||||
returnResult(item.serverId, item.displayName)
|
returnResult(item.databaseId, item.serverId, item.displayName)
|
||||||
true
|
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 {
|
val result = Intent().apply {
|
||||||
|
putExtra(RESULT_SELECTED_FOLDER_ID, folderId)
|
||||||
putExtra(RESULT_SELECTED_FOLDER, folderServerId)
|
putExtra(RESULT_SELECTED_FOLDER, folderServerId)
|
||||||
putExtra(RESULT_FOLDER_DISPLAY_NAME, displayName)
|
putExtra(RESULT_FOLDER_DISPLAY_NAME, displayName)
|
||||||
putExtra(RESULT_MESSAGE_REFERENCE, messageReference)
|
putExtra(RESULT_MESSAGE_REFERENCE, messageReference)
|
||||||
|
@ -220,7 +221,9 @@ class ChooseFolderActivity : K9Activity() {
|
||||||
private const val EXTRA_SCROLL_TO_FOLDER = "scrollToFolder"
|
private const val EXTRA_SCROLL_TO_FOLDER = "scrollToFolder"
|
||||||
private const val EXTRA_MESSAGE_REFERENCE = "messageReference"
|
private const val EXTRA_MESSAGE_REFERENCE = "messageReference"
|
||||||
private const val EXTRA_SHOW_DISPLAYABLE_ONLY = "showDisplayableOnly"
|
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 = "selectedFolder"
|
||||||
|
const val RESULT_SELECTED_FOLDER_ID = "selectedFolderId"
|
||||||
const val RESULT_FOLDER_DISPLAY_NAME = "folderDisplayName"
|
const val RESULT_FOLDER_DISPLAY_NAME = "folderDisplayName"
|
||||||
const val RESULT_MESSAGE_REFERENCE = "messageReference"
|
const val RESULT_MESSAGE_REFERENCE = "messageReference"
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,12 @@ import com.fsck.k9.ui.R
|
||||||
import com.mikepenz.fastadapter.items.AbstractItem
|
import com.mikepenz.fastadapter.items.AbstractItem
|
||||||
|
|
||||||
class FolderListItem(
|
class FolderListItem(
|
||||||
override var identifier: Long,
|
val databaseId: Long,
|
||||||
private val folderIconResource: Int,
|
private val folderIconResource: Int,
|
||||||
val displayName: String,
|
val displayName: String,
|
||||||
val serverId: String
|
val serverId: String
|
||||||
) : AbstractItem<FolderListViewHolder>() {
|
) : AbstractItem<FolderListViewHolder>() {
|
||||||
|
override var identifier = databaseId
|
||||||
|
|
||||||
override val layoutRes = R.layout.folder_list_item
|
override val layoutRes = R.layout.folder_list_item
|
||||||
override val type: Int = 1
|
override val type: Int = 1
|
||||||
|
|
Loading…
Reference in a new issue