don't pass in context to voteAmountPlaceHolderText()
This commit is contained in:
@@ -237,7 +237,7 @@ fun ZapVoteAmountChoicePopup(
|
|||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = pollViewModel.voteAmountPlaceHolderText(context),
|
text = pollViewModel.voteAmountPlaceHolderText(context.getString(R.string.sats)),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
package com.vitorpamplona.amethyst.ui.note
|
package com.vitorpamplona.amethyst.ui.note
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import com.vitorpamplona.amethyst.R
|
|
||||||
import com.vitorpamplona.amethyst.model.Account
|
import com.vitorpamplona.amethyst.model.Account
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.service.model.*
|
import com.vitorpamplona.amethyst.service.model.*
|
||||||
@@ -33,14 +31,14 @@ class PollNoteViewModel : ViewModel() {
|
|||||||
|
|
||||||
val isVoteAmountAtomic = valueMaximum != null && valueMinimum != null && valueMinimum == valueMaximum
|
val isVoteAmountAtomic = valueMaximum != null && valueMinimum != null && valueMinimum == valueMaximum
|
||||||
|
|
||||||
fun voteAmountPlaceHolderText(ctx: Context): String = if (valueMinimum == null && valueMaximum == null) {
|
fun voteAmountPlaceHolderText(sats: String): String = if (valueMinimum == null && valueMaximum == null) {
|
||||||
ctx.getString(R.string.sats)
|
sats
|
||||||
} else if (valueMinimum == null) {
|
} else if (valueMinimum == null) {
|
||||||
"1—$valueMaximum " + ctx.getString(R.string.sats)
|
"1—$valueMaximum $sats"
|
||||||
} else if (valueMaximum == null) {
|
} else if (valueMaximum == null) {
|
||||||
">$valueMinimum " + ctx.getString(R.string.sats)
|
">$valueMinimum $sats"
|
||||||
} else {
|
} else {
|
||||||
"$valueMinimum—$valueMaximum " + ctx.getString(R.string.sats)
|
"$valueMinimum—$valueMaximum $sats"
|
||||||
}
|
}
|
||||||
|
|
||||||
fun amount(textAmount: String) = if (textAmount.isEmpty()) { null } else {
|
fun amount(textAmount: String) = if (textAmount.isEmpty()) { null } else {
|
||||||
|
|||||||
Reference in New Issue
Block a user