diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt index e9b66c63..a44ca387 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt @@ -11,11 +11,13 @@ import android.widget.EditText import androidx.core.view.isVisible import androidx.recyclerview.widget.RecyclerView import com.google.android.material.chip.Chip +import kotlinx.android.synthetic.main.row_hand_action.view.* import kotlinx.android.synthetic.main.row_hhsettings_blinds.view.* import kotlinx.android.synthetic.main.row_hhsettings_player_setup.view.* import net.pokeranalytics.android.R import net.pokeranalytics.android.exceptions.PAIllegalStateException import net.pokeranalytics.android.model.handhistory.Street +import net.pokeranalytics.android.model.realm.handhistory.HandHistory import net.pokeranalytics.android.model.realm.handhistory.formatted import net.pokeranalytics.android.ui.adapter.BindableHolder import net.pokeranalytics.android.ui.adapter.RecyclerAdapter @@ -24,6 +26,7 @@ import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate import net.pokeranalytics.android.ui.extensions.px import net.pokeranalytics.android.ui.modules.handhistory.model.ComputedAction import net.pokeranalytics.android.ui.modules.handhistory.model.HHKeyboard +import net.pokeranalytics.android.ui.modules.handhistory.model.HandHistoryRow import net.pokeranalytics.android.ui.modules.handhistory.model.StraddleRowRepresentable import net.pokeranalytics.android.ui.modules.handhistory.views.PlayerCardsRow import net.pokeranalytics.android.ui.modules.handhistory.views.StreetCardsRow @@ -33,7 +36,7 @@ import net.pokeranalytics.android.ui.view.rowrepresentable.ViewIdentifier import timber.log.Timber -enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable { +enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable, HandHistoryRow { HEADER(R.layout.row_header_value), ACTION(R.layout.row_hand_action), PLAYER_SUMMARY(R.layout.row_hand_player_summary), @@ -48,6 +51,40 @@ enum class HandRowType(var layoutRes: Int) : ViewIdentifier, RowRepresentable { override val identifier: Int get() { return this.ordinal } + + override fun tagForCompletion(handHistory: HandHistory): Int? { + return when (this) { + BLINDS -> { + when { + handHistory.smallBlind == null -> 0 + handHistory.bigBlind == null -> 1 + else -> null + } + } + else -> null + } + } + + override fun keyboardForTag(tag: Int): HHKeyboard { + return when (this) { + BLINDS -> HHKeyboard.AMOUNT + else -> throw PAIllegalStateException("unmanaged tag $tag") + } + } + + override fun amountForTag(handHistory: HandHistory, tag: Int): Double? { + return when (this) { + BLINDS -> { + when (tag) { + 0 -> handHistory.smallBlind + 1 -> handHistory.bigBlind + else -> null + } + } + else -> null + } + } + } class HandHistoryAdapter( @@ -95,6 +132,41 @@ class HandHistoryAdapter( } } + inner class RowHandStraddle(itemView: View) : RowHandHolder(itemView) { + + override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { + super.onBind(position, row, adapter) + + val straddleRow = row as StraddleRowRepresentable + + itemView.positionsChipGroup.removeAllViews() + straddleRow.positions.forEach { pos -> + + val chip = Chip(itemView.context) + chip.id = View.generateViewId() +// chip.tag = filter.id + chip.text = pos.shortValue + chip.chipStartPadding = 8f.px + chip.chipEndPadding = 8f.px + + chip.isChecked = straddleRow.selectedPositions.contains(pos) + chip.setOnClickListener { + if (chip.isChecked) { + val added = straddleRow.add(pos) + chip.isChecked = added + } else { + straddleRow.remove(pos) + } + adapter.delegate?.onRowValueChanged(straddleRow.selectedPositions, row) + } + itemView.positionsChipGroup.addView(chip) + + } + + } + + } + abstract inner class RowHandHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { var currentPosition = 0 @@ -119,6 +191,52 @@ class HandHistoryAdapter( this.currentPosition = position } + protected fun toggleFocus(editText: EditText, focused: Boolean) { + if (focused) { + editText.requestFocus() + } else { + editText.clearFocus() + } + } + + open fun editTextForTag(tag: Int) : EditText { + throw PAIllegalStateException("Should overriden by class : $this") + } + + } + + inner class RowHandBlinds(itemView: View) : RowHandHolder(itemView) { + + // sb, bb, ante, bb ante + + override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { + super.onBind(position, row, adapter) + + itemView.smallBlindEditText.setText(adapter.dataSource.stringForRow(row, 0)) + itemView.bigBlindEditText.setText(adapter.dataSource.stringForRow(row, 1)) + itemView.anteEditText.setText(adapter.dataSource.stringForRow(row, 2)) + itemView.bbAnteSwitch.isChecked = adapter.dataSource.isSelected(position, row, 0) + + val sbSelected = adapter.dataSource.isSelected(position, row, 0) + toggleFocus(itemView.smallBlindEditText, sbSelected) + + val bbSelected = adapter.dataSource.isSelected(position, row, 1) + toggleFocus(itemView.bigBlindEditText, bbSelected) + + val anteSelected = adapter.dataSource.isSelected(position, row, 2) + toggleFocus(itemView.anteEditText, anteSelected) + + } + + override fun editTextForTag(tag: Int): EditText { + return when (tag) { + 0 -> itemView.smallBlindEditText + 1 -> itemView.bigBlindEditText + 2 -> itemView.anteEditText + else -> throw PAIllegalStateException("unmanaged tag $tag") + } + } + } /** @@ -161,6 +279,10 @@ class HandHistoryAdapter( } } + override fun editTextForTag(tag: Int): EditText { + return itemView.amountEditText + } + override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { super.onBind(position, row, adapter) @@ -365,57 +487,6 @@ class HandHistoryAdapter( } } - inner class RowHandBlinds(itemView: View) : RowHandHolder(itemView) { - - // sb, bb, ante, bb ante - - override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { - super.onBind(position, row, adapter) - - itemView.smallBlindEditText.setText(adapter.dataSource.stringForRow(row, 0)) - itemView.bigBlindEditText.setText(adapter.dataSource.stringForRow(row, 1)) - itemView.anteEditText.setText(adapter.dataSource.stringForRow(row, 2)) - itemView.bbAnteSwitch.isChecked = adapter.dataSource.isSelected(position, row, 0) - } - - } - - inner class RowHandStraddle(itemView: View) : RowHandHolder(itemView) { - - override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { - super.onBind(position, row, adapter) - - val straddleRow = row as StraddleRowRepresentable - - itemView.positionsChipGroup.removeAllViews() - straddleRow.positions.forEach { pos -> - - val chip = Chip(itemView.context) - chip.id = View.generateViewId() -// chip.tag = filter.id - chip.text = pos.shortValue - chip.chipStartPadding = 8f.px - chip.chipEndPadding = 8f.px - - chip.isChecked = straddleRow.selectedPositions.contains(pos) - chip.setOnClickListener { - if (chip.isChecked) { - val added = straddleRow.add(pos) - chip.isChecked = added - } else { - straddleRow.remove(pos) - } - adapter.delegate?.onRowValueChanged(straddleRow.selectedPositions, row) - } - itemView.positionsChipGroup.addView(chip) - - } - - } - - } - - inner class RowHandPlayerSetup(itemView: View) : RowHandHolder(itemView) { override fun onBind(position: Int, row: RowRepresentable, adapter: RecyclerAdapter) { diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt index 54c9e33c..c6766067 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryFragment.kt @@ -4,7 +4,6 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.EditText import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProviders import kotlinx.android.synthetic.main.fragment_hand_history.* @@ -20,18 +19,21 @@ import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate import net.pokeranalytics.android.ui.fragment.components.RealmFragment import net.pokeranalytics.android.ui.modules.handhistory.model.* import net.pokeranalytics.android.ui.modules.handhistory.views.KeyboardListener -import net.pokeranalytics.android.ui.modules.handhistory.views.PlayerCardsRow -import net.pokeranalytics.android.ui.modules.handhistory.views.StreetCardsRow import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.SmoothScrollLinearLayoutManager import net.pokeranalytics.android.util.extensions.findById -import net.pokeranalytics.android.util.extensions.noGroupingFormatted import timber.log.Timber class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardListener { + /*** + * The fragment's ViewModel + */ private lateinit var model: HandHistoryViewModel + /*** + * The custom adapter + */ private lateinit var handHistoryAdapter: HandHistoryAdapter companion object { @@ -99,18 +101,37 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL this.model.selectionLiveData.observeForever { selection -> selection?.let { - Timber.d("Current selection is ${selection.index} / ${selection.keyboard}") + Timber.d("Current selection is ${selection.index} / ${selection.tag}") - when (it.keyboard) { + val row = this.model.rowRepresentableForPosition(it.index) as HandHistoryRow + + when (row.keyboardForTag(it.tag)) { HHKeyboard.ACTION -> { val positions = this.model.positionsToAct() this.keyboard.setPositions(positions) } HHKeyboard.AMOUNT -> { - retrieveEditTextInputConnection(selection.index) + retrieveEditTextInputConnection(selection) } else -> {} } + +// when (row) { +// is ComputedAction -> { +// when (it.tag) { +// 0 -> { +// val positions = this.model.positionsToAct() +// this.keyboard.setPositions(positions) +// } +// 1 -> { +// retrieveEditTextInputConnection(selection.index) +// } +// else -> {} +// } +// } +// else -> {} +// } + } ?: run { this.keyboard.hide() } @@ -124,11 +145,15 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL // At first, the selection is defined before the holder is bound, // so we retrieve the editText inputConnection once the recycler view has been rendered this.recyclerView.viewTreeObserver.addOnGlobalLayoutListener { - this.model.selectionLiveData.value?.let { selection -> - if (selection.keyboard == HHKeyboard.AMOUNT) { - retrieveEditTextInputConnection(selection.index) + + when (this.model.currentKeyboard) { + HHKeyboard.AMOUNT -> { + val selection = this.model.currentSelection + retrieveEditTextInputConnection(selection) } + else -> {} } + } this.keyboard.keyboardListener = this @@ -136,14 +161,14 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL } - private fun retrieveEditTextInputConnection(position: Int) { + private fun retrieveEditTextInputConnection(selection: HHSelection) { - val computedAction = this.model.rowRepresentableForPosition(position) as? ComputedAction + val handRow = this.model.rowRepresentableForPosition(selection.index) as? HandRowType - val holder = recyclerView.findViewHolderForAdapterPosition(position) + val holder = recyclerView.findViewHolderForAdapterPosition(selection.index) as? HandHistoryAdapter.RowHandHolder holder?.let { - val amountEditText = it.itemView.findViewById(R.id.amountEditText) - this.keyboard.setAmountEditText(amountEditText, computedAction?.action?.amount) + val amountEditText = it.editTextForTag(selection.tag) + this.keyboard.setAmountEditText(amountEditText, handRow?.amountForTag(this.model.handHistory, selection.tag)) } ?: run { Timber.d("no holder, or not RowHandAction") } @@ -162,13 +187,18 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL private fun findNextActionToEdit(index: Int? = null) { val startIndex = index ?: this.model.currentSelection.index this.model.findSelectionForEdition(startIndex)?.let { selection -> + this.recyclerView.smoothScrollToPosition(selection.index) - if (selection.keyboard == HHKeyboard.ACTION) { - val availableActions = this.model.availableActions() - this.keyboard.setAvailableAction(availableActions) + this.model.currentKeyboard?.let { keyboard -> + when (keyboard) { + HHKeyboard.ACTION -> { + val availableActions = this.model.availableActions() + this.keyboard.setAvailableAction(availableActions) + } else -> {} + } + this.keyboard.show(keyboard) } - this.keyboard.show(selection.keyboard) } ?: run { this.keyboard.hide() @@ -195,30 +225,9 @@ class HandHistoryFragment : RealmFragment(), RowRepresentableDelegate, KeyboardL // scrolls to selected position this.recyclerView.smoothScrollToPosition(position) - val keyboard: HHKeyboard = when (row) { - is ComputedAction -> { - when (tag) { - HHKeyboard.ACTION.ordinal -> HHKeyboard.ACTION - HHKeyboard.AMOUNT.ordinal -> { - Timber.d("amount = ${row.action.amount}, toString = ${row.action.amount?.noGroupingFormatted}") - this.model.currentAmount = row.action.amount?.noGroupingFormatted - HHKeyboard.AMOUNT - } - else -> throw PAIllegalStateException("Unmanaged tag value: $tag") - } - } - is StreetCardsRow, is PlayerCardsRow -> { - HHKeyboard.CARD - } - else -> throw PAIllegalStateException("unmanaged row type: $row") - } - - this.model.selectionLiveData.value = - HHSelection( - position, - keyboard - ) + this.model.selectionLiveData.value = HHSelection(position, tag) + val keyboard = (row as HandHistoryRow).keyboardForTag(tag) if (keyboard == HHKeyboard.ACTION) { val availableActions = this.model.availableActions() this.keyboard.setAvailableAction(availableActions) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt index b5309085..c83c6c12 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ActionList.kt @@ -519,4 +519,18 @@ class ActionList(var listener: ActionListListener) : ArrayList() return streetActions.drop(index + 1).map { it.position } } + /*** + * Updates the small blind amount + */ + fun updateSmallBlind(amount: Double) { + this.firstOrNull { it.action.type == Action.Type.POST_SB }?.setAmount(amount) + } + + /*** + * Updates the big blind amount + */ + fun updateBigBlind(amount: Double) { + this.firstOrNull { it.action.type == Action.Type.POST_BB }?.setAmount(amount) + } + } diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ComputedAction.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ComputedAction.kt index fbe336b3..358428cf 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ComputedAction.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/ComputedAction.kt @@ -4,6 +4,7 @@ import net.pokeranalytics.android.exceptions.PAIllegalStateException import net.pokeranalytics.android.model.handhistory.Position import net.pokeranalytics.android.model.handhistory.Street import net.pokeranalytics.android.model.realm.handhistory.Action +import net.pokeranalytics.android.model.realm.handhistory.HandHistory import net.pokeranalytics.android.ui.modules.handhistory.HandRowType import net.pokeranalytics.android.ui.view.RowRepresentable import timber.log.Timber @@ -14,7 +15,12 @@ interface HandHistoryRow : RowRepresentable { /*** * Returns the appropriate keyboard to complete the row content */ - fun keyboardForCompletion() : HHKeyboard? + fun tagForCompletion(handHistory: HandHistory): Int? + + fun keyboardForTag(tag: Int): HHKeyboard + + fun amountForTag(handHistory: HandHistory, tag: Int): Double? { return null } + } /*** @@ -160,19 +166,31 @@ class ComputedAction(var manager: ActionManager, * All ComputedAction should have a type, so we return the action keyboard if the type is null * If the action has a type, we return the amount keyboard if the action requires one */ - override fun keyboardForCompletion() : HHKeyboard? { + override fun tagForCompletion(handHistory: HandHistory): Int? { Timber.d("index = ${action.index} / type = ${this.action.type} / amount = ${this.action.amount}") return if (this.action.type != null) { if (this.requiresAmount) { - HHKeyboard.AMOUNT + 1 } else { null } } else { - HHKeyboard.ACTION + 0 + } + } + + override fun keyboardForTag(tag: Int): HHKeyboard { + return when (tag) { + 0 -> HHKeyboard.ACTION + 1 -> HHKeyboard.AMOUNT + else -> throw PAIllegalStateException("unmanaged tag: $tag") } } + override fun amountForTag(handHistory: HandHistory, tag: Int): Double? { + return this.action.amount + } + /*** * Updates the effective amount */ diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistorySettings.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistorySettings.kt index ad9f2694..c9bf2b58 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistorySettings.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistorySettings.kt @@ -33,7 +33,7 @@ class StraddleRowRepresentable( /*** * Removes a position - * Should not let holes + * Should not let holes */ fun remove(position: Position) { this.selectedPositions.remove(position) diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt index f9073bb9..7cdde7f5 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt @@ -27,14 +27,15 @@ enum class HHKeyboard { CARD; } -class HHSelection(var index: Int, var keyboard: HHKeyboard) +class HHSelection(var index: Int, var tag: Int) class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer, ActionListListener { /*** * The hand history */ - private lateinit var handHistory: HandHistory + lateinit var handHistory: HandHistory + private set /*** * @@ -57,6 +58,15 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra val currentSelection: HHSelection get() { return selectionLiveData.value ?: throw PAIllegalStateException("No selection") } + val currentKeyboard: HHKeyboard? + get() { + this.selectionLiveData.value?.let { + val row = this.rowRepresentables[it.index] as HandHistoryRow + return row.keyboardForTag(it.tag) + } + return null + } + /*** * The current amount edited by the user */ @@ -281,12 +291,9 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra this.rowRepresentables.forEachIndexed { index, rowRepresentable -> if (index >= startIndex && rowRepresentable is HandHistoryRow) { - val foundKeyboard = rowRepresentable.keyboardForCompletion() - if (foundKeyboard != null) { - return HHSelection( - index, - foundKeyboard - ) + val tag = rowRepresentable.tagForCompletion(this.handHistory) + if (tag != null) { + return HHSelection(index, tag) } } } @@ -317,7 +324,29 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra fun amountValidated() { try { this.currentAmount?.toDouble()?.let { amount -> - this.sortedActions.setAmount(this.actionIndexForSelection, amount) + + val row = this.rowRepresentables[this.currentSelection.index] + when (row) { + HandRowType.BLINDS -> { + when (this.currentSelection.tag) { + 0 -> { + this.handHistory.smallBlind = amount + this.sortedActions.updateSmallBlind(amount) + } + 1 -> { + this.handHistory.bigBlind = amount + this.sortedActions.updateBigBlind(amount) + } + 2 -> this.handHistory.ante = amount + } + } + is ComputedAction -> { + row.setAmount(amount) + } + else -> {} + } + +// this.sortedActions.setAmount(this.actionIndexForSelection, amount) this.currentAmount = null } } catch (e: NumberFormatException) { @@ -475,13 +504,13 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra return when (row) { HandRowType.BLINDS -> { - this.handHistory.bigBlindAnte + false } is ComputedAction -> { val currentSelection = this.selectionLiveData val isSelectedIndex = (position == currentSelection.value?.index) - val isSelectedAction = (tag == currentSelection.value?.keyboard?.ordinal) - isSelectedIndex && isSelectedAction + val isSelectedTag = (tag == currentSelection.value?.tag) + isSelectedIndex && isSelectedTag } else -> false } diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt index 191206e5..0b9f7a0c 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/CardsRow.kt @@ -5,6 +5,7 @@ import net.pokeranalytics.android.exceptions.PAIllegalStateException import net.pokeranalytics.android.model.handhistory.Position import net.pokeranalytics.android.model.handhistory.Street import net.pokeranalytics.android.model.realm.handhistory.Card +import net.pokeranalytics.android.model.realm.handhistory.HandHistory import net.pokeranalytics.android.model.realm.handhistory.PlayerSetup import net.pokeranalytics.android.ui.modules.handhistory.HandRowType import net.pokeranalytics.android.ui.modules.handhistory.model.HHKeyboard @@ -14,7 +15,7 @@ interface CardHolder { val cards: RealmList } -abstract class CardsRow(var cardHolder: CardHolder?) : HandHistoryRow { +abstract class CardsRow(var cardHolder: CardHolder?) : HandHistoryRow { private val MAX_CARDS = 7 @@ -25,14 +26,18 @@ abstract class CardsRow(var cardHolder: CardHolder?) : HandHistoryRow { abstract fun cardLimit() : Int? - override fun keyboardForCompletion(): HHKeyboard? { + override fun tagForCompletion(handHistory: HandHistory): Int? { return when { - this.cardCount < cardLimit() ?: MAX_CARDS -> HHKeyboard.CARD - this.cardHolder?.cards?.lastOrNull()?.suit == null -> HHKeyboard.CARD + this.cardCount < cardLimit() ?: MAX_CARDS -> 0 + this.cardHolder?.cards?.lastOrNull()?.suit == null -> 0 else -> null } } + override fun keyboardForTag(tag: Int): HHKeyboard { + return HHKeyboard.CARD + } + fun cardAtIndex(index: Int): Card? { if (this.cardCount > index) { return this.cardHolder!!.cards[index] @@ -135,6 +140,10 @@ class StreetCardsRow(var street: Street, cardHolder: CardHolder) : CardsRow(card throw PAIllegalStateException("This cannot happen") } + override fun tagForCompletion(handHistory: HandHistory): Int? { + return this.street.ordinal + } + override fun cardLimit() : Int { return this.street.totalBoardCards } diff --git a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/KeyboardAmountView.kt b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/KeyboardAmountView.kt index 20fa9030..eb2ee43d 100644 --- a/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/KeyboardAmountView.kt +++ b/app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/views/KeyboardAmountView.kt @@ -123,7 +123,6 @@ class KeyboardAmountView(context: Context) : AbstractKeyboardView(context), this.inputConnection = it } ?: run { throw PAIllegalStateException("EditText did not return an input Connection") } - } override fun adapterRows(): List? { diff --git a/app/src/main/res/layout/row_hhsettings_blinds.xml b/app/src/main/res/layout/row_hhsettings_blinds.xml index 4527c5d6..ba319e9a 100644 --- a/app/src/main/res/layout/row_hhsettings_blinds.xml +++ b/app/src/main/res/layout/row_hhsettings_blinds.xml @@ -12,6 +12,7 @@ android:layout_weight="1" android:layout_height="wrap_content" android:gravity="center" + android:inputType="none" android:maxLines="1" />