mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-26 12:44:38 +00:00
Add blur and adjust layout for story error slate.
This commit is contained in:
committed by
Greyson Parrelli
parent
2d60a88a75
commit
98194c854a
@@ -6,11 +6,14 @@ import android.os.Parcelable
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.blurhash.BlurHash
|
||||
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies
|
||||
import org.thoughtcrime.securesms.jobmanager.impl.NetworkConstraint
|
||||
import org.thoughtcrime.securesms.mms.GlideApp
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
|
||||
/**
|
||||
@@ -36,7 +39,7 @@ class StorySlateView @JvmOverloads constructor(
|
||||
inflate(context, R.layout.stories_slate_view, this)
|
||||
}
|
||||
|
||||
private val background: View = findViewById(R.id.background)
|
||||
private val background: ImageView = findViewById(R.id.background)
|
||||
private val loadingSpinner: View = findViewById(R.id.loading_spinner)
|
||||
private val errorCircle: View = findViewById(R.id.error_circle)
|
||||
private val unavailableText: View = findViewById(R.id.unavailable)
|
||||
@@ -68,6 +71,16 @@ class StorySlateView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
fun setBackground(blur: BlurHash?) {
|
||||
if (blur != null) {
|
||||
GlideApp.with(background)
|
||||
.load(blur)
|
||||
.into(background)
|
||||
} else {
|
||||
GlideApp.with(background).clear(background)
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveToProgressState(state: State) {
|
||||
this.state = state
|
||||
visible = true
|
||||
|
||||
@@ -541,6 +541,8 @@ class StoryViewerPageFragment :
|
||||
}
|
||||
|
||||
private fun presentSlate(post: StoryPost) {
|
||||
storySlate.setBackground((post.conversationMessage.messageRecord as? MediaMmsMessageRecord)?.slideDeck?.thumbnailSlide?.placeholderBlur)
|
||||
|
||||
when (post.content.transferState) {
|
||||
AttachmentDatabase.TRANSFER_PROGRESS_DONE -> {
|
||||
storySlate.moveToState(StorySlateView.State.HIDDEN, post.id)
|
||||
|
||||
Reference in New Issue
Block a user