From c848659fda4bac5c13cf383e0b630942af39bda9 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Fri, 1 Jul 2022 18:29:43 +0200 Subject: [PATCH] fix text of submit button + rename variables Signed-off-by: Marcel Hibbe --- .../talk/polls/viewmodels/PollMainViewModel.kt | 14 +++++++------- app/src/main/res/layout/dialog_poll_vote.xml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/polls/viewmodels/PollMainViewModel.kt b/app/src/main/java/com/nextcloud/talk/polls/viewmodels/PollMainViewModel.kt index 636ca3df9..8f5a43347 100644 --- a/app/src/main/java/com/nextcloud/talk/polls/viewmodels/PollMainViewModel.kt +++ b/app/src/main/java/com/nextcloud/talk/polls/viewmodels/PollMainViewModel.kt @@ -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 { diff --git a/app/src/main/res/layout/dialog_poll_vote.xml b/app/src/main/res/layout/dialog_poll_vote.xml index f41fef649..1ab4c2c9a 100644 --- a/app/src/main/res/layout/dialog_poll_vote.xml +++ b/app/src/main/res/layout/dialog_poll_vote.xml @@ -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" />