Removes complications with straddle adding

hh
Laurent 6 years ago
parent 889f347969
commit 5815a36649
  1. 4
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/HandHistoryAdapter.kt
  2. 15
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/StraddleRowRepresentable.kt
  3. 10
      app/src/main/res/menu/toolbar_hand_history.xml

@ -275,10 +275,6 @@ class HandHistoryAdapter(
editText.requestFocus() editText.requestFocus()
} else { } else {
editText.clearFocus() editText.clearFocus()
// if (editText.hasFocus()) {
// editText.isFocusable = false
// editText.isFocusableInTouchMode = false
// }
} }
} }

@ -11,21 +11,16 @@ class StraddleRowRepresentable(
override val viewType: Int = HandRowType.STRADDLE.ordinal override val viewType: Int = HandRowType.STRADDLE.ordinal
/*** /***
* Tries to add a position if the position is next to another * Adds the position to the straddle selections
* Returns whether the position has been added or not
*/ */
fun add(position: Position): Boolean { fun add(position: Position): Boolean {
val canAdd = this.selectedPositions.isEmpty() this.selectedPositions.add(position)
|| this.selectedPositions.any { it.ordinal == position.ordinal + 1 || it.ordinal == position.ordinal - 1 } return true
if (canAdd) {
this.selectedPositions.add(position)
}
return canAdd
} }
/*** /***
* Removes a position * Removes a position from the straddle list
* Should not let holes
*/ */
fun remove(position: Position) { fun remove(position: Position) {
this.selectedPositions.remove(position) this.selectedPositions.remove(position)

@ -13,11 +13,11 @@
android:icon="@drawable/ic_get_app" android:icon="@drawable/ic_get_app"
app:showAsAction="always" /> app:showAsAction="always" />
<item <!-- <item-->
android:id="@+id/add" <!-- android:id="@+id/add"-->
android:title="@string/add_a_hand_history" <!-- android:title="@string/add_a_hand_history"-->
android:icon="@drawable/ic_add" <!-- android:icon="@drawable/ic_add"-->
app:showAsAction="ifRoom" /> <!-- app:showAsAction="ifRoom" />-->
<item <item
android:id="@+id/delete" android:id="@+id/delete"

Loading…
Cancel
Save