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()
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
}
}

View File

@ -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())

View File

@ -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)

View File

@ -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"