fix text of submit button

+ rename variables

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-07-01 18:29:43 +02:00 committed by Andy Scherzinger (Rebase PR Action)
parent 385d5ccd4a
commit c848659fda
2 changed files with 8 additions and 8 deletions

View file

@ -126,21 +126,21 @@ class PollMainViewModel @Inject constructor(private val repository: PollReposito
}
override fun onError(e: Throwable) {
Log.d(TAG, "An error occurred: $e")
Log.e(TAG, "An error occurred: $e")
}
override fun onComplete() {
val showCloseButton = poll.status == Poll.STATUS_OPEN && isPollCreatedByCurrentUser(poll)
val showEndPollButton = poll.status == Poll.STATUS_OPEN && isPollCreatedByCurrentUser(poll)
if (votedForOpenHiddenPoll(poll)) {
_viewState.value = PollVoteHiddenState(poll, showCloseButton)
_viewState.value = PollVoteHiddenState(poll, showEndPollButton)
} else if (editPoll && poll.status == Poll.STATUS_OPEN) {
_viewState.value = PollVoteState(poll, showCloseButton)
_viewState.value = PollVoteState(poll, showEndPollButton)
editPoll = false
} else if (poll.status == Poll.STATUS_CLOSED || poll.votedSelf?.isNotEmpty() == true) {
setPollResultState(poll)
} else if (poll.votedSelf.isNullOrEmpty()) {
_viewState.value = PollVoteState(poll, showCloseButton)
_viewState.value = PollVoteState(poll, showEndPollButton)
} else {
Log.w(TAG, "unknown poll state")
}
@ -149,9 +149,9 @@ class PollMainViewModel @Inject constructor(private val repository: PollReposito
private fun setPollResultState(poll: Poll) {
val showEditButton = poll.status == Poll.STATUS_OPEN && poll.resultMode == Poll.RESULT_MODE_PUBLIC
val showCloseButton = poll.status == Poll.STATUS_OPEN && isPollCreatedByCurrentUser(poll)
val showEndPollButton = poll.status == Poll.STATUS_OPEN && isPollCreatedByCurrentUser(poll)
_viewState.value = PollResultState(poll, showEditButton, showCloseButton)
_viewState.value = PollResultState(poll, showEditButton, showEndPollButton)
}
private fun votedForOpenHiddenPoll(poll: Poll): Boolean {

View file

@ -70,7 +70,7 @@
android:id="@+id/poll_vote_submit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/edit"
android:text="@string/nc_common_submit"
android:theme="@style/Button.Primary"
app:cornerRadius="@dimen/button_corner_radius" />
</LinearLayout>