add some comment

feature/top10
Razmig Sarkissian 7 years ago
parent a9c1516264
commit 8b55dde5f4
  1. 33
      app/src/main/java/net/pokeranalytics/android/ui/adapter/RowRepresentableDataSource.kt

@ -6,18 +6,39 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import org.w3c.dom.Text import org.w3c.dom.Text
/**
* Base Interface to provide the RowRepresentable to the adapter
*/
interface RowRepresentableDataSource: EditableDataSource, DisplayableDataSource { interface RowRepresentableDataSource: EditableDataSource, DisplayableDataSource {
/** /**
* Returns a list of rows * Returns a prebuild list of rows
*/ */
fun adapterRows(): List<out RowRepresentable>? fun adapterRows(): List<out RowRepresentable>?
/**
* Returns a [RowRepresentable] at position [Int]
*/
fun rowRepresentableForPosition(position:Int): RowRepresentable? fun rowRepresentableForPosition(position:Int): RowRepresentable?
/**
* Returns the number of [RowRepresentable] to display
*/
fun numberOfRows(): Int fun numberOfRows(): Int
/**
* Returns the ordinal value of [RowViewType] at position [Int]
*/
fun viewTypeForPosition(position:Int): Int fun viewTypeForPosition(position:Int): Int
//TODO should be removed
fun indexForRow(row: RowRepresentable): Int fun indexForRow(row: RowRepresentable): Int
} }
/**
* Interface extending [RowRepresentableDataSource] to guide the implementation of a prebuild list of [RowRepresentable]
* To do that, this interface overrides and provides a default implementation to specific methods of [RowRepresentableDataSource]
*/
interface StaticRowRepresentableDataSource: RowRepresentableDataSource { interface StaticRowRepresentableDataSource: RowRepresentableDataSource {
override fun rowRepresentableForPosition(position:Int): RowRepresentable? { override fun rowRepresentableForPosition(position:Int): RowRepresentable? {
this.adapterRows()?.let { this.adapterRows()?.let {
@ -48,12 +69,19 @@ interface StaticRowRepresentableDataSource: RowRepresentableDataSource {
} }
} }
/**
* Interface extending [RowRepresentableDataSource] to guide the implementation of a live list of [RowRepresentable]
* To do that, this interface overrides and provides a default implementation to specific methods of [RowRepresentableDataSource]
*/
interface LiveRowRepresentableDataSource: RowRepresentableDataSource { interface LiveRowRepresentableDataSource: RowRepresentableDataSource {
override fun adapterRows(): List<out RowRepresentable>? { override fun adapterRows(): List<out RowRepresentable>? {
return null return null
} }
} }
/**
* Custom class providing the value to display and how to display them
*/
class DisplayDescriptor( class DisplayDescriptor(
var boolValue: Boolean? = null, var boolValue: Boolean? = null,
var stringValue: String? = null, var stringValue: String? = null,
@ -115,6 +143,9 @@ interface DisplayableDataSource {
} }
/**
* An interface providing a way to describe how the edition of a [RowRepresentable] will be displayed
*/
interface EditableDataSource { interface EditableDataSource {
/** /**
* A list of [RowRepresentableEditDescriptor] object specifying the way the edition will be handled * A list of [RowRepresentableEditDescriptor] object specifying the way the edition will be handled

Loading…
Cancel
Save