feat: add back overflow text, increase AttachmentDownloadJob.kt max failure count, resize overflow text size, remove unused animator update listener implementation in ThumbnailProgressBar.kt

This commit is contained in:
jubb 2021-06-29 11:22:59 +10:00
parent 482d6a2075
commit 09f4cfb1ad
4 changed files with 15 additions and 8 deletions

View File

@ -8,8 +8,10 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.TextView
import androidx.core.view.children
import androidx.core.view.isVisible
import kotlinx.android.synthetic.main.album_thumbnail_many.view.*
import kotlinx.android.synthetic.main.album_thumbnail_view.view.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.MediaPreviewActivity
@ -23,6 +25,10 @@ import org.thoughtcrime.securesms.mms.Slide
class AlbumThumbnailView : FrameLayout {
companion object {
const val MAX_ALBUM_DISPLAY_SIZE = 5
}
// region Lifecycle
constructor(context: Context) : super(context) {
initialize()
@ -94,6 +100,12 @@ class AlbumThumbnailView : FrameLayout {
if (slides.size != this.slideSize) {
albumCellContainer.removeAllViews()
LayoutInflater.from(context).inflate(layoutRes(slides.size), albumCellContainer)
val overflowed = slides.size > MAX_ALBUM_DISPLAY_SIZE
albumCellContainer.findViewById<TextView>(R.id.album_cell_overflow_text)?.let { overflowText ->
// overflowText will be null if !overflowed
overflowText.isVisible = overflowed // more than max album size
overflowText.text = context.getString(R.string.AlbumThumbnailView_plus, slides.size - MAX_ALBUM_DISPLAY_SIZE)
}
this.slideSize = slides.size
}
// iterate binding

View File

@ -19,7 +19,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
import network.loki.messenger.R
import kotlin.math.sin
class ThumbnailProgressBar: View, ValueAnimator.AnimatorUpdateListener {
class ThumbnailProgressBar: View {
constructor(context: Context) : super(context)
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
@ -39,11 +39,6 @@ class ThumbnailProgressBar: View, ValueAnimator.AnimatorUpdateListener {
private val objectRect = Rect()
private val drawingRect = Rect()
override fun onAnimationUpdate(animation: ValueAnimator?) {
if (animation == null || !isAttachedToWindow) return
invalidate()
}
override fun dispatchDraw(canvas: Canvas?) {
if (canvas == null) return

View File

@ -51,7 +51,7 @@
android:layout_height="match_parent"
android:layout_width="match_parent"
android:gravity="center"
android:textSize="28dp"
android:textSize="@dimen/text_size"
android:textColor="@color/core_white"
android:background="@color/transparent_black_40"
tools:text="+2" />

View File

@ -23,7 +23,7 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
}
// Settings
override val maxFailureCount: Int = 20
override val maxFailureCount: Int = 100
companion object {
val KEY: String = "AttachmentDownloadJob"