Laurent 6 years ago
parent 2069be7188
commit 18e68c9225
  1. 11
      app/src/main/java/net/pokeranalytics/android/ui/modules/feed/FeedFragment.kt
  2. 33
      app/src/main/java/net/pokeranalytics/android/ui/modules/handhistory/model/HandHistoryViewModel.kt
  3. 2
      app/src/main/res/layout/row_hhsettings_player_setup.xml
  4. 3
      app/src/main/res/values/colors.xml

@ -392,16 +392,15 @@ class FeedFragment : FilterableFragment(), RowRepresentableDelegate {
Timber.d("date = ${it.date}, year=${it.year}, month = ${it.month}, day = ${it.dayOfMonth}") Timber.d("date = ${it.date}, year=${it.year}, month = ${it.month}, day = ${it.dayOfMonth}")
} }
var distinctDates = handHistoryFilter?.results("year", "month", "dayOfMonth") var hhDistinctDates = handHistoryFilter?.results("year", "month", "dayOfMonth")
?: run { ?: getRealm().where<HandHistory>().distinct("year", "month", "dayOfMonth").findAll()
getRealm().where<HandHistory>().distinct("year", "month", "dayOfMonth").findAll()
} hhDistinctDates = hhDistinctDates.sort("date", Sort.DESCENDING)
distinctDates = distinctDates.sort("date", Sort.DESCENDING)
this.handHistoryAdapter = this.handHistoryAdapter =
FeedHandHistoryRowRepresentableAdapter( FeedHandHistoryRowRepresentableAdapter(
this, this,
realmHandHistories, realmHandHistories,
distinctDates hhDistinctDates
) )
} }

@ -24,7 +24,6 @@ import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.CustomizableRowRepresentable
import net.pokeranalytics.android.util.extensions.formatted import net.pokeranalytics.android.util.extensions.formatted
import timber.log.Timber import timber.log.Timber
import kotlin.math.abs
import kotlin.reflect.KClass import kotlin.reflect.KClass
enum class HHKeyboard { enum class HHKeyboard {
@ -227,8 +226,8 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra
} }
rows.add(CustomizableRowRepresentable(customViewType = HandRowType.HEADER, resId = R.string.settings, value = "")) rows.add(CustomizableRowRepresentable(customViewType = HandRowType.HEADER, resId = R.string.settings, value = ""))
rows.add(HandRowType.PLAYER_NUMBER) rows.add(HandRowType.PLAYER_NUMBER)
if (this.handHistory.ante > 0) { if (this.handHistory.ante > 0) {
rows.add(HandRowType.ANTE) rows.add(HandRowType.ANTE)
} }
@ -276,19 +275,6 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra
return rows return rows
} }
override fun backgroundColor(position: Int, row: RowRepresentable): Int? {
return if (position < this.settingsRowCount) R.color.gray_darker else R.color.transparent
}
override fun arrowIcon(position: Int, row: RowRepresentable): Int? {
return when (row) {
HandRowType.SETTINGS_HEADER -> {
if (this.settingsExpanded) R.drawable.ic_arrow_up else R.drawable.ic_arrow_down
}
else -> null
}
}
private fun editionRowRepresentation(): MutableList<RowRepresentable> { private fun editionRowRepresentation(): MutableList<RowRepresentable> {
val rows: MutableList<RowRepresentable> = mutableListOf() val rows: MutableList<RowRepresentable> = mutableListOf()
@ -828,6 +814,23 @@ class HandHistoryViewModel : ViewModel(), RowRepresentableDataSource, CardCentra
} }
} }
override fun backgroundColor(position: Int, row: RowRepresentable): Int? {
return if (this.isEdited) {
if (position < this.settingsRowCount) R.color.green_header else R.color.transparent
} else {
null
}
}
override fun arrowIcon(position: Int, row: RowRepresentable): Int? {
return when (row) {
HandRowType.SETTINGS_HEADER -> {
if (this.settingsExpanded) R.drawable.ic_arrow_up else R.drawable.ic_arrow_down
}
else -> null
}
}
/*** /***
* Defines the positions having straddled and * Defines the positions having straddled and
* changes the player's actions accordingly * changes the player's actions accordingly

@ -45,6 +45,8 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_weight="1" android:layout_weight="1"
android:paddingEnd="4dp"
android:paddingStart="4dp"
android:gravity="end" android:gravity="end"
android:hint="@string/stack" android:hint="@string/stack"
android:inputType="none" android:inputType="none"

@ -24,9 +24,6 @@
<color name="green_lighter_gradient">#282e29</color> <color name="green_lighter_gradient">#282e29</color>
<color name="green_diamond_dark">#2E8148</color> <color name="green_diamond_dark">#2E8148</color>
<color name="green_darker">#212d21</color> <color name="green_darker">#212d21</color>
<color name="green_darkest">#101911</color>
<color name="green_darkest_soft">#151c15</color>
<color name="green_darkest_softer">#1b1f1b</color>
<color name="green_header">#141714</color> <color name="green_header">#141714</color>
<color name="kaki">#3b4a39</color> <color name="kaki">#3b4a39</color>

Loading…
Cancel
Save