mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-15 16:55:03 +01:00
Merge pull request #3808 from nextcloud/bugfix/noid/fixesForPolls
Bugfix/noid/fixes for polls
This commit is contained in:
commit
e0837af157
@ -49,10 +49,6 @@ class PollResultVoterViewHolder(
|
|||||||
avatar.loadGuestAvatar(user, displayName!!, false)
|
avatar.loadGuestAvatar(user, displayName!!, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
Participant.ActorType.USERS -> {
|
|
||||||
avatar.loadUserAvatar(user, pollDetail.actorId!!, false, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
Participant.ActorType.FEDERATED -> {
|
Participant.ActorType.FEDERATED -> {
|
||||||
val darkTheme = if (DisplayUtils.isDarkModeOn(binding.root.context)) 1 else 0
|
val darkTheme = if (DisplayUtils.isDarkModeOn(binding.root.context)) 1 else 0
|
||||||
avatar.loadFederatedUserAvatar(
|
avatar.loadFederatedUserAvatar(
|
||||||
@ -66,7 +62,9 @@ class PollResultVoterViewHolder(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {
|
||||||
|
avatar.loadUserAvatar(user, pollDetail.actorId!!, false, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,10 +79,6 @@ class PollResultVotersOverviewViewHolder(
|
|||||||
avatar.loadGuestAvatar(user, displayName!!, false)
|
avatar.loadGuestAvatar(user, displayName!!, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
Participant.ActorType.USERS -> {
|
|
||||||
avatar.loadUserAvatar(user, pollDetail.actorId!!, false, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
Participant.ActorType.FEDERATED -> {
|
Participant.ActorType.FEDERATED -> {
|
||||||
val darkTheme = if (DisplayUtils.isDarkModeOn(binding.root.context)) 1 else 0
|
val darkTheme = if (DisplayUtils.isDarkModeOn(binding.root.context)) 1 else 0
|
||||||
avatar.loadFederatedUserAvatar(
|
avatar.loadFederatedUserAvatar(
|
||||||
@ -96,7 +92,9 @@ class PollResultVotersOverviewViewHolder(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {
|
||||||
|
avatar.loadUserAvatar(user, pollDetail.actorId!!, false, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import androidx.core.os.bundleOf
|
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import autodagger.AutoInjector
|
import autodagger.AutoInjector
|
||||||
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
import com.nextcloud.android.common.ui.theme.utils.ColorRole
|
||||||
@ -27,34 +26,24 @@ class PollLoadingFragment : Fragment() {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var viewThemeUtils: ViewThemeUtils
|
lateinit var viewThemeUtils: ViewThemeUtils
|
||||||
|
|
||||||
var fragmentHeight = 0
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
NextcloudTalkApplication.sharedApplication!!.componentApplication.inject(this)
|
||||||
fragmentHeight = arguments?.getInt(KEY_FRAGMENT_HEIGHT)!!
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||||
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
binding = DialogPollLoadingBinding.inflate(inflater, container, false)
|
||||||
binding.root.layoutParams.height = fragmentHeight
|
binding.root.layoutParams.height = HEIGHT
|
||||||
viewThemeUtils.platform.colorCircularProgressBar(binding.pollLoadingProgressbar, ColorRole.PRIMARY)
|
viewThemeUtils.platform.colorCircularProgressBar(binding.pollLoadingProgressbar, ColorRole.PRIMARY)
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val TAG = PollLoadingFragment::class.java.simpleName
|
private const val HEIGHT = 300
|
||||||
private const val KEY_FRAGMENT_HEIGHT = "keyFragmentHeight"
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(fragmentHeight: Int): PollLoadingFragment {
|
fun newInstance(): PollLoadingFragment {
|
||||||
val args = bundleOf(
|
return PollLoadingFragment()
|
||||||
KEY_FRAGMENT_HEIGHT to fragmentHeight
|
|
||||||
)
|
|
||||||
|
|
||||||
val fragment = PollLoadingFragment()
|
|
||||||
fragment.arguments = args
|
|
||||||
return fragment
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,33 +90,31 @@ class PollMainDialogFragment : DialogFragment() {
|
|||||||
initVotersAmount(state.showVotersAmount, state.poll.numVoters, false)
|
initVotersAmount(state.showVotersAmount, state.poll.numVoters, false)
|
||||||
showVoteScreen()
|
showVoteScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
is PollMainViewModel.PollResultState -> {
|
is PollMainViewModel.PollResultState -> {
|
||||||
initVotersAmount(state.showVotersAmount, state.poll.numVoters, true)
|
initVotersAmount(state.showVotersAmount, state.poll.numVoters, true)
|
||||||
showResultsScreen()
|
showResultsScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
is PollMainViewModel.LoadingState -> {
|
is PollMainViewModel.LoadingState -> {
|
||||||
showLoadingScreen()
|
showLoadingScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
is PollMainViewModel.DismissDialogState -> {
|
is PollMainViewModel.DismissDialogState -> {
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun showLoadingScreen() {
|
private fun showLoadingScreen() {
|
||||||
binding.root.post {
|
val contentFragment = PollLoadingFragment.newInstance()
|
||||||
run {
|
|
||||||
val fragmentHeight = binding.messagePollContentFragment.measuredHeight
|
|
||||||
|
|
||||||
val contentFragment = PollLoadingFragment.newInstance(fragmentHeight)
|
|
||||||
val transaction = childFragmentManager.beginTransaction()
|
val transaction = childFragmentManager.beginTransaction()
|
||||||
transaction.replace(binding.messagePollContentFragment.id, contentFragment)
|
transaction.replace(binding.messagePollContentFragment.id, contentFragment)
|
||||||
transaction.commit()
|
transaction.commit()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun showVoteScreen() {
|
private fun showVoteScreen() {
|
||||||
val contentFragment = PollVoteFragment.newInstance()
|
val contentFragment = PollVoteFragment.newInstance()
|
||||||
|
@ -15,7 +15,6 @@ import android.view.View
|
|||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.CheckBox
|
import android.widget.CheckBox
|
||||||
import android.widget.CompoundButton
|
import android.widget.CompoundButton
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.widget.RadioButton
|
import android.widget.RadioButton
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
@ -139,16 +138,9 @@ class PollVoteFragment : Fragment() {
|
|||||||
} else {
|
} else {
|
||||||
binding.voteOptionsCheckboxesWrapper.removeAllViews()
|
binding.voteOptionsCheckboxesWrapper.removeAllViews()
|
||||||
|
|
||||||
val layoutParams = LinearLayout.LayoutParams(
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT,
|
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
|
||||||
)
|
|
||||||
layoutParams.marginStart = CHECKBOX_MARGIN_LEFT
|
|
||||||
|
|
||||||
poll.options?.map { option ->
|
poll.options?.map { option ->
|
||||||
CheckBox(context).apply {
|
CheckBox(context).apply {
|
||||||
text = option
|
text = option
|
||||||
setLayoutParams(layoutParams)
|
|
||||||
}
|
}
|
||||||
}?.forEachIndexed { index, checkBox ->
|
}?.forEachIndexed { index, checkBox ->
|
||||||
viewThemeUtils.platform.themeCheckbox(checkBox)
|
viewThemeUtils.platform.themeCheckbox(checkBox)
|
||||||
@ -216,7 +208,6 @@ class PollVoteFragment : Fragment() {
|
|||||||
companion object {
|
companion object {
|
||||||
private val TAG = PollVoteFragment::class.java.simpleName
|
private val TAG = PollVoteFragment::class.java.simpleName
|
||||||
private const val UNLIMITED_VOTES = 0
|
private const val UNLIMITED_VOTES = 0
|
||||||
private const val CHECKBOX_MARGIN_LEFT = -18
|
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun newInstance(): PollVoteFragment {
|
fun newInstance(): PollVoteFragment {
|
||||||
|
Loading…
Reference in New Issue
Block a user