|
|
|
@ -3,13 +3,15 @@ package net.pokeranalytics.android.model.realm |
|
|
|
import io.realm.RealmObject |
|
|
|
import io.realm.RealmObject |
|
|
|
import io.realm.annotations.PrimaryKey |
|
|
|
import io.realm.annotations.PrimaryKey |
|
|
|
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.StaticRowRepresentableDataSource |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentable |
|
|
|
|
|
|
|
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow |
|
|
|
import java.util.* |
|
|
|
import java.util.* |
|
|
|
|
|
|
|
import kotlin.collections.ArrayList |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
open class TournamentType : RealmObject(), Savable, RowRepresentable { |
|
|
|
open class TournamentType : RealmObject(), Savable, StaticRowRepresentableDataSource, RowRepresentable { |
|
|
|
|
|
|
|
|
|
|
|
@PrimaryKey |
|
|
|
@PrimaryKey |
|
|
|
var id = UUID.randomUUID().toString() |
|
|
|
var id = UUID.randomUUID().toString() |
|
|
|
@ -31,4 +33,36 @@ open class TournamentType : RealmObject(), Savable, RowRepresentable { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun adapterRows(): List<RowRepresentable>? { |
|
|
|
|
|
|
|
val rows = ArrayList<RowRepresentable>() |
|
|
|
|
|
|
|
rows.add(SimpleRow.NAME) |
|
|
|
|
|
|
|
//rows.addAll(TournamentType.values()) |
|
|
|
|
|
|
|
return rows |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun stringForRow(row: RowRepresentable): String { |
|
|
|
|
|
|
|
return when (row) { |
|
|
|
|
|
|
|
SimpleRow.NAME -> this.name |
|
|
|
|
|
|
|
else -> return super.stringForRow(row) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun editDescriptors(row: RowRepresentable): ArrayList<RowRepresentableEditDescriptor> { |
|
|
|
|
|
|
|
val data = java.util.ArrayList<RowRepresentableEditDescriptor>() |
|
|
|
|
|
|
|
when (row) { |
|
|
|
|
|
|
|
SimpleRow.NAME -> data.add( |
|
|
|
|
|
|
|
RowRepresentableEditDescriptor( |
|
|
|
|
|
|
|
this.name, |
|
|
|
|
|
|
|
SimpleRow.NAME.resId |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return data |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
override fun isValidForSave(): Boolean { |
|
|
|
|
|
|
|
return this.name.isNotEmpty() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|