mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-24 14:05:40 +03:00
toggle details view on click on avatar views
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
parent
20dabf3a72
commit
64412a1876
5 changed files with 8 additions and 4 deletions
|
@ -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}%"
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue