|
|
|
|
@ -113,9 +113,11 @@ class EditorViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer |
|
|
|
|
*/ |
|
|
|
|
val currentKeyboard: HHKeyboard? |
|
|
|
|
get() { |
|
|
|
|
this.selectionLiveData.value?.let { |
|
|
|
|
val row = this.rowRepresentables[it.index] as HandHistoryRow |
|
|
|
|
return row.keyboardForTag(it.tag) |
|
|
|
|
this.selectionLiveData.value?.let { selection -> |
|
|
|
|
val row = this.rowRepresentables[selection.index] |
|
|
|
|
(row as? HandHistoryRow)?.let { hhRow -> |
|
|
|
|
return hhRow.keyboardForTag(selection.tag) |
|
|
|
|
} ?: throw PAIllegalStateException("Row $row cannot be cast to HandHistoryRow") |
|
|
|
|
} |
|
|
|
|
return null |
|
|
|
|
} |
|
|
|
|
@ -695,11 +697,11 @@ class EditorViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer |
|
|
|
|
|
|
|
|
|
// Row Representable Datasource |
|
|
|
|
|
|
|
|
|
override fun adapterRows(): List<RowRepresentable>? { |
|
|
|
|
override fun adapterRows(): List<RowRepresentable> { |
|
|
|
|
return this.rowRepresentables |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun rowRepresentableForPosition(position: Int): RowRepresentable? { |
|
|
|
|
override fun rowRepresentableForPosition(position: Int): RowRepresentable { |
|
|
|
|
return this.rowRepresentables[position] |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -859,7 +861,7 @@ class EditorViewModel : ViewModel(), RowRepresentableDataSource, CardCentralizer |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun backgroundColor(position: Int, row: RowRepresentable): Int? { |
|
|
|
|
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 { |
|
|
|
|
|