mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-20 19:38:27 +00:00
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:
parent
482d6a2075
commit
09f4cfb1ad
@ -8,8 +8,10 @@ import android.util.AttributeSet
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.core.view.children
|
import androidx.core.view.children
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
|
import kotlinx.android.synthetic.main.album_thumbnail_many.view.*
|
||||||
import kotlinx.android.synthetic.main.album_thumbnail_view.view.*
|
import kotlinx.android.synthetic.main.album_thumbnail_view.view.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.thoughtcrime.securesms.MediaPreviewActivity
|
import org.thoughtcrime.securesms.MediaPreviewActivity
|
||||||
@ -23,6 +25,10 @@ import org.thoughtcrime.securesms.mms.Slide
|
|||||||
|
|
||||||
class AlbumThumbnailView : FrameLayout {
|
class AlbumThumbnailView : FrameLayout {
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val MAX_ALBUM_DISPLAY_SIZE = 5
|
||||||
|
}
|
||||||
|
|
||||||
// region Lifecycle
|
// region Lifecycle
|
||||||
constructor(context: Context) : super(context) {
|
constructor(context: Context) : super(context) {
|
||||||
initialize()
|
initialize()
|
||||||
@ -94,6 +100,12 @@ class AlbumThumbnailView : FrameLayout {
|
|||||||
if (slides.size != this.slideSize) {
|
if (slides.size != this.slideSize) {
|
||||||
albumCellContainer.removeAllViews()
|
albumCellContainer.removeAllViews()
|
||||||
LayoutInflater.from(context).inflate(layoutRes(slides.size), albumCellContainer)
|
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
|
this.slideSize = slides.size
|
||||||
}
|
}
|
||||||
// iterate binding
|
// iterate binding
|
||||||
|
@ -19,7 +19,7 @@ import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView
|
|||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import kotlin.math.sin
|
import kotlin.math.sin
|
||||||
|
|
||||||
class ThumbnailProgressBar: View, ValueAnimator.AnimatorUpdateListener {
|
class ThumbnailProgressBar: View {
|
||||||
|
|
||||||
constructor(context: Context) : super(context)
|
constructor(context: Context) : super(context)
|
||||||
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
constructor(context: Context, attrs: AttributeSet) : super(context, attrs)
|
||||||
@ -39,11 +39,6 @@ class ThumbnailProgressBar: View, ValueAnimator.AnimatorUpdateListener {
|
|||||||
private val objectRect = Rect()
|
private val objectRect = Rect()
|
||||||
private val drawingRect = Rect()
|
private val drawingRect = Rect()
|
||||||
|
|
||||||
override fun onAnimationUpdate(animation: ValueAnimator?) {
|
|
||||||
if (animation == null || !isAttachedToWindow) return
|
|
||||||
invalidate()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun dispatchDraw(canvas: Canvas?) {
|
override fun dispatchDraw(canvas: Canvas?) {
|
||||||
if (canvas == null) return
|
if (canvas == null) return
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="28dp"
|
android:textSize="@dimen/text_size"
|
||||||
android:textColor="@color/core_white"
|
android:textColor="@color/core_white"
|
||||||
android:background="@color/transparent_black_40"
|
android:background="@color/transparent_black_40"
|
||||||
tools:text="+2" />
|
tools:text="+2" />
|
||||||
|
@ -23,7 +23,7 @@ class AttachmentDownloadJob(val attachmentID: Long, val databaseMessageID: Long)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
override val maxFailureCount: Int = 20
|
override val maxFailureCount: Int = 100
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val KEY: String = "AttachmentDownloadJob"
|
val KEY: String = "AttachmentDownloadJob"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user