mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 12:08:34 +00:00
Do not display stop icon on uncancelable progress.
This commit is contained in:
committed by
Cody Henthorne
parent
64457b0235
commit
97c1ace020
@@ -385,7 +385,8 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
|
||||
}
|
||||
|
||||
binding.secondaryProgressView.startClickListener = currentState.downloadClickedListener
|
||||
applyFocusableAndClickable(currentState,
|
||||
applyFocusableAndClickable(
|
||||
currentState,
|
||||
listOf(binding.secondaryProgressView, binding.secondaryDetailsText, binding.secondaryBackground),
|
||||
listOf(binding.primaryProgressView, binding.playVideoButton)
|
||||
)
|
||||
|
||||
@@ -89,7 +89,8 @@ class TransferProgressView @JvmOverloads constructor(
|
||||
super.onDraw(canvas)
|
||||
|
||||
when (currentState) {
|
||||
State.IN_PROGRESS_CANCELABLE, State.IN_PROGRESS_NON_CANCELABLE -> drawProgress(canvas, progressPercent)
|
||||
State.IN_PROGRESS_CANCELABLE -> drawProgress(canvas, progressPercent, true)
|
||||
State.IN_PROGRESS_NON_CANCELABLE -> drawProgress(canvas, progressPercent, false)
|
||||
State.READY_TO_UPLOAD -> sizeAndDrawDrawable(canvas, uploadDrawable)
|
||||
State.READY_TO_DOWNLOAD -> sizeAndDrawDrawable(canvas, downloadDrawable)
|
||||
State.UNINITIALIZED -> Unit
|
||||
@@ -126,11 +127,13 @@ class TransferProgressView @JvmOverloads constructor(
|
||||
invalidate()
|
||||
}
|
||||
|
||||
private fun drawProgress(canvas: Canvas, progressPercent: Float) {
|
||||
stopIconRect.set(0f, 0f, stopIconSize, stopIconSize)
|
||||
private fun drawProgress(canvas: Canvas, progressPercent: Float, showStopIcon: Boolean) {
|
||||
if (showStopIcon) {
|
||||
stopIconRect.set(0f, 0f, stopIconSize, stopIconSize)
|
||||
|
||||
canvas.withTranslation(width / 2 - (stopIconSize / 2), height / 2 - (stopIconSize / 2)) {
|
||||
drawRoundRect(stopIconRect, stopIconCornerRadius, stopIconCornerRadius, stopIconPaint)
|
||||
canvas.withTranslation(width / 2 - (stopIconSize / 2), height / 2 - (stopIconSize / 2)) {
|
||||
drawRoundRect(stopIconRect, stopIconCornerRadius, stopIconCornerRadius, stopIconPaint)
|
||||
}
|
||||
}
|
||||
|
||||
val trackWidthScaled = progressArcStrokeWidth
|
||||
|
||||
Reference in New Issue
Block a user