toggle details view on click on avatar views

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2022-07-22 09:07:27 +02:00 committed by Andy Scherzinger (Rebase PR Action)
parent 20dabf3a72
commit 64412a1876
5 changed files with 8 additions and 4 deletions

View file

@ -32,7 +32,7 @@ class PollResultHeaderViewHolder(
override fun bind(pollResultItem: PollResultItem, clickListener: PollResultItemClickListener) { override fun bind(pollResultItem: PollResultItem, clickListener: PollResultItemClickListener) {
val item = pollResultItem as PollResultHeaderItem val item = pollResultItem as PollResultHeaderItem
binding.root.setOnClickListener { clickListener.onClick(pollResultItem) } binding.root.setOnClickListener { clickListener.onClick() }
binding.pollOptionText.text = item.name binding.pollOptionText.text = item.name
binding.pollOptionPercentText.text = "${item.percent}%" binding.pollOptionPercentText.text = "${item.percent}%"

View file

@ -21,5 +21,5 @@
package com.nextcloud.talk.polls.adapters package com.nextcloud.talk.polls.adapters
interface PollResultItemClickListener { interface PollResultItemClickListener {
fun onClick(pollResultHeaderItem: PollResultHeaderItem) fun onClick()
} }

View file

@ -40,6 +40,9 @@ class PollResultVoterViewHolder(
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun bind(pollResultItem: PollResultItem, clickListener: PollResultItemClickListener) { override fun bind(pollResultItem: PollResultItem, clickListener: PollResultItemClickListener) {
val item = pollResultItem as PollResultVoterItem val item = pollResultItem as PollResultVoterItem
binding.root.setOnClickListener { clickListener.onClick() }
binding.pollVoterName.text = item.details.actorDisplayName binding.pollVoterName.text = item.details.actorDisplayName
binding.pollVoterAvatar.controller = getAvatarDraweeController(item.details) binding.pollVoterAvatar.controller = getAvatarDraweeController(item.details)
} }

View file

@ -44,6 +44,8 @@ class PollResultVotersOverviewViewHolder(
override fun bind(pollResultItem: PollResultItem, clickListener: PollResultItemClickListener) { override fun bind(pollResultItem: PollResultItem, clickListener: PollResultItemClickListener) {
val item = pollResultItem as PollResultVotersOverviewItem val item = pollResultItem as PollResultVotersOverviewItem
binding.root.setOnClickListener { clickListener.onClick() }
val lp = LinearLayout.LayoutParams( val lp = LinearLayout.LayoutParams(
AVATAR_WIDTH, AVATAR_WIDTH,
AVATAR_HEIGHT AVATAR_HEIGHT

View file

@ -34,7 +34,6 @@ import autodagger.AutoInjector
import com.nextcloud.talk.R import com.nextcloud.talk.R
import com.nextcloud.talk.application.NextcloudTalkApplication import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.databinding.DialogPollResultsBinding import com.nextcloud.talk.databinding.DialogPollResultsBinding
import com.nextcloud.talk.polls.adapters.PollResultHeaderItem
import com.nextcloud.talk.polls.adapters.PollResultItemClickListener import com.nextcloud.talk.polls.adapters.PollResultItemClickListener
import com.nextcloud.talk.polls.adapters.PollResultsAdapter import com.nextcloud.talk.polls.adapters.PollResultsAdapter
import com.nextcloud.talk.polls.viewmodels.PollMainViewModel import com.nextcloud.talk.polls.viewmodels.PollMainViewModel
@ -127,7 +126,7 @@ class PollResultsFragment : Fragment(), PollResultItemClickListener {
} }
} }
override fun onClick(pollResultHeaderItem: PollResultHeaderItem) { override fun onClick() {
viewModel.toggleDetails() viewModel.toggleDetails()
} }