|
|
|
|
@ -42,11 +42,91 @@ enum class RowViewType { |
|
|
|
|
DATA, |
|
|
|
|
BOTTOM_SHEET_DATA, |
|
|
|
|
TITLE_GRID, |
|
|
|
|
ROW_SESSION; |
|
|
|
|
ROW_SESSION, |
|
|
|
|
STAT; |
|
|
|
|
|
|
|
|
|
inner class FakeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), |
|
|
|
|
BindableHolder { |
|
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
|
/** |
|
|
|
|
* View holder |
|
|
|
|
*/ |
|
|
|
|
fun viewHolder(parent: ViewGroup): RecyclerView.ViewHolder { |
|
|
|
|
return when (this) { |
|
|
|
|
HEADER_TITLE_VALUE -> HeaderTitleValueViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_header_title_value, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
HEADER_TITLE_AMOUNT -> HeaderTitleAmountViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_header_title_amount, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE -> TitleViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE_VALUE -> TitleValueViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title_value, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE_GRID -> TitleGridSessionViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_bottom_sheet_grid_title, |
|
|
|
|
parent, |
|
|
|
|
false) |
|
|
|
|
) |
|
|
|
|
TITLE_SWITCH -> TitleSwitchViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title_switch, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE_VALUE_ACTION -> TitleValueActionViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title_value_action, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
DATA -> DataViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
BOTTOM_SHEET_DATA -> BottomSheetDataViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_bottom_sheet_title, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
ROW_SESSION -> RowSessionViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_history_session, |
|
|
|
|
parent, |
|
|
|
|
false) |
|
|
|
|
) |
|
|
|
|
STAT -> TitleValueViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title_value, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
else -> throw Exception("Undefined rowViewType's holder") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -209,81 +289,5 @@ enum class RowViewType { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* View holder |
|
|
|
|
*/ |
|
|
|
|
fun viewHolder(parent: ViewGroup): RecyclerView.ViewHolder { |
|
|
|
|
return when (this) { |
|
|
|
|
HEADER_TITLE_VALUE -> HeaderTitleValueViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_header_title_value, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
HEADER_TITLE_AMOUNT -> HeaderTitleAmountViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_header_title_amount, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE -> TitleViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE_VALUE -> TitleValueViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title_value, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE_GRID -> TitleGridSessionViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_bottom_sheet_grid_title, |
|
|
|
|
parent, |
|
|
|
|
false) |
|
|
|
|
) |
|
|
|
|
TITLE_SWITCH -> TitleSwitchViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title_switch, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
TITLE_VALUE_ACTION -> TitleValueActionViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title_value_action, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
DATA -> DataViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_title, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
BOTTOM_SHEET_DATA -> BottomSheetDataViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_bottom_sheet_title, |
|
|
|
|
parent, |
|
|
|
|
false |
|
|
|
|
) |
|
|
|
|
) |
|
|
|
|
ROW_SESSION -> RowSessionViewHolder( |
|
|
|
|
LayoutInflater.from(parent.context).inflate( |
|
|
|
|
R.layout.row_history_session, |
|
|
|
|
parent, |
|
|
|
|
false) |
|
|
|
|
) |
|
|
|
|
else -> throw Exception("Undefined RowViewType's holder") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |