Updated on 2026-08-14
This commit is contained in:
parent
d88df58384
commit
c6e2514b13
4 changed files with 18 additions and 9 deletions
|
|
@ -92,7 +92,7 @@ internal class Helper {
|
|||
|
||||
fun listOfBlockchain(): List<KeyValue> {
|
||||
return mutableListOf(
|
||||
KeyValue("--- CUSTOM ---", "BTC/test"),
|
||||
KeyValue("--- CUSTOM ---", ""),
|
||||
KeyValue("BTC", "BTC"),
|
||||
KeyValue("BTC/test", "BTC/test"),
|
||||
KeyValue("ETH", "ETH"),
|
||||
|
|
|
|||
|
|
@ -226,8 +226,9 @@ class PersonalizeConfigConverter {
|
|||
tokenDecimal = applyConfig.decimal.toInt()
|
||||
}
|
||||
|
||||
val blockchain = if (applyConfig.blockchain.isNotEmpty()) applyConfig.blockchain else applyConfig.blockchainCustom
|
||||
val cardData = CardData(
|
||||
blockchainName = applyConfig.blockchain,
|
||||
blockchainName = blockchain,
|
||||
batchId = applyConfig.batchId,
|
||||
productMask = productMask,
|
||||
tokenSymbol = tokenSymbol,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ class PersonalizeConfig {
|
|||
|
||||
// Common
|
||||
var curveID = "ed25519"
|
||||
var blockchain = "BTC"
|
||||
var blockchain = "BTC/test"
|
||||
var blockchainCustom = ""
|
||||
var MaxSignatures: Long = 100
|
||||
var createWallet = false
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@ import ru.dev.gbixahue.eu4d.lib.kotlin.stringOf
|
|||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
*/
|
||||
class SpinnerWidget(parent: ViewGroup, data: ListItem) : DescriptionWidget<ListValueWrapper>(parent, data) {
|
||||
class SpinnerWidget(parent: ViewGroup, listItem: ListItem) : DescriptionWidget<ListValueWrapper>(parent, listItem) {
|
||||
override fun getLayoutId(): Int = R.layout.w_personalize_item_spinner
|
||||
|
||||
private val data: ListValueWrapper = listItem.getData()!!
|
||||
|
||||
private val spItem = view.findViewById<Spinner>(R.id.sp_item)
|
||||
private val spAdapter = SpItemAdapter(dataItem.viewModel.data?.itemList)
|
||||
private val spAdapter = SpItemAdapter(data.itemList)
|
||||
|
||||
private val onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onNothingSelected(parent: AdapterView<*>?) {}
|
||||
|
||||
override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) {
|
||||
val vmData = dataItem.viewModel.data ?: return
|
||||
|
||||
vmData.selectedItem = vmData.itemList[position]
|
||||
dataItem.viewModel.updateDataByView(vmData)
|
||||
data.selectedItem = data.itemList[position]
|
||||
dataItem.viewModel.updateDataByView(data)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -38,6 +38,9 @@ class SpinnerWidget(parent: ViewGroup, data: ListItem) : DescriptionWidget<ListV
|
|||
val name = view.findViewById<TextView>(R.id.tv_name)
|
||||
name.setText(getResNameId())
|
||||
spItem.adapter = spAdapter
|
||||
spAdapter.getItemPosition(stringOf(data.selectedItem))?.let {
|
||||
spItem.setSelection(it)
|
||||
}
|
||||
spItem.onItemSelectedListener = onItemSelectedListener
|
||||
dataItem.viewModel.onDataUpdated = {
|
||||
it?.apply {
|
||||
|
|
@ -81,4 +84,9 @@ class SpItemAdapter(list: List<KeyValue>?) : BaseAdapter() {
|
|||
override fun getItemId(position: Int): Long = position.toLong()
|
||||
|
||||
override fun getCount(): Int = itemList.size
|
||||
|
||||
fun getItemPosition(item: String): Int? {
|
||||
val kv = itemList.firstOrNull { it.value == item } ?: return null
|
||||
return itemList.indexOf(kv)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue