Add add to story handling and icon in my story row.
This commit is contained in:
parent
14f9a3c155
commit
e6829a1b7a
8 changed files with 52 additions and 21 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="44dp"
|
||||
android:height="44dp"
|
||||
android:viewportWidth="44"
|
||||
android:viewportHeight="44">
|
||||
<group>
|
||||
<clip-path
|
||||
android:pathData="M0,0h44v44h-44z"/>
|
||||
android:width="10dp"
|
||||
android:height="10dp"
|
||||
android:viewportWidth="10"
|
||||
android:viewportHeight="10">
|
||||
<path
|
||||
android:pathData="M-0.0001,21.9853L8.4852,30.4706V25.9345C10.1857,25.7121 16.0929,25 22,25C27.8734,25 33.7468,25.704 35.4852,25.9306V30.5L43.9705,22.0147L35.4852,13.5294V18.0585C33.5652,18.2725 26.6913,19 22,19C17.2843,19 10.3633,18.2649 8.4852,18.0552V13.5L-0.0001,21.9853Z"
|
||||
android:fillColor="#ffffff"
|
||||
android:fillType="evenOdd"/>
|
||||
</group>
|
||||
android:fillColor="@color/signal_colorBackground"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M5,0C4.655,0 4.375,0.28 4.375,0.625V4.375H0.625C0.28,4.375 0,4.655 0,5C0,5.345 0.28,5.625 0.625,5.625H4.375L4.375,9.375C4.375,9.72 4.655,10 5,10C5.345,10 5.625,9.72 5.625,9.375L5.625,5.625L9.375,5.625C9.72,5.625 10,5.345 10,5C10,4.655 9.72,4.375 9.375,4.375L5.625,4.375V0.625C5.625,0.28 5.345,0 5,0Z" />
|
||||
</vector>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,12m-10.5,0a10.5,10.5 0,1 1,21 0a10.5,10.5 0,1 1,-21 0"
|
||||
android:strokeWidth="3"
|
||||
android:fillColor="@color/signal_colorPrimary"
|
||||
android:strokeColor="@color/signal_colorBackground"/>
|
||||
</vector>
|
|
@ -41,8 +41,7 @@
|
|||
app:layout_constraintEnd_toStartOf="@id/text"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="@id/bubble"
|
||||
app:layout_constraintTop_toTopOf="@id/bubble"
|
||||
app:srcCompat="@drawable/ic_union" />
|
||||
app:layout_constraintTop_toTopOf="@id/bubble" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text"
|
||||
|
|
|
@ -26,6 +26,19 @@
|
|||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/add_to_story"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="28dp"
|
||||
android:background="@drawable/stories_my_story_add_background"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar"
|
||||
app:srcCompat="@drawable/ic_union" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/sender"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -14,15 +14,17 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<org.thoughtcrime.securesms.badges.BadgeImageView
|
||||
android:id="@+id/badge"
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/add_to_story"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginTop="28dp"
|
||||
app:badge_size="medium"
|
||||
android:background="@drawable/stories_my_story_add_background"
|
||||
android:scaleType="centerInside"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar" />
|
||||
app:layout_constraintTop_toTopOf="@id/avatar"
|
||||
app:srcCompat="@drawable/ic_union" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/sender"
|
||||
|
|
Loading…
Add table
Reference in a new issue