|
|
|
@ -204,32 +204,34 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val data = currentSession.editDescriptors(row) |
|
|
|
val session = this.currentSession |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val data = session.editDescriptors(row) |
|
|
|
when (row) { |
|
|
|
when (row) { |
|
|
|
SessionRow.START_DATE -> DateTimePickerManager.create(requireContext(), row, this, currentSession.startDate) |
|
|
|
SessionRow.START_DATE -> DateTimePickerManager.create(requireContext(), row, this, session.startDate) |
|
|
|
SessionRow.END_DATE -> { |
|
|
|
SessionRow.END_DATE -> { |
|
|
|
|
|
|
|
|
|
|
|
if (this.currentSession.startDate == null) { |
|
|
|
if (session.startDate == null) { |
|
|
|
Toast.makeText(context, R.string.session_missing_start_date, Toast.LENGTH_SHORT).show() |
|
|
|
Toast.makeText(context, R.string.session_missing_start_date, Toast.LENGTH_SHORT).show() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
DateTimePickerManager.create( |
|
|
|
DateTimePickerManager.create( |
|
|
|
requireContext(), |
|
|
|
requireContext(), |
|
|
|
row, |
|
|
|
row, |
|
|
|
this, |
|
|
|
this, |
|
|
|
currentSession.endDate ?: currentSession.startDate ?: Date(), |
|
|
|
session.endDate ?: session.startDate ?: Date(), |
|
|
|
currentSession.startDate |
|
|
|
session.startDate |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
SessionRow.BANKROLL -> { |
|
|
|
SessionRow.BANKROLL -> { |
|
|
|
BottomSheetFragment.create(requireFragmentManager(), row, this, data, false, currentSession.currency) |
|
|
|
BottomSheetFragment.create(requireFragmentManager(), row, this, data, false, session.currency) |
|
|
|
} |
|
|
|
} |
|
|
|
SessionRow.HANDS -> { |
|
|
|
SessionRow.HANDS -> { |
|
|
|
val hhIds = this.currentSession.handHistories?.map { it.id }?.toTypedArray() |
|
|
|
val hhIds = session.handHistories?.map { it.id }?.toTypedArray() |
|
|
|
DataListActivity.newInstance(this, LiveData.HAND_HISTORY, false, hhIds, false) |
|
|
|
DataListActivity.newInstance(this, LiveData.HAND_HISTORY, false, hhIds, false) |
|
|
|
} |
|
|
|
} |
|
|
|
else -> BottomSheetFragment.create(requireFragmentManager(), row, this, data, currentCurrency = currentSession.currency) |
|
|
|
else -> BottomSheetFragment.create(requireFragmentManager(), row, this, data, currentCurrency = session.currency) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -386,10 +388,11 @@ class SessionFragment : RealmFragment(), RowRepresentableDelegate { |
|
|
|
* Delete a session |
|
|
|
* Delete a session |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private fun deleteSession() { |
|
|
|
private fun deleteSession() { |
|
|
|
currentSession.bankroll?.id?.let { id -> |
|
|
|
Crashlytics.log("Session has been deleted") |
|
|
|
BankrollReportManager.notifyBankrollReportImpact(id) |
|
|
|
this.currentSession.bankroll?.id?.let { bankrollId -> |
|
|
|
|
|
|
|
BankrollReportManager.notifyBankrollReportImpact(bankrollId) |
|
|
|
} |
|
|
|
} |
|
|
|
currentSession.delete() |
|
|
|
this.currentSession.delete() |
|
|
|
activity?.finish() |
|
|
|
activity?.finish() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|