Browse Source

fix text of submit button

+ rename variables

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 2 years ago
parent
commit
c848659fda

+ 7 - 7
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 {

+ 1 - 1
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" />
     </LinearLayout>