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

dev_raz_wip
Razmig Sarkissian 7 years ago
commit 6fccff6c9c
  1. 4
      app/src/main/AndroidManifest.xml
  2. 14
      app/src/main/java/net/pokeranalytics/android/model/realm/Bankroll.kt
  3. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/Currency.kt
  4. 11
      app/src/main/java/net/pokeranalytics/android/model/realm/CustomField.kt
  5. 13
      app/src/main/java/net/pokeranalytics/android/model/realm/Filter.kt
  6. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt
  7. 7
      app/src/main/java/net/pokeranalytics/android/model/realm/HandHistory.kt
  8. 11
      app/src/main/java/net/pokeranalytics/android/model/realm/Location.kt
  9. 7
      app/src/main/java/net/pokeranalytics/android/model/realm/Player.kt
  10. 11
      app/src/main/java/net/pokeranalytics/android/model/realm/Report.kt
  11. 43
      app/src/main/java/net/pokeranalytics/android/model/realm/Result.kt
  12. 51
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  13. 9
      app/src/main/java/net/pokeranalytics/android/model/realm/TimeFrame.kt
  14. 7
      app/src/main/java/net/pokeranalytics/android/model/realm/TimeFrameGroup.kt
  15. 6
      app/src/main/java/net/pokeranalytics/android/model/realm/TournamentFeature.kt
  16. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/TournamentName.kt
  17. 20
      app/src/main/java/net/pokeranalytics/android/model/realm/Transaction.kt
  18. 19
      app/src/main/java/net/pokeranalytics/android/model/realm/TransactionType.kt
  19. 58
      app/src/main/java/net/pokeranalytics/android/ui/adapter/components/DynamicListAdapter.kt
  20. 67
      app/src/main/java/net/pokeranalytics/android/ui/adapter/components/DynamicRowInterface.kt
  21. 19
      app/src/main/java/net/pokeranalytics/android/ui/adapter/components/RowViewType.kt
  22. 10
      app/src/main/java/net/pokeranalytics/android/ui/fragment/components/DynamicListFragment.kt

@ -21,7 +21,9 @@
</intent-filter>
</activity>
<activity android:name=".ui.activity.NewSessionActivity"/>
<activity
android:name=".ui.activity.NewSessionActivity"
android:launchMode="singleTop"/>
<activity android:name=".ui.activity.DataManagementActivity"/>
</application>

@ -2,13 +2,25 @@ package net.pokeranalytics.android.model.realm
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class Bankroll(name: String = "") : RealmObject() {
var live: Boolean = true
@PrimaryKey
var id = UUID.randomUUID().toString()
// the name of the bankroll
var name: String = name
// Indicates whether the bankroll is live or online
var live: Boolean = true
// The list of transactions of the bankroll
var transactions: RealmList<Transaction> = RealmList()
// The currency of the bankroll
var currency: Currency? = null
// @todo rate management

@ -1,11 +1,19 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class Currency : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// The currency code of the currency, i.e. USD, EUR...
var code: String? = null
// The rate of the currency with the main currency
var rate: Double? = null
}

@ -1,10 +1,19 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class CustomField : RealmObject() {
// @todo
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the currency field
var name: String = ""
// @todo
}

@ -2,19 +2,24 @@ package net.pokeranalytics.android.model.realm
import io.realm.MutableRealmInteger
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
//import net.pokeranalytics.android.FilterComponent
open class Filter : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// the filter name
var name: String = ""
// see https://realm.io/docs/java/latest/#counters
// the number of use of the filter,
// for MutableRealmInteger, see https://realm.io/docs/java/latest/#counters
val usageCount: MutableRealmInteger = MutableRealmInteger.valueOf(0)
// var components: List<FilterComponent> = listOf()
}

@ -1,10 +1,18 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class Game : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the game
var name: String = ""
// A shorter name for the game
var shortName: String? = null
}

@ -1,11 +1,16 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class HandHistory : RealmObject() {
// @todo
@PrimaryKey
var id = UUID.randomUUID().toString()
// the date of the hand history
var date: Date = Date()
}

@ -1,11 +1,22 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class Location : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the location
var name: String = ""
// the longitude of the location
var longitude: Double? = null
// the latitude of the location
var latitude: Double? = null
}

@ -1,8 +1,15 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class Player : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the player
var name: String = ""
}

@ -2,6 +2,8 @@ package net.pokeranalytics.android.model.realm
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
enum class ReportDisplay {
TABLE,
@ -10,13 +12,22 @@ enum class ReportDisplay {
}
open class Report : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the report
var name: String = ""
// The type of display of the report
var display: Int = ReportDisplay.TABLE.ordinal
// @todo define the configuration options
// var comparators: List<Int> = listOf()
// var stats: List<Int> = listOf()
// The filters associated with the report
var filters: RealmList<Filter> = RealmList()
}

@ -2,19 +2,56 @@ package net.pokeranalytics.android.model.realm
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class Result : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// the user associated to this session result
var player: Player? = null
// The buyin amount
var buyin: Double? = null
set(value) {
field = value
this.computeNet()
}
// the cashed out amount
var cashout: Double? = null
set(value) {
field = value
this.computeNet()
}
// The net result
var netResult: Double? = null
set(value) {
field = value
this.computeNet()
}
// The net (readonly)
var net: Double? = null
// The transactions associated with the Result, impacting the result
var transactions: RealmList<Transaction> = RealmList()
set(value) {
field = value
this.computeNet()
}
// @todo tips?
// The tournament final position, if applicable
var tournamentFinalPosition: Int? = null
var finalPosition: Int? = null
// Computes the Net
fun computeNet() {
// this.net = ...
}
// var player: Player? = null
// @todo tips?
}

@ -15,46 +15,71 @@ import java.util.UUID.randomUUID
open class Session(comment: String = "") : RealmObject() {
// A comment written by the user
// The date of creation of the session
@PrimaryKey
var id = UUID.randomUUID().toString()
// The time frame of the Session, i.e. the start & end date
var timeFrame: TimeFrame? = null
// The time frame group, which can contain multiple sessions
var timeFrameGroup: TimeFrameGroup? = null
// the date of creation of the app
var creationDate: Date = Date()
// The limit type: NL, PL...
var limit: Int? = null
// The number of tables played at the same time
var numberOfTables: Int = 1
// The number of players at the table
var tableSize: Int? = null
// The game played during the Session
var game: Game? = null
// The bankroll hosting the results
var bankroll: Bankroll? = null
// The hands list associated with the Session
var hands: RealmList<HandHistory> = RealmList()
var timeFrame: TimeFrame? = null
var timeFrameGroup: TimeFrameGroup? = null
// the location where the session is played
var location: Location? = null
// The result of the main user
var result: Result? = null
// The list of opponents who participated to the session
var opponents: RealmList<Player> = RealmList()
// @todo serie
// A comment written by the user
var comment: String = ""
// Blinds
// Cash Game
// The small blind value
var cgSmallBlind: Double? = null
// The big blind value
var cgBigBlind: Double? = null
// Tournament
var entryFee: Double? = null
var numberOfPlayers: Int? = null
// The entry fee of the tournament
var tournamentEntryFee: Double? = null
// The total number of players who participated in the tournament
var tournamentNumberOfPlayers: Int? = null
// The name of the tournament
var tournamentType: TournamentName? = null
// The kind of the tournament, MTT or SnG
var tournamentKind: Int? = null
// The features of the tournament, like Knockout, Shootout, Turbo...
var tournamentFeatures: RealmList<TournamentFeature> = RealmList()
}

@ -1,15 +1,24 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class TimeFrame : RealmObject() {
// A start date
var startDate: Date = Date()
// An end date
var endDate: Date? = null
// The break duration
var breakDuration: Double = 0.0
// the total duration
var duration: Double = 0.0
// indicates a state of pause
var paused: Boolean = false
}

@ -2,13 +2,20 @@ package net.pokeranalytics.android.model.realm
import io.realm.RealmList
import io.realm.RealmObject
import io.realm.annotations.Ignore
import io.realm.annotations.PrimaryKey
import java.util.*
open class TimeFrameGroup() : RealmObject() {
// The timeframe of the group, i.e. its start & end date
var timeFrame: TimeFrame? = null
// The list of Session played within the group, i.e. played within the same time frame
var timeFrames: RealmList<Session> = RealmList()
@Ignore // a duration shortcut
var duration: Double = 0.0
}

@ -1,9 +1,15 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class TournamentFeature : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the feature
var name: String = ""
}

@ -1,14 +1,16 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class TournamentName() : RealmObject() {
// constructor() : this() {
//
// }
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the tournament
var name: String = ""
}

@ -1,18 +1,26 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class Transaction : RealmObject() {
var value: Double = 0.0
@PrimaryKey
var id = UUID.randomUUID().toString()
// The amount of the transaction
var amount: Double = 0.0
// The date of the transaction
var date: Date = Date()
var comment: String? = null
// The type of the transaction
var type: TransactionType? = null
}
// A user comment
var comment: String = ""
enum class TransactionKind {
WITHDRAWAL,
DEPOSIT
}

@ -1,13 +1,30 @@
package net.pokeranalytics.android.model.realm
import io.realm.RealmObject
import io.realm.annotations.PrimaryKey
import java.util.*
open class TransactionType : RealmObject() {
@PrimaryKey
var id = UUID.randomUUID().toString()
// The name of the transaction type
var name: String = ""
// Whether or not the amount is added, or subtracted to the bankroll total
var additive: Boolean = false
// Whether or not the type can be deleted by the user
var lock: Boolean = false
// The predefined kind, if necessary, like: Withdrawal, deposit, or tips
var kind: Int? = null
}
}
enum class TransactionKind {
WITHDRAWAL,
DEPOSIT
}

@ -0,0 +1,58 @@
package net.pokeranalytics.android.ui.adapter.components
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
enum class RowType {
}
//interface RowDelegate {
//
// fun groupedRow() : ArrayList<RowGroup>()
// fun (row: DynamicRowInterface) : String
//}
class DynamicListAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
var groupedRows = ArrayList<RowGroup>()
override fun getItemViewType(position: Int): Int {
var sectionIndex: Int = 0
var rowIndex: Int = position
while (rowIndex >= this.groupedRows[sectionIndex].size + 1) {
rowIndex -= (groupedRows[sectionIndex].size + 1)
sectionIndex++
}
if (rowIndex == 0) {
return this.groupedRows[sectionIndex].viewType
} else {
return this.groupedRows[sectionIndex].rows[rowIndex - 1].viewType
}
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val rowViewType: RowViewType = RowViewType.values()[viewType]
return rowViewType.viewHolder(parent)
}
override fun getItemCount(): Int {
return this.groupedRows.size + this.groupedRows.fold(0) { acc: Int, group: RowGroup ->
return acc + group.size
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
}

@ -0,0 +1,67 @@
package net.pokeranalytics.android.ui.adapter.components
import android.content.Context
import net.pokeranalytics.android.R
class RowGroup(stringRes: Int?, rows: ArrayList<DynamicRowInterface>) : DynamicRowInterface {
var stringRes: Int? = stringRes
var rows: ArrayList<DynamicRowInterface> = rows
var size: Int = 0
get() {
return this.rows.size
}
override fun localizedTitle(context: Context): String? {
stringRes?.let {
return context.getString(it)
}
return null
}
override var viewType: Int = 0
}
interface DynamicRowInterface {
fun localizedTitle(context: Context): String?
var viewType: Int
}
enum class SessionRow(val resId: Int) : DynamicRowInterface {
BLINDS(R.string.app_name),
GAME(R.string.app_name),
DATE(R.string.app_name);
override fun localizedTitle(context: Context): String? {
return context.getString(this.resId)
}
override var viewType: Int = RowViewType.HEADER.ordinal
get() {
return when (this) {
BLINDS -> 1
GAME -> 2
DATE -> 1
}
}
}
enum class BankrollRow(val resId: Int) : DynamicRowInterface {
NAME(R.string.app_name),
LIVE(R.string.app_name),
CURRENCY(R.string.app_name);
override fun localizedTitle(context: Context): String? {
return context.getString(this.resId)
}
override var viewType: Int = 1
}

@ -0,0 +1,19 @@
package net.pokeranalytics.android.ui.adapter.components
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
enum class RowViewType {
HEADER,
TEXTFIELD;
inner class PlaceholderViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
}
fun viewHolder(parent: ViewGroup) : RecyclerView.ViewHolder {
return PlaceholderViewHolder(parent)
}
}

@ -0,0 +1,10 @@
package net.pokeranalytics.android.ui.fragment.components
import androidx.recyclerview.widget.RecyclerView
import net.pokeranalytics.android.util.PokerAnalyticsFragment
open class DynamicListFragment : PokerAnalyticsFragment() {
}
Loading…
Cancel
Save