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()
} else {
editText.clearFocus()
// if (editText.hasFocus()) {
// editText.isFocusable = false
// editText.isFocusableInTouchMode = false
// }
}
}

@ -11,21 +11,16 @@ class StraddleRowRepresentable(
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 {
val canAdd = this.selectedPositions.isEmpty()
|| this.selectedPositions.any { it.ordinal == position.ordinal + 1 || it.ordinal == position.ordinal - 1 }
if (canAdd) {
this.selectedPositions.add(position)
}
return canAdd
this.selectedPositions.add(position)
return true
}
/***
* Removes a position
* Should not let holes
* Removes a position from the straddle list
*/
fun remove(position: Position) {
this.selectedPositions.remove(position)

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

Loading…
Cancel
Save