mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-25 12:31:45 +02:00
add consensus threshold component/preview,
change value range placeholder strings
This commit is contained in:
@@ -26,10 +26,7 @@ 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.TextNoteEvent
|
import com.vitorpamplona.amethyst.service.model.TextNoteEvent
|
||||||
import com.vitorpamplona.amethyst.ui.components.PollOption
|
import com.vitorpamplona.amethyst.ui.components.*
|
||||||
import com.vitorpamplona.amethyst.ui.components.PollPrimaryDescription
|
|
||||||
import com.vitorpamplona.amethyst.ui.components.PollRecipientsField
|
|
||||||
import com.vitorpamplona.amethyst.ui.components.PollVoteValueRange
|
|
||||||
import com.vitorpamplona.amethyst.ui.note.ReplyInformation
|
import com.vitorpamplona.amethyst.ui.note.ReplyInformation
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.UserLine
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.UserLine
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
@@ -113,6 +110,7 @@ fun NewPollView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Text(stringResource(R.string.poll_heading_required))
|
||||||
PollRecipientsField()
|
PollRecipientsField()
|
||||||
PollPrimaryDescription(pollViewModel = pollViewModel)
|
PollPrimaryDescription(pollViewModel = pollViewModel)
|
||||||
PollOption(0)
|
PollOption(0)
|
||||||
@@ -132,6 +130,7 @@ fun NewPollView(onClose: () -> Unit, baseReplyTo: Note? = null, quote: Note? = n
|
|||||||
}
|
}
|
||||||
Text(stringResource(R.string.poll_heading_optional))
|
Text(stringResource(R.string.poll_heading_optional))
|
||||||
PollVoteValueRange()
|
PollVoteValueRange()
|
||||||
|
PollConsensusThreshold()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,54 @@
|
|||||||
|
package com.vitorpamplona.amethyst.ui.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Row
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
|
import androidx.compose.material.MaterialTheme
|
||||||
|
import androidx.compose.material.OutlinedTextField
|
||||||
|
import androidx.compose.material.Text
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.mutableStateOf
|
||||||
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
|
import androidx.compose.runtime.setValue
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
import com.vitorpamplona.amethyst.R
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun PollConsensusThreshold() {
|
||||||
|
var text by rememberSaveable { mutableStateOf("") }
|
||||||
|
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.Center
|
||||||
|
) {
|
||||||
|
OutlinedTextField(
|
||||||
|
value = text,
|
||||||
|
onValueChange = { text = it },
|
||||||
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),
|
||||||
|
modifier = Modifier.width(150.dp),
|
||||||
|
label = {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.poll_consensus_threshold),
|
||||||
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
|
)
|
||||||
|
},
|
||||||
|
placeholder = {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.poll_consensus_threshold_percent),
|
||||||
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Preview
|
||||||
|
@Composable
|
||||||
|
fun PollConsensusThresholdPreview() {
|
||||||
|
PollConsensusThreshold()
|
||||||
|
}
|
@@ -42,7 +42,7 @@ fun PollVoteValueRange() {
|
|||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.poll_vote_value_min),
|
text = stringResource(R.string.poll_vote_value_min_zap_amount),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ fun PollVoteValueRange() {
|
|||||||
},
|
},
|
||||||
placeholder = {
|
placeholder = {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.poll_vote_value_max),
|
text = stringResource(R.string.poll_vote_value_max_zap_amount),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
color = MaterialTheme.colors.onSurface.copy(alpha = 0.32f)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -221,12 +221,17 @@
|
|||||||
|
|
||||||
<string name="private_conversation_notification">"<Unable to decrypt private message>\n\nYou were cited in a private/encrypted conversation between %1$s and %2$s."</string>
|
<string name="private_conversation_notification">"<Unable to decrypt private message>\n\nYou were cited in a private/encrypted conversation between %1$s and %2$s."</string>
|
||||||
<string name="post_poll">Post Poll</string>
|
<string name="post_poll">Post Poll</string>
|
||||||
<string name="poll_primary_description">Primary poll description…</string>
|
<string name="poll_heading_required">Required fields:</string>
|
||||||
<string name="poll_option_description">Poll option description</string>
|
|
||||||
<string name="poll_option_index">Option %s</string>
|
|
||||||
<string name="poll_zap_recipients">Zap recipients</string>
|
<string name="poll_zap_recipients">Zap recipients</string>
|
||||||
<string name="poll_heading_optional">Optional:</string>
|
<string name="poll_primary_description">Primary poll description…</string>
|
||||||
|
<string name="poll_option_index">Option %s</string>
|
||||||
|
<string name="poll_option_description">Poll option description</string>
|
||||||
|
<string name="poll_heading_optional">Optional fields:</string>
|
||||||
<string name="poll_vote_value_min">Vote minimum</string>
|
<string name="poll_vote_value_min">Vote minimum</string>
|
||||||
<string name="poll_vote_value_max">Vote maximum</string>
|
<string name="poll_vote_value_max">Vote maximum</string>
|
||||||
|
<string name="poll_consensus_threshold">Consensus threshold</string>
|
||||||
|
<string name="poll_consensus_threshold_percent">%</string>
|
||||||
|
<string name="poll_vote_value_min_zap_amount">Minimum zap</string>
|
||||||
|
<string name="poll_vote_value_max_zap_amount">Maximum zap</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Reference in New Issue
Block a user