|
|
|
@ -34,7 +34,9 @@ open class EditableDataFragment : PokerAnalyticsFragment(), RowRepresentableDele |
|
|
|
private var editableMenu: Menu? = null |
|
|
|
private var editableMenu: Menu? = null |
|
|
|
private var dataType: Int? = null |
|
|
|
private var dataType: Int? = null |
|
|
|
private var primaryKey: String? = null |
|
|
|
private var primaryKey: String? = null |
|
|
|
private var isUpdating = false |
|
|
|
|
|
|
|
|
|
|
|
var isUpdating = false |
|
|
|
|
|
|
|
var shouldOpenKeyboard = true |
|
|
|
|
|
|
|
|
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
|
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { |
|
|
|
return inflater.inflate(R.layout.fragment_editable_data, container, false) |
|
|
|
return inflater.inflate(R.layout.fragment_editable_data, container, false) |
|
|
|
@ -118,7 +120,7 @@ open class EditableDataFragment : PokerAnalyticsFragment(), RowRepresentableDele |
|
|
|
this.recyclerView.adapter = rowRepresentableAdapter |
|
|
|
this.recyclerView.adapter = rowRepresentableAdapter |
|
|
|
|
|
|
|
|
|
|
|
// When creating an object, open automatically the keyboard for the first row |
|
|
|
// When creating an object, open automatically the keyboard for the first row |
|
|
|
if (!isUpdating) { |
|
|
|
if (!isUpdating && shouldOpenKeyboard) { |
|
|
|
val row = dataSource.adapterRows()?.firstOrNull() |
|
|
|
val row = dataSource.adapterRows()?.firstOrNull() |
|
|
|
row?.let { |
|
|
|
row?.let { |
|
|
|
onRowSelected(0, it) |
|
|
|
onRowSelected(0, it) |
|
|
|
@ -138,7 +140,7 @@ open class EditableDataFragment : PokerAnalyticsFragment(), RowRepresentableDele |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Save data |
|
|
|
* Save data |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun saveData() { |
|
|
|
fun saveData() { |
|
|
|
if ((this.item as Savable).isValidForSave()) { |
|
|
|
if ((this.item as Savable).isValidForSave()) { |
|
|
|
this.getRealm().executeTransaction { |
|
|
|
this.getRealm().executeTransaction { |
|
|
|
val item = it.copyToRealmOrUpdate(this.item) |
|
|
|
val item = it.copyToRealmOrUpdate(this.item) |
|
|
|
|