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