parent
d6ccea472e
commit
17bbb7765e
@ -1,61 +0,0 @@ |
||||
package net.pokeranalytics.android.ui.view |
||||
|
||||
import android.content.Context |
||||
import android.util.AttributeSet |
||||
import android.view.LayoutInflater |
||||
import android.widget.FrameLayout |
||||
import androidx.constraintlayout.widget.ConstraintLayout |
||||
import kotlinx.android.synthetic.main.row_hand_history_view.view.* |
||||
import net.pokeranalytics.android.R |
||||
import net.pokeranalytics.android.model.handhistory.Street |
||||
import net.pokeranalytics.android.model.realm.handhistory.HandHistory |
||||
import net.pokeranalytics.android.util.extensions.formatted |
||||
|
||||
/** |
||||
* Display a transaction row |
||||
*/ |
||||
class HandHistoryRowView : FrameLayout { |
||||
|
||||
private lateinit var rowHandHistory: ConstraintLayout |
||||
|
||||
/** |
||||
* Constructors |
||||
*/ |
||||
constructor(context: Context) : super(context) { |
||||
init() |
||||
} |
||||
|
||||
constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) { |
||||
init() |
||||
} |
||||
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) { |
||||
init() |
||||
} |
||||
|
||||
/** |
||||
* Init |
||||
*/ |
||||
private fun init() { |
||||
val layoutInflater = LayoutInflater.from(context) |
||||
rowHandHistory = layoutInflater.inflate(R.layout.row_hand_history_view, this, false) as ConstraintLayout |
||||
val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT) |
||||
addView(rowHandHistory, layoutParams) |
||||
} |
||||
|
||||
/** |
||||
* Set the session data to the view |
||||
*/ |
||||
fun setData(handHistory: HandHistory) { |
||||
|
||||
rowHandHistory.cardsLayout.removeAllViews() |
||||
|
||||
handHistory.cardViews(context, rowHandHistory.cardsLayout).forEach { view -> |
||||
rowHandHistory.cardsLayout.addView(view) |
||||
} |
||||
|
||||
rowHandHistory.amount.text = handHistory.potSizeForStreet(Street.SUMMARY).formatted() |
||||
|
||||
} |
||||
|
||||
} |
||||
Loading…
Reference in new issue