mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 08:39:22 +01:00
Add add to story handling and icon in my story row.
This commit is contained in:
committed by
Cody Henthorne
parent
14f9a3c155
commit
e6829a1b7a
@@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.stories.landing
|
||||
import android.view.View
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.avatar.view.AvatarView
|
||||
import org.thoughtcrime.securesms.badges.BadgeImageView
|
||||
import org.thoughtcrime.securesms.components.settings.PreferenceModel
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.util.adapter.mapping.LayoutFactory
|
||||
@@ -30,14 +29,13 @@ object MyStoriesItem {
|
||||
|
||||
private val thumbnail: View = itemView.findViewById(R.id.story)
|
||||
private val avatarView: AvatarView = itemView.findViewById(R.id.avatar)
|
||||
private val badgeView: BadgeImageView = itemView.findViewById(R.id.badge)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
itemView.setOnClickListener { model.onClick() }
|
||||
thumbnail.setOnClickListener { model.onClickThumbnail() }
|
||||
avatarView.setOnClickListener { model.onClickThumbnail() }
|
||||
|
||||
avatarView.displayProfileAvatar(Recipient.self())
|
||||
badgeView.setBadgeFromRecipient(Recipient.self())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +235,9 @@ class StoriesLandingFragment : DSLSettingsFragment(layoutId = R.layout.stories_l
|
||||
},
|
||||
onInfo = { model, preview ->
|
||||
openStoryViewer(model, preview, true)
|
||||
},
|
||||
onAvatarClick = {
|
||||
cameraFab.performClick()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ object StoriesLandingItem {
|
||||
|
||||
class Model(
|
||||
val data: StoriesLandingItemData,
|
||||
val onAvatarClick: () -> Unit,
|
||||
val onRowClick: (Model, View) -> Unit,
|
||||
val onHideStory: (Model) -> Unit,
|
||||
val onForwardStory: (Model) -> Unit,
|
||||
@@ -104,6 +105,7 @@ object StoriesLandingItem {
|
||||
private val date: TextView = itemView.findViewById(R.id.date)
|
||||
private val icon: ImageView = itemView.findViewById(R.id.icon)
|
||||
private val errorIndicator: View = itemView.findViewById(R.id.error_indicator)
|
||||
private val addToStoriesView: View = itemView.findViewById(R.id.add_to_story)
|
||||
|
||||
override fun bind(model: Model) {
|
||||
|
||||
@@ -116,7 +118,7 @@ object StoriesLandingItem {
|
||||
|
||||
if (model.data.storyRecipient.isMyStory) {
|
||||
avatarView.displayProfileAvatar(Recipient.self())
|
||||
badgeView.setBadgeFromRecipient(Recipient.self())
|
||||
badgeView.setBadgeFromRecipient(null)
|
||||
} else {
|
||||
avatarView.displayProfileAvatar(model.data.storyRecipient)
|
||||
badgeView.setBadgeFromRecipient(model.data.storyRecipient)
|
||||
@@ -233,11 +235,18 @@ object StoriesLandingItem {
|
||||
|
||||
if (model.data.storyRecipient.isMyStory) {
|
||||
itemView.setOnLongClickListener(null)
|
||||
avatarView.setOnClickListener {
|
||||
model.onAvatarClick()
|
||||
}
|
||||
addToStoriesView.visible = true
|
||||
} else {
|
||||
itemView.setOnLongClickListener {
|
||||
displayContext(model)
|
||||
true
|
||||
}
|
||||
avatarView.setOnClickListener(null)
|
||||
avatarView.isClickable = false
|
||||
addToStoriesView.visible = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user