Update variables and function access

feature/top10
Aurelien Hubert 7 years ago
parent cb9df365cd
commit ae35ad9cc7
  1. 8
      app/src/main/java/net/pokeranalytics/android/ui/fragment/EditableDataFragment.kt

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

Loading…
Cancel
Save