commit
6fccff6c9c
@ -1,11 +1,19 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
|
|
||||||
open class Currency : RealmObject() { |
open class Currency : RealmObject() { |
||||||
|
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// The currency code of the currency, i.e. USD, EUR... |
||||||
var code: String? = null |
var code: String? = null |
||||||
|
|
||||||
|
// The rate of the currency with the main currency |
||||||
var rate: Double? = null |
var rate: Double? = null |
||||||
|
|
||||||
} |
} |
||||||
@ -1,10 +1,19 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
|
|
||||||
open class CustomField : RealmObject() { |
open class CustomField : RealmObject() { |
||||||
// @todo |
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// The name of the currency field |
||||||
var name: String = "" |
var name: String = "" |
||||||
|
|
||||||
|
// @todo |
||||||
|
|
||||||
|
|
||||||
} |
} |
||||||
@ -1,10 +1,18 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
open class Game : RealmObject() { |
open class Game : RealmObject() { |
||||||
|
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// The name of the game |
||||||
var name: String = "" |
var name: String = "" |
||||||
|
|
||||||
|
// A shorter name for the game |
||||||
var shortName: String? = null |
var shortName: String? = null |
||||||
|
|
||||||
} |
} |
||||||
|
|||||||
@ -1,11 +1,16 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
import java.util.* |
import java.util.* |
||||||
|
|
||||||
|
|
||||||
open class HandHistory : RealmObject() { |
open class HandHistory : RealmObject() { |
||||||
// @todo |
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// the date of the hand history |
||||||
var date: Date = Date() |
var date: Date = Date() |
||||||
|
|
||||||
} |
} |
||||||
@ -1,11 +1,22 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
|
|
||||||
open class Location : RealmObject() { |
open class Location : RealmObject() { |
||||||
|
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// The name of the location |
||||||
var name: String = "" |
var name: String = "" |
||||||
|
|
||||||
|
// the longitude of the location |
||||||
var longitude: Double? = null |
var longitude: Double? = null |
||||||
|
|
||||||
|
// the latitude of the location |
||||||
var latitude: Double? = null |
var latitude: Double? = null |
||||||
|
|
||||||
} |
} |
||||||
|
|||||||
@ -1,8 +1,15 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
open class Player : RealmObject() { |
open class Player : RealmObject() { |
||||||
|
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// The name of the player |
||||||
var name: String = "" |
var name: String = "" |
||||||
|
|
||||||
} |
} |
||||||
@ -1,15 +1,24 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
import java.util.* |
import java.util.* |
||||||
|
|
||||||
open class TimeFrame : RealmObject() { |
open class TimeFrame : RealmObject() { |
||||||
|
|
||||||
|
// A start date |
||||||
var startDate: Date = Date() |
var startDate: Date = Date() |
||||||
|
|
||||||
|
// An end date |
||||||
var endDate: Date? = null |
var endDate: Date? = null |
||||||
|
|
||||||
|
// The break duration |
||||||
var breakDuration: Double = 0.0 |
var breakDuration: Double = 0.0 |
||||||
|
|
||||||
|
// the total duration |
||||||
var duration: Double = 0.0 |
var duration: Double = 0.0 |
||||||
|
|
||||||
|
// indicates a state of pause |
||||||
var paused: Boolean = false |
var paused: Boolean = false |
||||||
|
|
||||||
} |
} |
||||||
|
|||||||
@ -1,9 +1,15 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
open class TournamentFeature : RealmObject() { |
open class TournamentFeature : RealmObject() { |
||||||
|
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// The name of the feature |
||||||
var name: String = "" |
var name: String = "" |
||||||
|
|
||||||
} |
} |
||||||
@ -1,14 +1,16 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
|
|
||||||
open class TournamentName() : RealmObject() { |
open class TournamentName() : RealmObject() { |
||||||
|
|
||||||
// constructor() : this() { |
@PrimaryKey |
||||||
// |
var id = UUID.randomUUID().toString() |
||||||
// } |
|
||||||
|
|
||||||
|
// The name of the tournament |
||||||
var name: String = "" |
var name: String = "" |
||||||
|
|
||||||
} |
} |
||||||
|
|||||||
@ -1,18 +1,26 @@ |
|||||||
package net.pokeranalytics.android.model.realm |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
import java.util.* |
import java.util.* |
||||||
|
|
||||||
|
|
||||||
open class Transaction : RealmObject() { |
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 date: Date = Date() |
||||||
var comment: String? = null |
|
||||||
|
// The type of the transaction |
||||||
var type: TransactionType? = null |
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 |
package net.pokeranalytics.android.model.realm |
||||||
|
|
||||||
import io.realm.RealmObject |
import io.realm.RealmObject |
||||||
|
import io.realm.annotations.PrimaryKey |
||||||
|
import java.util.* |
||||||
|
|
||||||
|
|
||||||
open class TransactionType : RealmObject() { |
open class TransactionType : RealmObject() { |
||||||
|
|
||||||
|
@PrimaryKey |
||||||
|
var id = UUID.randomUUID().toString() |
||||||
|
|
||||||
|
// The name of the transaction type |
||||||
var name: String = "" |
var name: String = "" |
||||||
|
|
||||||
|
// Whether or not the amount is added, or subtracted to the bankroll total |
||||||
var additive: Boolean = false |
var additive: Boolean = false |
||||||
|
|
||||||
|
// Whether or not the type can be deleted by the user |
||||||
var lock: Boolean = false |
var lock: Boolean = false |
||||||
|
|
||||||
|
// The predefined kind, if necessary, like: Withdrawal, deposit, or tips |
||||||
var kind: Int? = null |
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…
Reference in new issue