Merge branch 'master' of gitlab.com:stax-river/poker-analytics

feature/top10
Aurelien Hubert 7 years ago
commit b677ac0377
  1. 5
      app/src/main/java/net/pokeranalytics/android/model/extensions/SessionExtensions.kt
  2. 17
      app/src/main/java/net/pokeranalytics/android/model/interfaces/Savable.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/model/realm/Bankroll.kt
  4. 5
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  5. 3
      app/src/main/java/net/pokeranalytics/android/ui/fragment/StatsFragment.kt

@ -3,11 +3,6 @@ package net.pokeranalytics.android.model.extensions
import net.pokeranalytics.android.model.realm.Session import net.pokeranalytics.android.model.realm.Session
import java.util.* import java.util.*
enum class SessionType {
CASHGAME,
TOURNAMENT
}
enum class SessionState { enum class SessionState {
PENDING, PENDING,
STARTED, STARTED,

@ -2,10 +2,19 @@ package net.pokeranalytics.android.model.interfaces
import net.pokeranalytics.android.ui.view.RowRepresentable import net.pokeranalytics.android.ui.view.RowRepresentable
interface Identifiable {
/**
* A unique identifier getter
*/
fun uniqueIdentifier(): String
}
/** /**
* An interface to easily handle the validity of any object we want to save * An interface to easily handle the validity of any object we want to save
*/ */
interface Savable { interface Savable : Identifiable {
/** /**
* A method to define if an object is safe for saving in database * A method to define if an object is safe for saving in database
*/ */
@ -14,12 +23,6 @@ interface Savable {
return true return true
} }
/**
* A unique identifier getter
*/
fun uniqueIdentifier(): String
/** /**
* a method to handle the modification of the object. * a method to handle the modification of the object.
* Through [RowRepresentable] the object is able to update the right variable with the new value. * Through [RowRepresentable] the object is able to update the right variable with the new value.

@ -48,6 +48,8 @@ open class Bankroll(name: String = "") : RealmObject(), Savable,
return this.id return this.id
} }
// Row Representable Datasource
override fun adapterRows(): ArrayList<RowRepresentable> { override fun adapterRows(): ArrayList<RowRepresentable> {
val rows = ArrayList<RowRepresentable>() val rows = ArrayList<RowRepresentable>()
rows.add(SimpleRow.NAME) rows.add(SimpleRow.NAME)

@ -27,6 +27,11 @@ import kotlin.collections.ArrayList
open class Session : RealmObject(), SessionInterface, Savable, open class Session : RealmObject(), SessionInterface, Savable,
RowRepresentableDataSource, RowRepresentable { RowRepresentableDataSource, RowRepresentable {
enum class Type {
CASH_GAME,
TOURNAMENT
}
companion object { companion object {
// Type: cash game = 0, tournament = 1 // Type: cash game = 0, tournament = 1

@ -13,7 +13,6 @@ import net.pokeranalytics.android.calculus.Calculator
import net.pokeranalytics.android.calculus.ComputedResults import net.pokeranalytics.android.calculus.ComputedResults
import net.pokeranalytics.android.calculus.SessionGroup import net.pokeranalytics.android.calculus.SessionGroup
import net.pokeranalytics.android.model.StatRepresentable import net.pokeranalytics.android.model.StatRepresentable
import net.pokeranalytics.android.model.extensions.SessionType
import net.pokeranalytics.android.model.realm.Session import net.pokeranalytics.android.model.realm.Session
import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter import net.pokeranalytics.android.ui.adapter.RowRepresentableAdapter
import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource
@ -85,7 +84,7 @@ class StatsFragment : PokerAnalyticsFragment(), RowRepresentableDataSource {
val tSessions = mutableListOf<Session>() val tSessions = mutableListOf<Session>()
allSessions.forEach { session -> allSessions.forEach { session ->
if (session.type == SessionType.CASHGAME.ordinal) { if (session.type == Session.Type.CASH_GAME.ordinal) {
cgSessions.add(session) cgSessions.add(session)
} else { } else {
tSessions.add(session) tSessions.add(session)

Loading…
Cancel
Save