Refactor RowViewType & add SeparatorRow

feature/top10
Aurelien Hubert 7 years ago
parent c23f61199c
commit a2f4e1145b
  1. 8
      app/src/main/java/net/pokeranalytics/android/model/realm/Session.kt
  2. 6
      app/src/main/java/net/pokeranalytics/android/ui/fragment/HistoryFragment.kt
  3. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/RowRepresentable.kt
  4. 292
      app/src/main/java/net/pokeranalytics/android/ui/view/RowViewType.kt
  5. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/LocationRow.kt
  6. 11
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SeparatorRowRepresentable.kt
  7. 4
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SessionRow.kt
  8. 2
      app/src/main/java/net/pokeranalytics/android/ui/view/rowrepresentable/SettingRow.kt
  9. 4
      app/src/main/res/layout/row_bottom_sheet_title.xml
  10. 2
      app/src/main/res/layout/row_header_title.xml
  11. 6
      app/src/main/res/layout/row_header_title_amount.xml
  12. 10
      app/src/main/res/layout/row_header_title_amount_big.xml
  13. 6
      app/src/main/res/layout/row_header_title_value.xml
  14. 4
      app/src/main/res/layout/row_title.xml
  15. 4
      app/src/main/res/layout/row_title_arrow.xml
  16. 8
      app/src/main/res/layout/row_title_switch.xml
  17. 8
      app/src/main/res/layout/row_title_value.xml
  18. 14
      app/src/main/res/layout/row_title_value_action.xml

@ -21,6 +21,7 @@ import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor import net.pokeranalytics.android.ui.view.RowRepresentableEditDescriptor
import net.pokeranalytics.android.ui.view.RowViewType import net.pokeranalytics.android.ui.view.RowViewType
import net.pokeranalytics.android.ui.view.rowrepresentable.HeaderRowRepresentable import net.pokeranalytics.android.ui.view.rowrepresentable.HeaderRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.SeparatorRowRepresentable
import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow import net.pokeranalytics.android.ui.view.rowrepresentable.SessionRow
import net.pokeranalytics.android.util.* import net.pokeranalytics.android.util.*
import java.util.* import java.util.*
@ -303,6 +304,9 @@ open class Session : RealmObject(), SessionInterface, Savable,
return 0.0 return 0.0
} }
@Ignore
override val viewType: Int = RowViewType.ROW_SESSION.ordinal
override fun uniqueIdentifier(): String { override fun uniqueIdentifier(): String {
return this.id return this.id
} }
@ -323,6 +327,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
title = getDuration(), value = result?.net.toString() title = getDuration(), value = result?.net.toString()
) )
) )
rows.add(SeparatorRowRepresentable())
} }
SessionState.PAUSED -> { SessionState.PAUSED -> {
rows.add( rows.add(
@ -331,6 +336,7 @@ open class Session : RealmObject(), SessionInterface, Savable,
resId = R.string.pause, value = result?.net.toString() resId = R.string.pause, value = result?.net.toString()
) )
) )
rows.add(SeparatorRowRepresentable())
} }
SessionState.FINISHED -> { SessionState.FINISHED -> {
rows.add( rows.add(
@ -356,6 +362,8 @@ open class Session : RealmObject(), SessionInterface, Savable,
) )
) )
} }
rows.add(SeparatorRowRepresentable())
} }
else -> { else -> {
} }

@ -165,11 +165,7 @@ class HistoryFragment : PokerAnalyticsFragment(), LiveRowRepresentableDataSource
} }
override fun viewTypeForPosition(position: Int): Int { override fun viewTypeForPosition(position: Int): Int {
return if (rows[position].viewType == RowViewType.HEADER_TITLE.ordinal) { return rows[position].viewType
RowViewType.HEADER_TITLE.ordinal
} else {
RowViewType.ROW_SESSION.ordinal
}
} }
override fun indexForRow(row: RowRepresentable): Int { override fun indexForRow(row: RowRepresentable): Int {

@ -27,7 +27,7 @@ interface Displayable : Localizable {
*/ */
val viewType: Int val viewType: Int
get() { get() {
return 0 return -1
} }

@ -7,17 +7,8 @@ import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView import androidx.appcompat.widget.AppCompatTextView
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import kotlinx.android.synthetic.main.row_bottom_sheet_grid_title.view.*
import kotlinx.android.synthetic.main.row_bottom_sheet_title.view.*
import kotlinx.android.synthetic.main.row_header_title.view.*
import kotlinx.android.synthetic.main.row_header_title_amount.view.*
import kotlinx.android.synthetic.main.row_header_title_value.view.*
import kotlinx.android.synthetic.main.row_history_session.view.* import kotlinx.android.synthetic.main.row_history_session.view.*
import kotlinx.android.synthetic.main.row_stats_title_value.view.* import kotlinx.android.synthetic.main.row_stats_title_value.view.*
import kotlinx.android.synthetic.main.row_title.view.*
import kotlinx.android.synthetic.main.row_title_switch.view.*
import kotlinx.android.synthetic.main.row_title_value.view.*
import kotlinx.android.synthetic.main.row_title_value_action.view.*
import net.pokeranalytics.android.R import net.pokeranalytics.android.R
import net.pokeranalytics.android.calculus.ComputedStat import net.pokeranalytics.android.calculus.ComputedStat
import net.pokeranalytics.android.calculus.Stat import net.pokeranalytics.android.calculus.Stat
@ -35,10 +26,12 @@ interface BindableHolder {
enum class RowViewType { enum class RowViewType {
HEADER_TITLE,
HEADER_TITLE_VALUE, HEADER_TITLE_VALUE,
HEADER_TITLE_AMOUNT, HEADER_TITLE_AMOUNT,
HEADER_TITLE_AMOUNT_BIG, HEADER_TITLE_AMOUNT_BIG,
HEADER_TITLE,
EDIT_TEXT, EDIT_TEXT,
TITLE, TITLE,
TITLE_ARROW, TITLE_ARROW,
@ -49,101 +42,104 @@ enum class RowViewType {
BOTTOM_SHEET_DATA, BOTTOM_SHEET_DATA,
TITLE_GRID, TITLE_GRID,
ROW_SESSION, ROW_SESSION,
BUTTON, ROW_BUTTON,
FOLLOW_US, ROW_FOLLOW_US,
STAT; STAT,
SEPARATOR;
/** /**
* View holder * View holder
*/ */
fun viewHolder(parent: ViewGroup): RecyclerView.ViewHolder { fun viewHolder(parent: ViewGroup): RecyclerView.ViewHolder {
return when (this) { return when (this) {
HEADER_TITLE_VALUE -> HeaderTitleValueViewHolder(
// Header Row View Holder
HEADER_TITLE -> {
HeaderViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_header_title_value, R.layout.row_header_title,
parent, parent,
false false
) )
) )
HEADER_TITLE_AMOUNT -> HeaderTitleAmountViewHolder( }
HEADER_TITLE_VALUE -> HeaderViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_header_title_amount, R.layout.row_header_title_value,
parent, parent,
false false
) )
) )
HEADER_TITLE_AMOUNT_BIG -> HeaderTitleAmountViewHolder( HEADER_TITLE_AMOUNT -> HeaderViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_header_title_amount_big, R.layout.row_header_title_amount,
parent, parent,
false false
) )
) )
TITLE -> TitleViewHolder( HEADER_TITLE_AMOUNT_BIG -> HeaderViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_title, R.layout.row_header_title_amount_big,
parent, parent,
false false
) )
) )
TITLE_ARROW -> TitleViewHolder(
// Row View Holder
TITLE -> RowViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_title_arrow, R.layout.row_title,
parent, parent,
false false
) )
) )
TITLE_VALUE -> TitleValueViewHolder( TITLE_ARROW -> RowViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_title_value, R.layout.row_title_arrow,
parent, parent,
false false
) )
) )
TITLE_GRID -> TitleGridSessionViewHolder( TITLE_GRID -> RowViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_bottom_sheet_grid_title, R.layout.row_bottom_sheet_grid_title,
parent, parent,
false false
) )
) )
TITLE_SWITCH -> TitleSwitchViewHolder( DATA -> RowViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(R.layout.row_title, parent, false)
R.layout.row_title_switch,
parent,
false
) )
BOTTOM_SHEET_DATA -> RowViewHolder(
LayoutInflater.from(parent.context).inflate(R.layout.row_bottom_sheet_title, parent, false)
) )
TITLE_VALUE_ACTION -> TitleValueActionViewHolder( //TODO: Manage action
TITLE_VALUE_ACTION -> RowViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_title_value_action, R.layout.row_title_value_action,
parent, parent,
false false
) )
) )
DATA -> DataViewHolder( //TODO: Manage switch
TITLE_SWITCH -> RowViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_title, R.layout.row_title_switch,
parent,
false
)
)
BOTTOM_SHEET_DATA -> BottomSheetDataViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.row_bottom_sheet_title,
parent, parent,
false false
) )
) )
HEADER_TITLE -> { //TODO: Update layout container to ConstraintLayout and remove separator
HeaderSessionViewHolder( TITLE_VALUE -> RowViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_header_title, R.layout.row_title_value,
parent, parent,
false false
) )
) )
}
// Row Session
ROW_SESSION -> RowSessionViewHolder( ROW_SESSION -> RowSessionViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_history_session, R.layout.row_history_session,
@ -151,8 +147,10 @@ enum class RowViewType {
false false
) )
) )
BUTTON -> {
ButtonViewHolder( // Row Button
ROW_BUTTON -> {
RowButtonViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_button, R.layout.row_button,
parent, parent,
@ -160,8 +158,9 @@ enum class RowViewType {
) )
) )
} }
FOLLOW_US -> { // Row Follow Us
FollowUsViewHolder( ROW_FOLLOW_US -> {
RowFollowUsViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_follow_us, R.layout.row_follow_us,
parent, parent,
@ -169,6 +168,8 @@ enum class RowViewType {
) )
) )
} }
// Row Stat
STAT -> StatsTitleValueViewHolder( STAT -> StatsTitleValueViewHolder(
LayoutInflater.from(parent.context).inflate( LayoutInflater.from(parent.context).inflate(
R.layout.row_stats_title_value, R.layout.row_stats_title_value,
@ -176,75 +177,86 @@ enum class RowViewType {
false false
) )
) )
// Separator
SEPARATOR -> SeparatorViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.row_separator,
parent,
false
)
)
else -> throw Exception("Undefined rowViewType's holder") else -> throw Exception("Undefined rowViewType's holder")
} }
} }
inner class HeaderTitleValueViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowHeaderTitleValue_title.text = row.localizedTitle(itemView.context)
adapter.dataSource.let {
itemView.rowHeaderTitleValue_value.text = it.stringForRow(row, itemView.context)
}
//val listener = View.OnClickListener {
// adapter.delegate?.onRowSelected(position, row)
//}
//itemView.rowHeaderTitleValue_container.setOnClickListener(listener)
itemView.rowHeaderTitleValue_separator.visibility = if (row.needSeparator) View.VISIBLE else View.GONE
}
}
inner class HeaderTitleAmountViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), /**
BindableHolder { * Display a header
*/
inner class HeaderViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
if (row is HeaderRowRepresentable) { if (row is HeaderRowRepresentable) {
if (row.resId != null) { // Title
itemView.rowHeaderTitleAmount_title.text = row.localizedTitle(itemView.context) itemView.findViewById<AppCompatTextView>(R.id.title)?.let {
} else if (row.title != null) { it.text = row.localizedTitle(itemView.context)
itemView.rowHeaderTitleAmount_title.text = row.title
} }
// Value
itemView.findViewById<FormattedTextView?>(R.id.value)?.let {
val value = try { val value = try {
row.value?.toDouble() ?: 0.0 row.value?.toDouble() ?: 0.0
} catch (e: Exception) { } catch (e: Exception) {
0.0 0.0
} }
//TODO: Manage multiple stat type
val stat = ComputedStat(Stat.NETRESULT, value) val stat = ComputedStat(Stat.NETRESULT, value)
itemView.rowHeaderTitleAmount_value.textFormat = stat.format(itemView.context) it.textFormat = stat.format(itemView.context)
//it.text = adapter.dataSource.stringForRow(row, itemView.context)
}
} }
} }
} }
inner class TitleViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), /**
BindableHolder { * Display a generic row (title, value, container)
*/
inner class RowViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowTitle_title.text = row.localizedTitle(itemView.context)
val listener = View.OnClickListener { // Title
adapter.delegate?.onRowSelected(position, row) itemView.findViewById<AppCompatTextView?>(R.id.title)?.let {
} if (row.resId != null) {
itemView.rowTitle_container.setOnClickListener(listener) it.text = row.localizedTitle(itemView.context)
} else {
it.text = row.getDisplayName()
} }
} }
inner class TitleValueViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), // Value
BindableHolder { itemView.findViewById<AppCompatTextView?>(R.id.value)?.let {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { it.text = adapter.dataSource.stringForRow(row, itemView.context)
itemView.rowTitleValue_title.text = row.localizedTitle(itemView.context)
adapter.dataSource?.let {
itemView.rowTitleValue_value.text = it.stringForRow(row, itemView.context)
} }
// Listener
val listener = View.OnClickListener { val listener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, row) adapter.delegate?.onRowSelected(position, row)
} }
itemView.rowTitleValue_container.setOnClickListener(listener)
itemView.rowTitleValue_separator.visibility = if (row.needSeparator) View.VISIBLE else View.GONE itemView.findViewById<View?>(R.id.container)?.let {
it.setOnClickListener(listener)
}
} }
} }
inner class FollowUsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { /**
* Display a follow us row
*/
inner class RowFollowUsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.findViewById<AppCompatImageView>(R.id.icon1).setOnClickListener { itemView.findViewById<AppCompatImageView>(R.id.icon1).setOnClickListener {
adapter.delegate?.onRowSelected(0, row) adapter.delegate?.onRowSelected(0, row)
@ -261,6 +273,9 @@ enum class RowViewType {
} }
} }
/**
* Display a stat
*/
inner class StatsTitleValueViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), inner class StatsTitleValueViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
BindableHolder { BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
@ -277,83 +292,10 @@ enum class RowViewType {
} }
} }
inner class TitleGridSessionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { /**
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { * Display a button in a row
itemView.title.text = row.localizedTitle(itemView.context) */
val listener = View.OnClickListener { inner class RowButtonViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
adapter.delegate?.onRowSelected(position, row)
}
itemView.container.setOnClickListener(listener)
}
}
inner class TitleSwitchViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowTitleSwitch_title.text = row.localizedTitle(itemView.context)
adapter.dataSource.let {
itemView.rowTitleSwitch_switch.isChecked = it.boolForRow(row)
itemView.rowTitleSwitch_switch.setOnCheckedChangeListener { buttonView, isChecked ->
adapter.delegate?.onRowValueChanged(isChecked, row)
}
}
val listener = View.OnClickListener {
itemView.rowTitleSwitch_switch.isChecked = !itemView.rowTitleSwitch_switch.isChecked
}
itemView.rowTitleSwitch_container.setOnClickListener(listener)
itemView.rowTitleSwitch_separator.visibility = if (row.needSeparator) View.VISIBLE else View.GONE
}
}
inner class TitleValueActionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowTitleValueAction_title.text = row.localizedTitle(itemView.context)
adapter.dataSource.let { rowDelegate ->
val value = rowDelegate.stringForRow(row, itemView.context)
itemView.rowTitleValueAction_value.text = value
itemView.rowTitleValueAction_action.visibility = if (value == "--") View.GONE else View.VISIBLE
rowDelegate.actionIconForRow(row)?.let { icon ->
itemView.rowTitleValueAction_action.setImageResource(icon)
}
}
val listener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, row)
}
val actionListener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, row, true)
}
itemView.rowTitleValueAction_container.setOnClickListener(listener)
itemView.rowTitleValueAction_action.setOnClickListener(actionListener)
}
}
inner class DataViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowTitle_title.text = row.getDisplayName()
val listener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, row)
}
itemView.rowTitle_container.setOnClickListener(listener)
}
}
inner class BottomSheetDataViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.rowBottomSheet_title.text = row.getDisplayName()
val listener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, row)
}
itemView.rowBottomSheet_container.setOnClickListener(listener)
}
}
inner class ButtonViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.findViewById<AppCompatTextView>(R.id.title).text = row.localizedTitle(itemView.context) itemView.findViewById<AppCompatTextView>(R.id.title).text = row.localizedTitle(itemView.context)
val listener = View.OnClickListener { val listener = View.OnClickListener {
@ -363,26 +305,26 @@ enum class RowViewType {
} }
} }
inner class HeaderSessionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), /**
BindableHolder { * Display a session view
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { */
itemView.sessionHeaderTitle.text = row.localizedTitle(itemView.context) inner class RowSessionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
}
}
inner class RowSessionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView),
BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
itemView.sessionRow.setData(row as Session) itemView.sessionRow.setData(row as Session)
val listener = View.OnClickListener { val listener = View.OnClickListener {
adapter.delegate?.onRowSelected(position, row) adapter.delegate?.onRowSelected(position, row)
} }
itemView.sessionRow.setOnClickListener(listener) itemView.sessionRow.setOnClickListener(listener)
} }
} }
/**
* Display a separator
*/
inner class SeparatorViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder {
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) {
}
}
} }

@ -22,7 +22,7 @@ enum class LocationRow : RowRepresentable {
get() { get() {
return when (this) { return when (this) {
ADDRESS -> RowViewType.TITLE_VALUE.ordinal ADDRESS -> RowViewType.TITLE_VALUE.ordinal
LOCATE_ME -> RowViewType.BUTTON.ordinal LOCATE_ME -> RowViewType.ROW_BUTTON.ordinal
} }
} }

@ -0,0 +1,11 @@
package net.pokeranalytics.android.ui.view.rowrepresentable
import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType
/**
* A class to display separator as row representable
*/
class SeparatorRowRepresentable(customViewType: RowViewType? = RowViewType.SEPARATOR) : RowRepresentable {
override val viewType: Int = customViewType?.ordinal ?: RowViewType.SEPARATOR.ordinal
}

@ -49,7 +49,9 @@ enum class SessionRow : RowRepresentable {
SessionState.STARTED, SessionState.PAUSED, SessionState.FINISHED -> { SessionState.STARTED, SessionState.PAUSED, SessionState.FINISHED -> {
arrayListOf( arrayListOf(
PRIZE, BUY_IN, POSITION, PLAYERS, TIPS, PRIZE, BUY_IN, POSITION, PLAYERS, TIPS,
SeparatorRowRepresentable(),
GAME, INITIAL_BUY_IN, LOCATION, BANKROLL, TABLE_SIZE, TOURNAMENT_TYPE, GAME, INITIAL_BUY_IN, LOCATION, BANKROLL, TABLE_SIZE, TOURNAMENT_TYPE,
SeparatorRowRepresentable(),
START_DATE, END_DATE, BREAK_TIME, COMMENT START_DATE, END_DATE, BREAK_TIME, COMMENT
) )
} }
@ -66,11 +68,13 @@ enum class SessionRow : RowRepresentable {
return if (liveBankroll) { return if (liveBankroll) {
arrayListOf( arrayListOf(
CASHED_OUT, BUY_IN, TIPS, CASHED_OUT, BUY_IN, TIPS,
SeparatorRowRepresentable(),
GAME, BLINDS, LOCATION, BANKROLL, TABLE_SIZE, START_DATE, END_DATE, BREAK_TIME, COMMENT GAME, BLINDS, LOCATION, BANKROLL, TABLE_SIZE, START_DATE, END_DATE, BREAK_TIME, COMMENT
) )
} else { } else {
arrayListOf( arrayListOf(
NET_RESULT, BUY_IN, TIPS, NET_RESULT, BUY_IN, TIPS,
SeparatorRowRepresentable(),
GAME, BLINDS, LOCATION, BANKROLL, TABLE_SIZE, START_DATE, END_DATE, BREAK_TIME, COMMENT GAME, BLINDS, LOCATION, BANKROLL, TABLE_SIZE, START_DATE, END_DATE, BREAK_TIME, COMMENT
) )
} }

@ -89,7 +89,7 @@ enum class SettingRow : RowRepresentable {
get() { get() {
return when (this) { return when (this) {
VERSION -> RowViewType.TITLE_VALUE.ordinal VERSION -> RowViewType.TITLE_VALUE.ordinal
FOLLOW_US -> RowViewType.FOLLOW_US.ordinal FOLLOW_US -> RowViewType.ROW_FOLLOW_US.ordinal
else -> RowViewType.TITLE_ARROW.ordinal else -> RowViewType.TITLE_ARROW.ordinal
} }
} }

@ -2,14 +2,14 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowBottomSheet_container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:foreground="?selectableItemBackground" android:foreground="?selectableItemBackground"
android:padding="8dp"> android:padding="8dp">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowBottomSheet_title" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"

@ -6,7 +6,7 @@
android:orientation="vertical"> android:orientation="vertical">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/sessionHeaderTitle" android:id="@+id/title"
style="@style/PokerAnalyticsTheme.TextView.SessionHeader" style="@style/PokerAnalyticsTheme.TextView.SessionHeader"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

@ -13,7 +13,7 @@
android:background="@color/green_header"> android:background="@color/green_header">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowHeaderTitleAmount.title" android:id="@+id/title"
style="@style/PokerAnalyticsTheme.TextView.RowTitle" style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -25,7 +25,7 @@
tools:text="Title" /> tools:text="Title" />
<net.pokeranalytics.android.ui.view.FormattedTextView <net.pokeranalytics.android.ui.view.FormattedTextView
android:id="@+id/rowHeaderTitleAmount.value" android:id="@+id/value"
style="@style/PokerAnalyticsTheme.TextView.RowValue" style="@style/PokerAnalyticsTheme.TextView.RowValue"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -37,7 +37,7 @@
android:maxLines="1" android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd" app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintStart_toEndOf="@+id/rowHeaderTitleAmount.title" app:layout_constraintStart_toEndOf="@+id/title"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Value" /> tools:text="Value" />

@ -2,7 +2,7 @@
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" <androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowHeaderTitleAmount.container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="56dp" android:layout_height="56dp"
android:orientation="vertical"> android:orientation="vertical">
@ -13,7 +13,7 @@
android:background="@color/green_header"> android:background="@color/green_header">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowHeaderTitleAmount.title" android:id="@+id/title"
style="@style/PokerAnalyticsTheme.TextView.RowTitle" style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -25,7 +25,7 @@
tools:text="Title" /> tools:text="Title" />
<net.pokeranalytics.android.ui.view.FormattedTextView <net.pokeranalytics.android.ui.view.FormattedTextView
android:id="@+id/rowHeaderTitleAmount.value" android:id="@+id/value"
style="@style/PokerAnalyticsTheme.TextView.RowValue" style="@style/PokerAnalyticsTheme.TextView.RowValue"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -37,7 +37,7 @@
android:maxLines="1" android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd" app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintStart_toEndOf="@+id/rowHeaderTitleAmount.title" app:layout_constraintStart_toEndOf="@+id/title"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Value" /> tools:text="Value" />
@ -58,7 +58,7 @@
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout <FrameLayout
android:id="@+id/rowHeaderTitleAmount.separator" android:id="@+id/separator"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="16dp" android:layout_height="16dp"
android:visibility="gone" android:visibility="gone"

@ -13,7 +13,7 @@
android:background="@color/green_header"> android:background="@color/green_header">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowHeaderTitleValue.title" android:id="@+id/title"
style="@style/PokerAnalyticsTheme.TextView.RowTitle" style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -23,7 +23,7 @@
tools:text="Title" /> tools:text="Title" />
<net.pokeranalytics.android.ui.view.FormattedTextView <net.pokeranalytics.android.ui.view.FormattedTextView
android:id="@+id/rowHeaderTitleValue.value" android:id="@+id/value"
style="@style/PokerAnalyticsTheme.TextView.RowValue" style="@style/PokerAnalyticsTheme.TextView.RowValue"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -33,7 +33,7 @@
android:maxLines="1" android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd" app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintStart_toEndOf="@+id/rowHeaderTitleValue.title" app:layout_constraintStart_toEndOf="@+id/title"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Value" /> tools:text="Value" />

@ -2,13 +2,13 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitle.container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:background="?selectableItemBackground"> android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitle.title" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"

@ -2,13 +2,13 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitle.container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:background="?selectableItemBackground"> android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitle.title" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"

@ -2,13 +2,13 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitleSwitch.container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?selectableItemBackground"> android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitleSwitch.title" android:id="@+id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/PokerAnalyticsTheme.TextView.RowTitle" style="@style/PokerAnalyticsTheme.TextView.RowTitle"
@ -16,7 +16,7 @@
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/rowTitleSwitch.switch" app:layout_constraintEnd_toStartOf="@+id/switchView"
app:layout_constraintStart_toStartOf="@+id/guidelineStart" app:layout_constraintStart_toStartOf="@+id/guidelineStart"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" app:layout_constraintVertical_bias="0.0"
@ -37,7 +37,7 @@
app:layout_constraintGuide_end="16dp" /> app:layout_constraintGuide_end="16dp" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/rowTitleSwitch.switch" android:id="@+id/switchView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"

@ -2,7 +2,7 @@
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android" <androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitleValue.container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:orientation="vertical"> android:orientation="vertical">
@ -13,7 +13,7 @@
android:background="?selectableItemBackground"> android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitleValue.title" android:id="@+id/title"
style="@style/PokerAnalyticsTheme.TextView.RowTitle" style="@style/PokerAnalyticsTheme.TextView.RowTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -25,7 +25,7 @@
tools:text="Title" /> tools:text="Title" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitleValue.value" android:id="@+id/value"
style="@style/PokerAnalyticsTheme.TextView.RowValue" style="@style/PokerAnalyticsTheme.TextView.RowValue"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -35,7 +35,7 @@
android:maxLines="1" android:maxLines="1"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd" app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintStart_toEndOf="@+id/rowTitleValue.title" app:layout_constraintStart_toEndOf="@+id/title"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Value" /> tools:text="Value" />

@ -2,13 +2,13 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/rowTitleValueAction.container" android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="48dp"
android:background="?selectableItemBackground"> android:background="?selectableItemBackground">
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitleValueAction.title" android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
@ -21,7 +21,7 @@
tools:text="Title" /> tools:text="Title" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rowTitleValueAction.value" android:id="@+id/value"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
@ -30,13 +30,13 @@
android:maxLines="1" android:maxLines="1"
android:textSize="14sp" android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/rowTitleValueAction.action" app:layout_constraintEnd_toStartOf="@+id/action"
app:layout_constraintStart_toEndOf="@+id/rowTitleValueAction.title" app:layout_constraintStart_toEndOf="@+id/title"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:text="Value" /> tools:text="Value" />
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/rowTitleValueAction.action" android:id="@+id/action"
android:layout_width="32dp" android:layout_width="32dp"
android:layout_height="32dp" android:layout_height="32dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
@ -45,7 +45,7 @@
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/guidelineEnd" app:layout_constraintEnd_toEndOf="@+id/guidelineEnd"
app:layout_constraintStart_toEndOf="@+id/rowTitleValueAction.value" app:layout_constraintStart_toEndOf="@+id/value"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@drawable/ic_close" /> tools:src="@drawable/ic_close" />

Loading…
Cancel
Save