Add blur and adjust layout for story error slate.
This commit is contained in:
parent
2d60a88a75
commit
98194c854a
5 changed files with 51 additions and 16 deletions
|
@ -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)
|
||||
|
|
9
app/src/main/res/drawable/ic_arrow_down_24.xml
Normal file
9
app/src/main/res/drawable/ic_arrow_down_24.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M19.47,11.409l-5.471,5.471l-1.249,1.559l0,-14.439l-1.5,0l0,14.439l-1.249,-1.559l-5.471,-5.471l-1.06,1.061l8.53,8.53l8.53,-8.53l-1.06,-1.061z"/>
|
||||
</vector>
|
|
@ -6,35 +6,46 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:parentTag="android.widget.FrameLayout">
|
||||
|
||||
<View
|
||||
<ImageView
|
||||
android:id="@+id/background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/core_grey_80"
|
||||
android:importantForAccessibility="no"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.google.android.material.imageview.ShapeableImageView
|
||||
android:id="@+id/stories_error_background"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_gravity="center"
|
||||
app:shapeAppearance="@style/ShapeAppearanceOverlay.Signal.Circle"
|
||||
app:srcCompat="@color/transparent_black_50" />
|
||||
|
||||
<com.google.android.material.progressindicator.CircularProgressIndicator
|
||||
android:id="@+id/loading_spinner"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_gravity="center"
|
||||
android:indeterminate="true"
|
||||
android:visibility="gone"
|
||||
app:indicatorColor="@color/core_grey_05"
|
||||
app:indicatorInset="0dp"
|
||||
app:indicatorSize="64dp"
|
||||
app:indicatorSize="36dp"
|
||||
app:trackColor="@color/transparent"
|
||||
app:trackThickness="3dp"
|
||||
app:trackThickness="2dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<View
|
||||
<ImageView
|
||||
android:id="@+id/error_circle"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="64dp"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/stories_slate_indicator_ring"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="gone"
|
||||
app:srcCompat="@drawable/ic_arrow_down_24"
|
||||
app:tint="@color/core_white"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
|
|
|
@ -36,7 +36,7 @@ class StoryViewerViewModelTest {
|
|||
whenever(repository.getStories(any())).doReturn(Single.just(stories))
|
||||
|
||||
// WHEN
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, repository)
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, null, repository)
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// THEN
|
||||
|
@ -52,7 +52,7 @@ class StoryViewerViewModelTest {
|
|||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = RecipientId.from(1L)
|
||||
whenever(repository.getStories(any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, repository)
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, null, repository)
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// WHEN
|
||||
|
@ -72,7 +72,7 @@ class StoryViewerViewModelTest {
|
|||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.last()
|
||||
whenever(repository.getStories(any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, repository)
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, null, repository)
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// WHEN
|
||||
|
@ -92,7 +92,7 @@ class StoryViewerViewModelTest {
|
|||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.last()
|
||||
whenever(repository.getStories(any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, repository)
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, null, repository)
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// WHEN
|
||||
|
@ -112,7 +112,7 @@ class StoryViewerViewModelTest {
|
|||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.first()
|
||||
whenever(repository.getStories(any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, repository)
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, null, repository)
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// WHEN
|
||||
|
@ -132,7 +132,7 @@ class StoryViewerViewModelTest {
|
|||
val stories: List<RecipientId> = (1L..5L).map(RecipientId::from)
|
||||
val startStory = stories.first()
|
||||
whenever(repository.getStories(any())).doReturn(Single.just(stories))
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, repository)
|
||||
val testSubject = StoryViewerViewModel(startStory, false, null, null, null, repository)
|
||||
testScheduler.triggerActions()
|
||||
|
||||
// WHEN
|
||||
|
|
Loading…
Add table
Reference in a new issue