Fixes double fragment issue in dialog mode

hh
Laurent 6 years ago
parent 8e1ba24a51
commit 1ed680b6ce
  1. 3
      app/src/main/java/net/pokeranalytics/android/ui/modules/datalist/DataListActivity.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/ui/modules/session/SessionFragment.kt

@ -47,14 +47,13 @@ class DataListActivity : BaseActivity() {
), FilterActivityRequestCode.SELECT_FILTER.ordinal) ), FilterActivityRequestCode.SELECT_FILTER.ordinal)
} }
fun newDialogInstance(fragment: Fragment, dataType: LiveData, selection: Boolean, itemIds: Array<String>? = null, showAddButton: Boolean = true) { fun newInstance(fragment: Fragment, dataType: LiveData, selection: Boolean, itemIds: Array<String>? = null, showAddButton: Boolean = true) {
val context = fragment.requireContext() val context = fragment.requireContext()
fragment.startActivityForResult( fragment.startActivityForResult(
getIntent( getIntent(
context, context,
dataType.ordinal, dataType.ordinal,
showAddButton = showAddButton, showAddButton = showAddButton,
dialog = true,
selection = selection, selection = selection,
itemIds = itemIds itemIds = itemIds
), RequestCode.PLAYER_SELECTION.ordinal) ), RequestCode.PLAYER_SELECTION.ordinal)

@ -400,7 +400,7 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL
when (tag) { when (tag) {
0 -> { 0 -> {
this.model.tappedPlayerPositionIndex = row.positionIndex this.model.tappedPlayerPositionIndex = row.positionIndex
DataListActivity.newDialogInstance(this, LiveData.PLAYER, true) DataListActivity.newInstance(this, LiveData.PLAYER, true)
} }
PlayerSetupRow.Tag.POSITION.ordinal -> { // 1 PlayerSetupRow.Tag.POSITION.ordinal -> { // 1
this.showPositionOptions(row.positionIndex) this.showPositionOptions(row.positionIndex)

@ -227,7 +227,7 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate {
} }
SessionRow.HANDS -> { SessionRow.HANDS -> {
val hhIds = this.currentSession.handHistories?.map { it.id }?.toTypedArray() val hhIds = this.currentSession.handHistories?.map { it.id }?.toTypedArray()
DataListActivity.newDialogInstance(this, LiveData.HAND_HISTORY, false, hhIds, false) DataListActivity.newInstance(this, LiveData.HAND_HISTORY, false, hhIds, false)
} }
else -> BottomSheetFragment.create(requireFragmentManager(), row, this, data, currentCurrency = currentSession.currency) else -> BottomSheetFragment.create(requireFragmentManager(), row, this, data, currentCurrency = currentSession.currency)
} }

Loading…
Cancel
Save