|
|
|
@ -69,23 +69,21 @@ class EditableDataFragment : PokerAnalyticsFragment(), DynamicRowCallback, Botto |
|
|
|
|
|
|
|
|
|
|
|
this.dataType = SettingRow.values()[dataType] |
|
|
|
this.dataType = SettingRow.values()[dataType] |
|
|
|
val realm = Realm.getDefaultInstance() |
|
|
|
val realm = Realm.getDefaultInstance() |
|
|
|
var _item : RealmObject? = null |
|
|
|
var proxyItem : RealmObject? = null |
|
|
|
primaryKey?.let { |
|
|
|
primaryKey?.let { |
|
|
|
val t = realm.where(this.dataType.clazz()).equalTo("id", it).findFirst() |
|
|
|
val t = realm.where(this.dataType.clazz()).equalTo("id", it).findFirst() |
|
|
|
t?.let { |
|
|
|
t?.let { |
|
|
|
_item = t |
|
|
|
proxyItem = t |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
realm.beginTransaction() |
|
|
|
realm.beginTransaction() |
|
|
|
_item?.let { |
|
|
|
proxyItem?.let { |
|
|
|
this.item = realm.copyFromRealm(it) |
|
|
|
this.item = realm.copyFromRealm(it) |
|
|
|
} ?: run { |
|
|
|
} ?: run { |
|
|
|
this.item = realm.createObject(Bankroll::class.java, UUID.randomUUID().toString()) |
|
|
|
this.item = realm.createObject(Bankroll::class.java, UUID.randomUUID().toString()) |
|
|
|
} |
|
|
|
} |
|
|
|
realm.commitTransaction() |
|
|
|
realm.commitTransaction() |
|
|
|
|
|
|
|
|
|
|
|
//TODO: Crash happens here |
|
|
|
|
|
|
|
val dynamicListAdapter = DynamicListAdapter((this.item as DynamicRowDelegate), this) |
|
|
|
val dynamicListAdapter = DynamicListAdapter((this.item as DynamicRowDelegate), this) |
|
|
|
this.recyclerView.adapter = dynamicListAdapter |
|
|
|
this.recyclerView.adapter = dynamicListAdapter |
|
|
|
|
|
|
|
|
|
|
|
|