diff --git a/app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt b/app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt index 3a3fea3c..6e82814d 100644 --- a/app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt +++ b/app/src/main/java/net/pokeranalytics/android/model/realm/Game.kt @@ -11,69 +11,68 @@ import net.pokeranalytics.android.ui.view.rowrepresentable.SimpleRow import java.util.* import kotlin.collections.ArrayList -open class Game : RealmObject(), Savable, StaticRowRepresentableDataSource, - RowRepresentable { +open class Game : RealmObject(), Savable, StaticRowRepresentableDataSource, RowRepresentable { - @PrimaryKey - var id = UUID.randomUUID().toString() + @PrimaryKey + var id = UUID.randomUUID().toString() - // The name of the game - var name: String = "" + // The name of the game + var name: String = "" - // A shorter name for the game - var shortName: String? = null + // A shorter name for the game + var shortName: String? = null - override fun getDisplayName(): String { - return this.name - } + override fun getDisplayName(): String { + return this.name + } - override fun uniqueIdentifier(): String { - return this.id - } + override fun uniqueIdentifier(): String { + return this.id + } - override fun adapterRows(): List? { - val rows = ArrayList() - rows.add(SimpleRow.NAME) - rows.addAll(GameRow.values()) - return rows - } + override fun adapterRows(): List? { + val rows = ArrayList() + rows.add(SimpleRow.NAME) + rows.addAll(GameRow.values()) + return rows + } - override fun stringForRow(row: RowRepresentable): String { - return when (row) { - SimpleRow.NAME -> this.name - GameRow.SHORT_NAME -> this.shortName?:"" - else -> return super.stringForRow(row) - } - } + override fun stringForRow(row: RowRepresentable): String { + return when (row) { + SimpleRow.NAME -> this.name + GameRow.SHORT_NAME -> this.shortName ?: "" + else -> return super.stringForRow(row) + } + } - override fun editDescriptors(row: RowRepresentable): ArrayList { - val data = java.util.ArrayList() - when (row) { - SimpleRow.NAME -> data.add( - RowRepresentableEditDescriptor( - this.name, - SimpleRow.NAME.resId - ) - ) - GameRow.SHORT_NAME -> data.add( - RowRepresentableEditDescriptor( - this.shortName, - GameRow.SHORT_NAME.resId - ) - ) - } - return data - } + override fun editDescriptors(row: RowRepresentable): ArrayList { + val data = java.util.ArrayList() + when (row) { + SimpleRow.NAME -> data.add( + RowRepresentableEditDescriptor( + this.name, + SimpleRow.NAME.resId + ) + ) + GameRow.SHORT_NAME -> data.add( + RowRepresentableEditDescriptor( + this.shortName, + GameRow.SHORT_NAME.resId + ) + ) + } + return data + } - override fun updateValue(value: Any?, row: RowRepresentable) { - when (row) { - SimpleRow.NAME -> this.name = value as String? ?: "" - GameRow.SHORT_NAME -> this.shortName = value as String - } - } + override fun updateValue(value: Any?, row: RowRepresentable) { + when (row) { + SimpleRow.NAME -> this.name = value as String? ?: "" + GameRow.SHORT_NAME -> this.shortName = value as String + } + } - override fun isValidForSave(): Boolean { - return this.name.isNotEmpty() - } + override fun isValidForSave(): Boolean { + return this.name.isNotEmpty() + } }