|
|
|
@ -36,6 +36,8 @@ import timber.log.Timber |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
import java.util.Currency |
|
|
|
import java.util.Currency |
|
|
|
import kotlin.collections.ArrayList |
|
|
|
import kotlin.collections.ArrayList |
|
|
|
|
|
|
|
import kotlin.properties.Delegates |
|
|
|
|
|
|
|
import kotlin.reflect.KProperty |
|
|
|
|
|
|
|
|
|
|
|
open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepresentableDataSource, RowRepresentable, |
|
|
|
open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepresentableDataSource, RowRepresentable, |
|
|
|
Timed { |
|
|
|
Timed { |
|
|
|
@ -110,6 +112,11 @@ open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepre |
|
|
|
* The start date of the break |
|
|
|
* The start date of the break |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
override var pauseDate: Date? = null |
|
|
|
override var pauseDate: Date? = null |
|
|
|
|
|
|
|
set(value) { |
|
|
|
|
|
|
|
field = value |
|
|
|
|
|
|
|
this.updateRowRepresentation() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The time frame of the Session, i.e. the start & end date |
|
|
|
// The time frame of the Session, i.e. the start & end date |
|
|
|
// var timeFrame: TimeFrame? = null |
|
|
|
// var timeFrame: TimeFrame? = null |
|
|
|
@ -186,6 +193,7 @@ open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepre |
|
|
|
} else if (this.sessionSet != null) { |
|
|
|
} else if (this.sessionSet != null) { |
|
|
|
SessionSetManager.removeFromTimeline(this) |
|
|
|
SessionSetManager.removeFromTimeline(this) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.updateRowRepresentation() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -469,7 +477,10 @@ open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepre |
|
|
|
return "Session ${this.creationDate}" |
|
|
|
return "Session ${this.creationDate}" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun adapterRows(): List<RowRepresentable>? { |
|
|
|
@Ignore |
|
|
|
|
|
|
|
private var rowRepresentationForCurrentState : List<RowRepresentable> = this.updatedRowRepresentationForCurrentState() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun updatedRowRepresentationForCurrentState(): List<RowRepresentable> { |
|
|
|
val rows = ArrayList<RowRepresentable>() |
|
|
|
val rows = ArrayList<RowRepresentable>() |
|
|
|
|
|
|
|
|
|
|
|
// Headers |
|
|
|
// Headers |
|
|
|
@ -512,16 +523,16 @@ open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepre |
|
|
|
|
|
|
|
|
|
|
|
//TODO V2: Add Bankroll variation |
|
|
|
//TODO V2: Add Bankroll variation |
|
|
|
/* |
|
|
|
/* |
|
|
|
if (!isTournament()) { |
|
|
|
if (!isTournament()) { |
|
|
|
rows.add( |
|
|
|
rows.add( |
|
|
|
HeaderRowRepresentable( |
|
|
|
HeaderRowRepresentable( |
|
|
|
RowViewType.HEADER_TITLE_VALUE, |
|
|
|
RowViewType.HEADER_TITLE_VALUE, |
|
|
|
resId = R.string.bankroll_variation, |
|
|
|
resId = R.string.bankroll_variation, |
|
|
|
computedStat = ComputedStat(Stat.HOURLY_RATE, 0.0) |
|
|
|
computedStat = ComputedStat(Stat.HOURLY_RATE, 0.0) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
rows.add(SeparatorRowRepresentable()) |
|
|
|
rows.add(SeparatorRowRepresentable()) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -534,6 +545,15 @@ open class Session : RealmObject(), SessionInterface, Manageable, StaticRowRepre |
|
|
|
return rows |
|
|
|
return rows |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fun updateRowRepresentation() { |
|
|
|
|
|
|
|
this.rowRepresentationForCurrentState = this.updatedRowRepresentationForCurrentState() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun adapterRows(): List<RowRepresentable>? { |
|
|
|
|
|
|
|
return this.rowRepresentationForCurrentState |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun boolForRow(row: RowRepresentable): Boolean { |
|
|
|
override fun boolForRow(row: RowRepresentable): Boolean { |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|
|