ソースを参照

rename close poll to end poll (in code)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Marcel Hibbe 3 年 前
コミット
b347fbf1b5

+ 6 - 7
app/src/main/java/com/nextcloud/talk/polls/ui/PollResultsFragment.kt

@@ -84,7 +84,7 @@ class PollResultsFragment(
                 initAdapter()
                 viewModel.setPoll(state.poll)
                 initEditButton(state.showEditButton)
-                initCloseButton(state.showCloseButton)
+                initEndPollButton(state.showEndPollButton)
             }
         }
 
@@ -113,10 +113,10 @@ class PollResultsFragment(
         }
     }
 
-    private fun initCloseButton(showCloseButton: Boolean) {
-        if (showCloseButton) {
-            _binding?.pollResultsClosePollButton?.visibility = View.VISIBLE
-            _binding?.pollResultsClosePollButton?.setOnClickListener {
+    private fun initEndPollButton(showEndPollButton: Boolean) {
+        if (showEndPollButton) {
+            _binding?.pollResultsEndPollButton?.visibility = View.VISIBLE
+            _binding?.pollResultsEndPollButton?.setOnClickListener {
                 AlertDialog.Builder(requireContext())
                     .setTitle(R.string.polls_end_poll)
                     .setMessage(R.string.polls_end_poll_confirm)
@@ -125,10 +125,9 @@ class PollResultsFragment(
                     })
                     .setNegativeButton(R.string.nc_cancel, null)
                     .show()
-
             }
         } else {
-            _binding?.pollResultsClosePollButton?.visibility = View.GONE
+            _binding?.pollResultsEndPollButton?.visibility = View.GONE
         }
     }
 

+ 4 - 4
app/src/main/java/com/nextcloud/talk/polls/ui/PollVoteFragment.kt

@@ -80,11 +80,11 @@ class PollVoteFragment(
         parentViewModel.viewState.observe(viewLifecycleOwner) { state ->
             if (state is PollMainViewModel.PollVoteState) {
                 initPollOptions(state.poll)
-                initCloseButton(state.showCloseButton)
+                initEndPollButton(state.showEndPollButton)
                 updateSubmitButton()
             } else if (state is PollMainViewModel.PollVoteHiddenState) {
                 initPollOptions(state.poll)
-                initCloseButton(state.showCloseButton)
+                initEndPollButton(state.showEndPollButton)
                 updateSubmitButton()
             }
         }
@@ -168,8 +168,8 @@ class PollVoteFragment(
         }
     }
 
-    private fun initCloseButton(showCloseButton: Boolean) {
-        if (showCloseButton) {
+    private fun initEndPollButton(showEndPollButton: Boolean) {
+        if (showEndPollButton) {
             _binding?.pollVoteEndPollButton?.visibility = View.VISIBLE
             _binding?.pollVoteEndPollButton?.setOnClickListener {
                 AlertDialog.Builder(requireContext())

+ 3 - 3
app/src/main/java/com/nextcloud/talk/polls/viewmodels/PollMainViewModel.kt

@@ -38,18 +38,18 @@ class PollMainViewModel @Inject constructor(private val repository: PollReposito
     object InitialState : ViewState
     open class PollVoteState(
         val poll: Poll,
-        val showCloseButton: Boolean
+        val showEndPollButton: Boolean
     ) : ViewState
 
     open class PollVoteHiddenState(
         val poll: Poll,
-        val showCloseButton: Boolean
+        val showEndPollButton: Boolean
     ) : ViewState
 
     open class PollResultState(
         val poll: Poll,
         val showEditButton: Boolean,
-        val showCloseButton: Boolean
+        val showEndPollButton: Boolean
     ) : ViewState
 
     private val _viewState: MutableLiveData<ViewState> = MutableLiveData(InitialState)

+ 1 - 1
app/src/main/res/layout/dialog_poll_results.xml

@@ -38,7 +38,7 @@
     </LinearLayout>
 
     <com.google.android.material.button.MaterialButton
-        android:id="@+id/poll_results_close_poll_button"
+        android:id="@+id/poll_results_end_poll_button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="@string/polls_end_poll"