Fixing tournament type values

od
Laurent 6 years ago
parent cdfbf1bf3f
commit 806376db0a
  1. 3
      app/src/main/java/net/pokeranalytics/android/ui/fragment/ImportFragment.kt
  2. 2
      app/src/main/java/net/pokeranalytics/android/util/csv/CSVImporter.kt
  3. 3
      app/src/main/java/net/pokeranalytics/android/util/csv/SessionCSVDescriptor.kt

@ -99,6 +99,9 @@ class ImportFragment : RealmFragment(), ImportDelegate {
if (exceptionMessage != null && view != null) {
val message = exceptionMessage + ". " + requireContext().getString(R.string.import_error)
val snackBar = Snackbar.make(view!!, message, Snackbar.LENGTH_INDEFINITE)
snackBar.setAction(R.string.ok) {
snackBar.dismiss()
}
val textView = snackBar.view.findViewById<TextView>(com.google.android.material.R.id.snackbar_text)
textView.maxLines = 5
snackBar.show()

@ -121,6 +121,7 @@ open class CSVImporter(istream: InputStream) {
}
if (this.descriptorFindingAttempts >= VALID_RECORD_ATTEMPTS_BEFORE_THROWING_EXCEPTION) {
realm.cancelTransaction()
realm.close()
throw ImportException("This type of file is not supported")
}
}
@ -151,6 +152,7 @@ open class CSVImporter(istream: InputStream) {
}
} ?: run {
realm.cancelTransaction()
realm.close()
throw ImportException("CSVDescriptor should never be null here")
}

@ -64,7 +64,8 @@ class SessionCSVDescriptor(source: DataSource, isTournament: Boolean?, vararg el
is SessionField.CurrencyRate -> field.format(data.bankroll?.currency?.rate)
is SessionField.SmallBlind -> field.format(data.cgSmallBlind)
is SessionField.BigBlind -> field.format(data.cgBigBlind)
is SessionField.TournamentType -> {
is SessionField.TournamentType -> field.format(data.tournamentType)
is SessionField.TournamentTypeName -> {
data.tournamentType?.let { tt ->
TournamentType.values()[tt].label
}

Loading…
Cancel
Save