|
|
|
@ -13,6 +13,7 @@ import androidx.constraintlayout.widget.ConstraintLayout |
|
|
|
import androidx.core.content.ContextCompat |
|
|
|
import androidx.core.content.ContextCompat |
|
|
|
import androidx.core.view.isVisible |
|
|
|
import androidx.core.view.isVisible |
|
|
|
import androidx.core.widget.ContentLoadingProgressBar |
|
|
|
import androidx.core.widget.ContentLoadingProgressBar |
|
|
|
|
|
|
|
import androidx.core.widget.addTextChangedListener |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import androidx.recyclerview.widget.RecyclerView |
|
|
|
import com.github.mikephil.charting.charts.BarChart |
|
|
|
import com.github.mikephil.charting.charts.BarChart |
|
|
|
import com.github.mikephil.charting.charts.LineChart |
|
|
|
import com.github.mikephil.charting.charts.LineChart |
|
|
|
@ -28,6 +29,7 @@ import net.pokeranalytics.android.calculus.bankroll.BankrollReportManager |
|
|
|
import net.pokeranalytics.android.model.TableSize |
|
|
|
import net.pokeranalytics.android.model.TableSize |
|
|
|
import net.pokeranalytics.android.model.extensions.getFormattedGameType |
|
|
|
import net.pokeranalytics.android.model.extensions.getFormattedGameType |
|
|
|
import net.pokeranalytics.android.model.handhistory.ComputedAction |
|
|
|
import net.pokeranalytics.android.model.handhistory.ComputedAction |
|
|
|
|
|
|
|
import net.pokeranalytics.android.model.handhistory.HHKeyboard |
|
|
|
import net.pokeranalytics.android.model.realm.CustomField |
|
|
|
import net.pokeranalytics.android.model.realm.CustomField |
|
|
|
import net.pokeranalytics.android.model.realm.Player |
|
|
|
import net.pokeranalytics.android.model.realm.Player |
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
import net.pokeranalytics.android.model.realm.Session |
|
|
|
@ -41,6 +43,7 @@ import net.pokeranalytics.android.ui.fragment.BankrollRowRepresentable |
|
|
|
import net.pokeranalytics.android.ui.graph.AxisFormatting |
|
|
|
import net.pokeranalytics.android.ui.graph.AxisFormatting |
|
|
|
import net.pokeranalytics.android.ui.graph.setStyle |
|
|
|
import net.pokeranalytics.android.ui.graph.setStyle |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.* |
|
|
|
import net.pokeranalytics.android.ui.view.rowrepresentable.* |
|
|
|
|
|
|
|
import net.pokeranalytics.android.util.extensions.formatted |
|
|
|
import net.pokeranalytics.android.util.extensions.longDate |
|
|
|
import net.pokeranalytics.android.util.extensions.longDate |
|
|
|
import timber.log.Timber |
|
|
|
import timber.log.Timber |
|
|
|
|
|
|
|
|
|
|
|
@ -182,8 +185,10 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
itemView.findViewById<AppCompatTextView>(R.id.title)?.let { |
|
|
|
itemView.findViewById<AppCompatTextView>(R.id.title)?.let { |
|
|
|
it.text = row.localizedTitle(itemView.context) |
|
|
|
it.text = row.localizedTitle(itemView.context) |
|
|
|
} |
|
|
|
} |
|
|
|
val computedStat = ComputedStat(Stat.NET_RESULT, report.total, currency = report.currency) |
|
|
|
val computedStat = |
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.value)?.setTextFormat(computedStat.format(), itemView.context) |
|
|
|
ComputedStat(Stat.NET_RESULT, report.total, currency = report.currency) |
|
|
|
|
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.value) |
|
|
|
|
|
|
|
?.setTextFormat(computedStat.format(), itemView.context) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val listener = View.OnClickListener { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
@ -216,7 +221,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
adapter.delegate?.onRowSelected(position, row) |
|
|
|
adapter.delegate?.onRowSelected(position, row) |
|
|
|
} |
|
|
|
} |
|
|
|
itemView.findViewById<View?>(R.id.container)?.setOnClickListener(listener) |
|
|
|
itemView.findViewById<View?>(R.id.container) |
|
|
|
|
|
|
|
?.setOnClickListener(listener) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -255,7 +261,12 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
imageView.setImageResource(imageRes) |
|
|
|
imageView.setImageResource(imageRes) |
|
|
|
} |
|
|
|
} |
|
|
|
row.imageTint?.let { color -> |
|
|
|
row.imageTint?.let { color -> |
|
|
|
imageView.setColorFilter(ContextCompat.getColor(imageView.context, color)) |
|
|
|
imageView.setColorFilter( |
|
|
|
|
|
|
|
ContextCompat.getColor( |
|
|
|
|
|
|
|
imageView.context, |
|
|
|
|
|
|
|
color |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
if (row.imageClickable == true) { |
|
|
|
if (row.imageClickable == true) { |
|
|
|
imageView.addCircleRipple() |
|
|
|
imageView.addCircleRipple() |
|
|
|
@ -303,7 +314,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a follow us row |
|
|
|
* Display a follow us row |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowFollowUsViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
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) |
|
|
|
@ -328,7 +340,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
|
|
|
|
|
|
|
|
// Title |
|
|
|
// Title |
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.title)?.text = row.localizedTitle(itemView.context) |
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.title)?.text = |
|
|
|
|
|
|
|
row.localizedTitle(itemView.context) |
|
|
|
|
|
|
|
|
|
|
|
// Value |
|
|
|
// Value |
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.value)?.let { view -> |
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.value)?.let { view -> |
|
|
|
@ -338,7 +351,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (row is StatRow) { |
|
|
|
if (row is StatRow) { |
|
|
|
itemView.findViewById<AppCompatImageView?>(R.id.nextArrow)?.isVisible = row.stat.hasProgressGraph |
|
|
|
itemView.findViewById<AppCompatImageView?>(R.id.nextArrow)?.isVisible = |
|
|
|
|
|
|
|
row.stat.hasProgressGraph |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Listener |
|
|
|
// Listener |
|
|
|
@ -400,7 +414,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a graph |
|
|
|
* Display a graph |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class GraphViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class GraphViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), |
|
|
|
|
|
|
|
BindableHolder { |
|
|
|
|
|
|
|
|
|
|
|
private fun loadWithDataSet(dataSet: DataSet<*>) { |
|
|
|
private fun loadWithDataSet(dataSet: DataSet<*>) { |
|
|
|
val context = itemView.context |
|
|
|
val context = itemView.context |
|
|
|
@ -460,7 +475,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a legend |
|
|
|
* Display a legend |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class LegendDefaultViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class LegendDefaultViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), |
|
|
|
|
|
|
|
BindableHolder { |
|
|
|
|
|
|
|
|
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
|
|
|
|
|
|
|
|
@ -489,7 +505,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
adapter.delegate?.onRowSelected(position, row) |
|
|
|
adapter.delegate?.onRowSelected(position, row) |
|
|
|
} |
|
|
|
} |
|
|
|
itemView.findViewById<ConstraintLayout>(R.id.container)?.setOnClickListener(listener) |
|
|
|
itemView.findViewById<ConstraintLayout>(R.id.container) |
|
|
|
|
|
|
|
?.setOnClickListener(listener) |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -525,7 +542,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
chipGroup.addView(chip) |
|
|
|
chipGroup.addView(chip) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
chipGroup.setOnCheckedChangeListener(object : ChipGroupExtension.SingleSelectionOnCheckedListener() { |
|
|
|
chipGroup.setOnCheckedChangeListener(object : |
|
|
|
|
|
|
|
ChipGroupExtension.SingleSelectionOnCheckedListener() { |
|
|
|
override fun onCheckedChanged(group: ChipGroup, checkedId: Int) { |
|
|
|
override fun onCheckedChanged(group: ChipGroup, checkedId: Int) { |
|
|
|
super.onCheckedChanged(group, checkedId) |
|
|
|
super.onCheckedChanged(group, checkedId) |
|
|
|
|
|
|
|
|
|
|
|
@ -534,7 +552,10 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
adapter.delegate?.onRowValueChanged(CustomField.Type.values()[checkedId], row) |
|
|
|
adapter.delegate?.onRowValueChanged( |
|
|
|
|
|
|
|
CustomField.Type.values()[checkedId], |
|
|
|
|
|
|
|
row |
|
|
|
|
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -545,11 +566,15 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a button in a row |
|
|
|
* Display a button in a row |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowButtonViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class RowButtonViewHolder(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 = |
|
|
|
itemView.findViewById<AppCompatTextView>(R.id.title).isVisible = !adapter.dataSource.boolForRow(row) |
|
|
|
row.localizedTitle(itemView.context) |
|
|
|
itemView.findViewById<ContentLoadingProgressBar>(R.id.progressBar).isVisible = adapter.dataSource.boolForRow(row) |
|
|
|
itemView.findViewById<AppCompatTextView>(R.id.title).isVisible = |
|
|
|
|
|
|
|
!adapter.dataSource.boolForRow(row) |
|
|
|
|
|
|
|
itemView.findViewById<ContentLoadingProgressBar>(R.id.progressBar).isVisible = |
|
|
|
|
|
|
|
adapter.dataSource.boolForRow(row) |
|
|
|
val listener = View.OnClickListener { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
adapter.delegate?.onRowSelected(position, row) |
|
|
|
adapter.delegate?.onRowSelected(position, row) |
|
|
|
} |
|
|
|
} |
|
|
|
@ -560,7 +585,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a session view |
|
|
|
* Display a session view |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
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 { |
|
|
|
@ -573,7 +599,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a transaction view |
|
|
|
* Display a transaction view |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowTransactionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class RowTransactionViewHolder(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.transactionRow.setData(row as Transaction) |
|
|
|
itemView.transactionRow.setData(row as Transaction) |
|
|
|
val listener = View.OnClickListener { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
@ -586,14 +613,16 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a top 10 row |
|
|
|
* Display a top 10 row |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowTop10ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class RowTop10ViewHolder(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 Session) { |
|
|
|
if (row is Session) { |
|
|
|
|
|
|
|
|
|
|
|
itemView.findViewById<AppCompatTextView>(R.id.gameResult)?.let { gameResult -> |
|
|
|
itemView.findViewById<AppCompatTextView>(R.id.gameResult)?.let { gameResult -> |
|
|
|
val result = row.result?.net ?: 0.0 |
|
|
|
val result = row.result?.net ?: 0.0 |
|
|
|
val formattedStat = ComputedStat(Stat.NET_RESULT, result, currency = row.currency).format() |
|
|
|
val formattedStat = |
|
|
|
|
|
|
|
ComputedStat(Stat.NET_RESULT, result, currency = row.currency).format() |
|
|
|
gameResult.setTextFormat(formattedStat, itemView.context) |
|
|
|
gameResult.setTextFormat(formattedStat, itemView.context) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -602,15 +631,19 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Duration |
|
|
|
// Duration |
|
|
|
val durationIcon = itemView.findViewById<AppCompatImageView?>(R.id.sessionInfoDurationIcon) |
|
|
|
val durationIcon = |
|
|
|
val durationText = itemView.findViewById<AppCompatTextView?>(R.id.sessionInfoDuration) |
|
|
|
itemView.findViewById<AppCompatImageView?>(R.id.sessionInfoDurationIcon) |
|
|
|
|
|
|
|
val durationText = |
|
|
|
|
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.sessionInfoDuration) |
|
|
|
durationIcon?.isVisible = true |
|
|
|
durationIcon?.isVisible = true |
|
|
|
durationText?.isVisible = true |
|
|
|
durationText?.isVisible = true |
|
|
|
durationText?.text = row.getFormattedDuration() |
|
|
|
durationText?.text = row.getFormattedDuration() |
|
|
|
|
|
|
|
|
|
|
|
// Location |
|
|
|
// Location |
|
|
|
val locationIcon = itemView.findViewById<AppCompatImageView?>(R.id.sessionInfoLocationIcon) |
|
|
|
val locationIcon = |
|
|
|
val locationText = itemView.findViewById<AppCompatTextView?>(R.id.sessionInfoLocation) |
|
|
|
itemView.findViewById<AppCompatImageView?>(R.id.sessionInfoLocationIcon) |
|
|
|
|
|
|
|
val locationText = |
|
|
|
|
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.sessionInfoLocation) |
|
|
|
|
|
|
|
|
|
|
|
if (!row.location?.name.isNullOrEmpty()) { |
|
|
|
if (!row.location?.name.isNullOrEmpty()) { |
|
|
|
locationIcon?.isVisible = true |
|
|
|
locationIcon?.isVisible = true |
|
|
|
@ -622,8 +655,10 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Table Size |
|
|
|
// Table Size |
|
|
|
val tableSizeIcon = itemView.findViewById<AppCompatImageView?>(R.id.sessionInfoTableSizeIcon) |
|
|
|
val tableSizeIcon = |
|
|
|
val tableSizeText = itemView.findViewById<AppCompatTextView?>(R.id.sessionInfoTableSize) |
|
|
|
itemView.findViewById<AppCompatImageView?>(R.id.sessionInfoTableSizeIcon) |
|
|
|
|
|
|
|
val tableSizeText = |
|
|
|
|
|
|
|
itemView.findViewById<AppCompatTextView?>(R.id.sessionInfoTableSize) |
|
|
|
|
|
|
|
|
|
|
|
row.tableSize?.let { |
|
|
|
row.tableSize?.let { |
|
|
|
tableSizeIcon?.isVisible = true |
|
|
|
tableSizeIcon?.isVisible = true |
|
|
|
@ -646,7 +681,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a player image view |
|
|
|
* Display a player image view |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowPlayerViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class RowPlayerViewHolder(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 Player) { |
|
|
|
if (row is Player) { |
|
|
|
@ -672,7 +708,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a player image view |
|
|
|
* Display a player image view |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class RowPlayerImageViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class RowPlayerImageViewHolder(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<PlayerImageView?>(R.id.playerImageView)?.let { playerImageView -> |
|
|
|
itemView.findViewById<PlayerImageView?>(R.id.playerImageView)?.let { playerImageView -> |
|
|
|
val listener = View.OnClickListener { |
|
|
|
val listener = View.OnClickListener { |
|
|
|
@ -692,22 +729,64 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
val computedAction = row as ComputedAction |
|
|
|
val computedAction = row as ComputedAction |
|
|
|
|
|
|
|
|
|
|
|
itemView.findViewById<Button>(R.id.actionButton)?.let { button -> |
|
|
|
// Position |
|
|
|
|
|
|
|
itemView.findViewById<Button>(R.id.positionButton)?.let { button -> |
|
|
|
|
|
|
|
button.text = computedAction.position.value |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Action |
|
|
|
|
|
|
|
itemView.findViewById<EditText>(R.id.actionEditText)?.let { button -> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
button.isFocusable = computedAction.actionTypeCanBeEdited |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adapter.dataSource.color(position, row, HHKeyboard.ACTION.ordinal)?.let { color -> |
|
|
|
|
|
|
|
button.setBackgroundColor(color) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
computedAction.action.type?.resId?.let { |
|
|
|
computedAction.action.type?.resId?.let { |
|
|
|
button.text = itemView.context.getString(it) |
|
|
|
button.setText(it) |
|
|
|
} |
|
|
|
} |
|
|
|
button.setOnClickListener { |
|
|
|
// button.setOnClickListener { |
|
|
|
adapter.delegate?.onRowSelected(position, row, 1) |
|
|
|
// } |
|
|
|
|
|
|
|
button.setOnFocusChangeListener { v, hasFocus -> |
|
|
|
|
|
|
|
Timber.d("Action Focus change: $hasFocus") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (hasFocus) { |
|
|
|
|
|
|
|
adapter.delegate?.onRowSelected(position, row, HHKeyboard.ACTION.ordinal) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
adapter.delegate?.onRowDeselected(position, row) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adapter.dataSource.color(position, row, HHKeyboard.ACTION.ordinal)?.let { color -> |
|
|
|
|
|
|
|
button.setBackgroundColor(color) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
itemView.findViewById<Button>(R.id.positionButton)?.let { button -> |
|
|
|
} |
|
|
|
button.text = computedAction.position.value |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Amount |
|
|
|
itemView.findViewById<EditText>(R.id.amountEditText)?.let { editText -> |
|
|
|
itemView.findViewById<EditText>(R.id.amountEditText)?.let { editText -> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adapter.dataSource.color(position, row, HHKeyboard.AMOUNT.ordinal)?.let { color -> |
|
|
|
|
|
|
|
editText.setBackgroundColor(color) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
editText.setText(computedAction.action.amount?.formatted()) |
|
|
|
editText.setOnFocusChangeListener { v, hasFocus -> |
|
|
|
editText.setOnFocusChangeListener { v, hasFocus -> |
|
|
|
adapter.delegate?.onRowSelected(position, row, 2) |
|
|
|
Timber.d("Amount Focus change: $hasFocus") |
|
|
|
|
|
|
|
if (hasFocus) { |
|
|
|
|
|
|
|
adapter.delegate?.onRowSelected(position, row, HHKeyboard.AMOUNT.ordinal) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
adapter.delegate?.onRowDeselected(position, row) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
adapter.dataSource.color(position, row, HHKeyboard.AMOUNT.ordinal) |
|
|
|
|
|
|
|
?.let { color -> |
|
|
|
|
|
|
|
editText.setBackgroundColor(color) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
editText.addTextChangedListener { |
|
|
|
|
|
|
|
adapter.delegate?.onRowValueChanged(it.toString(), row) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -726,7 +805,8 @@ enum class RowViewType(private var layoutRes: Int) { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* Display a separator |
|
|
|
* Display a separator |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
inner class SeparatorViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), BindableHolder { |
|
|
|
inner class SeparatorViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView), |
|
|
|
|
|
|
|
BindableHolder { |
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
override fun bind(position: Int, row: RowRepresentable, adapter: RowRepresentableAdapter) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|