Update table size display

feature/top10
Aurelien Hubert 7 years ago
parent 664a7799bb
commit dd9142e1a3
  1. 50
      app/src/main/java/net/pokeranalytics/android/model/TableSize.kt

@ -5,32 +5,32 @@ import net.pokeranalytics.android.R
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
class TableSize(var numberOfPlayer:Int): RowRepresentable { class TableSize(var numberOfPlayer: Int) : RowRepresentable {
companion object { companion object {
val all = Array(8, init = val all = Array(9, init =
{ index -> TableSize(index+2)}) { index -> TableSize(index + 2) })
} }
override val resId: Int? override val resId: Int?
get() { get() {
return if (this.numberOfPlayer == 2) { return if (this.numberOfPlayer == 2) {
R.string.heads_up R.string.heads_up
} else { } else {
R.string.max R.string.max
} }
} }
override fun localizedTitle(context: Context): String { override fun localizedTitle(context: Context): String {
this.resId?.let { this.resId?.let {
return if (this.numberOfPlayer == 2) { return if (this.numberOfPlayer == 2) {
context.getString(it) context.getString(it)
} else { } else {
"$this.numberOfPlayer$context.getString(it)" "${this.numberOfPlayer}-${context.getString(it)}"
} }
} }
return super.localizedTitle(context) return super.localizedTitle(context)
} }
override val viewType: Int override val viewType: Int
get() = RowViewType.TITLE_GRID.ordinal get() = RowViewType.TITLE_GRID.ordinal
} }

Loading…
Cancel
Save