dev_raz_wip
Razmig Sarkissian 7 years ago
parent fc6a6887e4
commit 53d74aa8ce
  1. 2
      app/src/main/java/net/pokeranalytics/android/model/LiveData.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt
  3. 3
      app/src/main/java/net/pokeranalytics/android/ui/fragment/EditableDataFragment.kt

@ -12,7 +12,7 @@ import net.pokeranalytics.android.ui.view.Localizable
* An interface to easily handle the validity of any object we want to save
*/
interface ObjectSavable {
fun isSavable(): Boolean { return true }
fun isValidForSave(): Boolean { return true }
}
/**

@ -57,7 +57,7 @@ open class Game : RealmObject(), RowRepresentableDataSource, LiveDataDataSource,
}
}
override fun isSavable(): Boolean {
override fun isValidForSave(): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}

@ -8,7 +8,6 @@ import android.view.ViewGroup
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.recyclerview.widget.LinearLayoutManager
import io.realm.Realm
import io.realm.RealmObject
import kotlinx.android.synthetic.main.fragment_editable_data.*
import kotlinx.android.synthetic.main.fragment_editable_data.view.*
@ -85,7 +84,7 @@ class EditableDataFragment : PokerAnalyticsFragment(), RowRepresentableDelegate,
this.saveButton.text = this.saveButton.context.getString(R.string.save)
this.saveButton.setOnClickListener {
if ((this.item as ObjectSavable).isSavable()) {
if ((this.item as ObjectSavable).isValidForSave()) {
this.getRealm().executeTransaction {
it.copyToRealmOrUpdate(this.item)
}

Loading…
Cancel
Save