rename close poll to end poll (in code)

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-06-30 13:23:48 +02:00 committed by Andy Scherzinger (Rebase PR Action)
parent bd99245c26
commit b347fbf1b5
4 changed files with 14 additions and 15 deletions

View File

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

View File

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

View File

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

View File

@ -38,7 +38,7 @@
</LinearLayout> </LinearLayout>
<com.google.android.material.button.MaterialButton <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_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/polls_end_poll" android:text="@string/polls_end_poll"