|
|
|
@ -16,10 +16,7 @@ import net.pokeranalytics.android.model.extensions.getState |
|
|
|
import net.pokeranalytics.android.model.interfaces.Savable |
|
|
|
import net.pokeranalytics.android.model.interfaces.Savable |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource |
|
|
|
import net.pokeranalytics.android.ui.adapter.RowRepresentableDataSource |
|
|
|
import net.pokeranalytics.android.ui.view.* |
|
|
|
import net.pokeranalytics.android.ui.view.* |
|
|
|
import net.pokeranalytics.android.util.getDuration |
|
|
|
import net.pokeranalytics.android.util.* |
|
|
|
import net.pokeranalytics.android.util.round |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.shortDateTime |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.toCurrency |
|
|
|
|
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
import kotlin.collections.ArrayList |
|
|
|
import kotlin.collections.ArrayList |
|
|
|
|
|
|
|
|
|
|
|
@ -131,6 +128,7 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
} |
|
|
|
} |
|
|
|
SessionState.PAUSED -> { |
|
|
|
SessionState.PAUSED -> { |
|
|
|
this.timeFrame?.paused = false |
|
|
|
this.timeFrame?.paused = false |
|
|
|
|
|
|
|
this.timeFrame?.pauseDate = null |
|
|
|
} |
|
|
|
} |
|
|
|
else -> { |
|
|
|
else -> { |
|
|
|
} |
|
|
|
} |
|
|
|
@ -146,6 +144,7 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
when (getState()) { |
|
|
|
when (getState()) { |
|
|
|
SessionState.STARTED -> { |
|
|
|
SessionState.STARTED -> { |
|
|
|
this.timeFrame?.paused = true |
|
|
|
this.timeFrame?.paused = true |
|
|
|
|
|
|
|
this.timeFrame?.pauseDate = Date() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -159,6 +158,7 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
when (getState()) { |
|
|
|
when (getState()) { |
|
|
|
SessionState.STARTED, SessionState.PAUSED -> { |
|
|
|
SessionState.STARTED, SessionState.PAUSED -> { |
|
|
|
this.timeFrame?.paused = false |
|
|
|
this.timeFrame?.paused = false |
|
|
|
|
|
|
|
this.timeFrame?.pauseDate = null |
|
|
|
this.timeFrame?.setDate(null, Date()) |
|
|
|
this.timeFrame?.setDate(null, Date()) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -339,6 +339,7 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
return when (row) { |
|
|
|
return when (row) { |
|
|
|
SessionRow.BANKROLL -> bankroll?.name ?: "--" |
|
|
|
SessionRow.BANKROLL -> bankroll?.name ?: "--" |
|
|
|
SessionRow.BLINDS -> getBlinds() |
|
|
|
SessionRow.BLINDS -> getBlinds() |
|
|
|
|
|
|
|
SessionRow.BREAK_TIME -> timeFrame?.breakDuration?.toMinutes() ?: "--" |
|
|
|
SessionRow.BUY_IN -> buyin.toCurrency() |
|
|
|
SessionRow.BUY_IN -> buyin.toCurrency() |
|
|
|
SessionRow.CASHED_OUT -> result?.cashout?.toCurrency() ?: "--" |
|
|
|
SessionRow.CASHED_OUT -> result?.cashout?.toCurrency() ?: "--" |
|
|
|
SessionRow.COMMENT -> if (comment.isNotEmpty()) comment else "--" |
|
|
|
SessionRow.COMMENT -> if (comment.isNotEmpty()) comment else "--" |
|
|
|
@ -387,6 +388,12 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.BREAK_TIME -> { |
|
|
|
|
|
|
|
data.add( |
|
|
|
|
|
|
|
RowRepresentableEditDescriptor("", |
|
|
|
|
|
|
|
hint = R.string.in_minutes, inputType = InputType.TYPE_CLASS_NUMBER) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
SessionRow.BUY_IN -> { |
|
|
|
SessionRow.BUY_IN -> { |
|
|
|
// Add first & second buttons values, current value & set the 2 edit texts |
|
|
|
// Add first & second buttons values, current value & set the 2 edit texts |
|
|
|
if (cgBigBlind != null) { |
|
|
|
if (cgBigBlind != null) { |
|
|
|
@ -499,6 +506,12 @@ open class Session : RealmObject(), SessionInterface, Savable, |
|
|
|
cgSmallBlind = null |
|
|
|
cgSmallBlind = null |
|
|
|
cgBigBlind = null |
|
|
|
cgBigBlind = null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SessionRow.BREAK_TIME -> { |
|
|
|
|
|
|
|
val timeFrameToUpdate = |
|
|
|
|
|
|
|
if (timeFrame != null) timeFrame as TimeFrame else realm.createObject(TimeFrame::class.java) |
|
|
|
|
|
|
|
timeFrameToUpdate.breakDuration = if (value != null) (value as String).toLong() * 60 * 1000 else 0 |
|
|
|
|
|
|
|
timeFrame = timeFrameToUpdate |
|
|
|
|
|
|
|
} |
|
|
|
SessionRow.BUY_IN -> { |
|
|
|
SessionRow.BUY_IN -> { |
|
|
|
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) |
|
|
|
val localResult = if (result != null) result as Result else realm.createObject(Result::class.java) |
|
|
|
localResult.buyin = value as Double? |
|
|
|
localResult.buyin = value as Double? |
|
|
|
|