|
|
|
@ -28,6 +28,7 @@ import net.pokeranalytics.android.model.extensions.getState |
|
|
|
import net.pokeranalytics.android.model.extensions.scheduleStopNotification |
|
|
|
import net.pokeranalytics.android.model.extensions.scheduleStopNotification |
|
|
|
import net.pokeranalytics.android.model.interfaces.SaveValidityStatus |
|
|
|
import net.pokeranalytics.android.model.interfaces.SaveValidityStatus |
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
import net.pokeranalytics.android.model.realm.* |
|
|
|
|
|
|
|
import net.pokeranalytics.android.model.realm.handhistory.HandHistory |
|
|
|
import net.pokeranalytics.android.model.utils.FavoriteSessionFinder |
|
|
|
import net.pokeranalytics.android.model.utils.FavoriteSessionFinder |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDelegate |
|
|
|
@ -255,7 +256,8 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
showBottomSheet(row, this, data, false, session.currency) |
|
|
|
showBottomSheet(row, this, data, false, session.currency) |
|
|
|
} |
|
|
|
} |
|
|
|
SessionPropertiesRow.HANDS -> { |
|
|
|
SessionPropertiesRow.HANDS -> { |
|
|
|
val hhIds = session.handHistories?.map { it.id }?.toTypedArray() |
|
|
|
val handHistories = getRealm().where(HandHistory::class.java).equalTo("session.id", session.id).findAll() |
|
|
|
|
|
|
|
val hhIds = handHistories?.map { it.id }?.toTypedArray() |
|
|
|
DataListActivity.newInstance(this, LiveData.HAND_HISTORY, false, hhIds, false) |
|
|
|
DataListActivity.newInstance(this, LiveData.HAND_HISTORY, false, hhIds, false) |
|
|
|
} |
|
|
|
} |
|
|
|
else -> showBottomSheet(row, this, data, currentCurrency = session.currency) |
|
|
|
else -> showBottomSheet(row, this, data, currentCurrency = session.currency) |
|
|
|
@ -265,7 +267,7 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { |
|
|
|
override fun onRowValueChanged(value: Any?, row: RowRepresentable) { |
|
|
|
this.sessionHasBeenUserCustomized = true |
|
|
|
this.sessionHasBeenUserCustomized = true |
|
|
|
try { |
|
|
|
try { |
|
|
|
this.currentSession.updateValue(value, row, getRealm()) |
|
|
|
this.currentSession.updateValue(value, row) |
|
|
|
this.writeChanges() |
|
|
|
this.writeChanges() |
|
|
|
} catch (e: PAIllegalStateException) { |
|
|
|
} catch (e: PAIllegalStateException) { |
|
|
|
Toast.makeText(context, e.message, Toast.LENGTH_LONG).show() |
|
|
|
Toast.makeText(context, e.message, Toast.LENGTH_LONG).show() |
|
|
|
@ -499,7 +501,10 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
|
|
|
|
|
|
|
|
val id = currentSession.id |
|
|
|
val id = currentSession.id |
|
|
|
getRealm().writeAsync { asyncRealm -> |
|
|
|
getRealm().writeAsync { asyncRealm -> |
|
|
|
asyncRealm.findById<Session>(id)?.delete() |
|
|
|
asyncRealm.findById<Session>(id)?.let { session -> |
|
|
|
|
|
|
|
session.cleanup() |
|
|
|
|
|
|
|
session.deleteFromRealm() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bankrollId?.let { |
|
|
|
bankrollId?.let { |
|
|
|
@ -549,7 +554,7 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate, StaticRowRepr |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun charSequenceForRow(row: RowRepresentable, context: Context): String { |
|
|
|
override fun charSequenceForRow(row: RowRepresentable, context: Context): String { |
|
|
|
return this.currentSession.charSequenceForRow(row, context) |
|
|
|
return this.currentSession.charSequenceForRow(row, context, getRealm()) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun actionIconForRow(row: RowRepresentable): Int? { |
|
|
|
override fun actionIconForRow(row: RowRepresentable): Int? { |
|
|
|
|