mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-22 20:18:36 +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
|
binding.secondaryProgressView.startClickListener = currentState.downloadClickedListener
|
||||||
applyFocusableAndClickable(currentState,
|
applyFocusableAndClickable(
|
||||||
|
currentState,
|
||||||
listOf(binding.secondaryProgressView, binding.secondaryDetailsText, binding.secondaryBackground),
|
listOf(binding.secondaryProgressView, binding.secondaryDetailsText, binding.secondaryBackground),
|
||||||
listOf(binding.primaryProgressView, binding.playVideoButton)
|
listOf(binding.primaryProgressView, binding.playVideoButton)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ class TransferProgressView @JvmOverloads constructor(
|
|||||||
super.onDraw(canvas)
|
super.onDraw(canvas)
|
||||||
|
|
||||||
when (currentState) {
|
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_UPLOAD -> sizeAndDrawDrawable(canvas, uploadDrawable)
|
||||||
State.READY_TO_DOWNLOAD -> sizeAndDrawDrawable(canvas, downloadDrawable)
|
State.READY_TO_DOWNLOAD -> sizeAndDrawDrawable(canvas, downloadDrawable)
|
||||||
State.UNINITIALIZED -> Unit
|
State.UNINITIALIZED -> Unit
|
||||||
@@ -126,11 +127,13 @@ class TransferProgressView @JvmOverloads constructor(
|
|||||||
invalidate()
|
invalidate()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun drawProgress(canvas: Canvas, progressPercent: Float) {
|
private fun drawProgress(canvas: Canvas, progressPercent: Float, showStopIcon: Boolean) {
|
||||||
stopIconRect.set(0f, 0f, stopIconSize, stopIconSize)
|
if (showStopIcon) {
|
||||||
|
stopIconRect.set(0f, 0f, stopIconSize, stopIconSize)
|
||||||
|
|
||||||
canvas.withTranslation(width / 2 - (stopIconSize / 2), height / 2 - (stopIconSize / 2)) {
|
canvas.withTranslation(width / 2 - (stopIconSize / 2), height / 2 - (stopIconSize / 2)) {
|
||||||
drawRoundRect(stopIconRect, stopIconCornerRadius, stopIconCornerRadius, stopIconPaint)
|
drawRoundRect(stopIconRect, stopIconCornerRadius, stopIconCornerRadius, stopIconPaint)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val trackWidthScaled = progressArcStrokeWidth
|
val trackWidthScaled = progressArcStrokeWidth
|
||||||
|
|||||||
Reference in New Issue
Block a user