mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-21 10:17:56 +00:00
Add polish to story replies button and direct reply sheet.
This commit is contained in:
committed by
Cody Henthorne
parent
e51841a28b
commit
987f69227a
@@ -24,6 +24,7 @@ import androidx.fragment.app.DialogFragment
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.LiveDataReactiveStreams
|
||||
import com.google.android.material.button.MaterialButton
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import org.signal.core.util.DimensionUnit
|
||||
@@ -82,7 +83,7 @@ class StoryViewerPageFragment :
|
||||
|
||||
private lateinit var progressBar: SegmentedProgressBar
|
||||
private lateinit var storySlate: StorySlateView
|
||||
private lateinit var viewsAndReplies: TextView
|
||||
private lateinit var viewsAndReplies: MaterialButton
|
||||
private lateinit var storyCrossfader: StoriesSharedElementCrossFaderView
|
||||
private lateinit var blurContainer: ImageView
|
||||
private lateinit var storyCaptionContainer: FrameLayout
|
||||
@@ -714,14 +715,25 @@ class StoryViewerPageFragment :
|
||||
|
||||
if (Recipient.self() == post.sender) {
|
||||
if (post.replyCount == 0) {
|
||||
viewsAndReplies.setIconResource(R.drawable.ic_chevron_end_24)
|
||||
viewsAndReplies.iconGravity = MaterialButton.ICON_GRAVITY_TEXT_END
|
||||
viewsAndReplies.text = views
|
||||
} else {
|
||||
viewsAndReplies.setIconResource(R.drawable.ic_chevron_end_24)
|
||||
viewsAndReplies.iconGravity = MaterialButton.ICON_GRAVITY_TEXT_END
|
||||
viewsAndReplies.text = getString(R.string.StoryViewerFragment__s_s, views, replies)
|
||||
}
|
||||
} else if (post.replyCount > 0) {
|
||||
viewsAndReplies.setIconResource(R.drawable.ic_chevron_end_24)
|
||||
viewsAndReplies.iconGravity = MaterialButton.ICON_GRAVITY_TEXT_END
|
||||
viewsAndReplies.text = replies
|
||||
} else if (post.group != null) {
|
||||
viewsAndReplies.setIconResource(R.drawable.ic_reply_24_outline)
|
||||
viewsAndReplies.iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
|
||||
viewsAndReplies.setText(R.string.StoryViewerPageFragment__reply_to_group)
|
||||
} else {
|
||||
|
||||
viewsAndReplies.setIconResource(R.drawable.ic_reply_24_outline)
|
||||
viewsAndReplies.iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
|
||||
viewsAndReplies.setText(R.string.StoryViewerPageFragment__reply)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,8 +110,10 @@ class StoryDirectReplyDialogFragment :
|
||||
}
|
||||
|
||||
viewModel.state.observe(viewLifecycleOwner) { state ->
|
||||
if (state.recipient != null) {
|
||||
composer.displayPrivacyChrome(state.recipient)
|
||||
if (state.groupDirectReplyRecipient != null) {
|
||||
composer.displayPrivacyChrome(state.groupDirectReplyRecipient)
|
||||
} else if (state.storyRecord != null) {
|
||||
composer.displayPrivacyChrome(state.storyRecord.recipient)
|
||||
}
|
||||
|
||||
if (state.storyRecord != null) {
|
||||
|
||||
@@ -4,6 +4,6 @@ import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
|
||||
data class StoryDirectReplyState(
|
||||
val recipient: Recipient? = null,
|
||||
val groupDirectReplyRecipient: Recipient? = null,
|
||||
val storyRecord: MessageRecord? = null
|
||||
)
|
||||
|
||||
@@ -24,7 +24,7 @@ class StoryDirectReplyViewModel(
|
||||
init {
|
||||
if (groupDirectReplyRecipientId != null) {
|
||||
store.update(Recipient.live(groupDirectReplyRecipientId).liveDataResolved) { recipient, state ->
|
||||
state.copy(recipient = recipient)
|
||||
state.copy(groupDirectReplyRecipient = recipient)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user