Fix thumbnail not being clickable on initial media receive.

This commit is contained in:
Clark 2024-05-29 13:53:21 -04:00 committed by Cody Henthorne
parent 295d4b9466
commit 8bb3d71472
2 changed files with 8 additions and 1 deletions

View file

@ -679,7 +679,7 @@ public class ThumbnailView extends FrameLayout {
private class ThumbnailClickDispatcher implements View.OnClickListener {
@Override
public void onClick(View view) {
boolean controlsVisible = transferControlViewStub.getVisibility() == View.VISIBLE;
boolean controlsVisible = transferControlViewStub.getVisibility() == View.VISIBLE && !transferControlViewStub.get().isGone();
if (thumbnailClickListener != null && !controlsVisible) {
thumbnailClickListener.onClick(view, slide);
} else if (parentClickListener != null) {

View file

@ -41,6 +41,8 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
private var state = TransferControlViewState()
private val progressUpdateDebouncer: ThrottledDebouncer = ThrottledDebouncer(100)
private var mode: Mode = Mode.GONE
init {
tag = uuid
binding = TransferControlsViewBinding.inflate(LayoutInflater.from(context), this)
@ -70,6 +72,10 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
state = newState
}
fun isGone(): Boolean {
return mode == Mode.GONE
}
private fun applyState(currentState: TransferControlViewState) {
val mode = deriveMode(currentState)
verboseLog("New state applying, mode = $mode")
@ -92,6 +98,7 @@ class TransferControlView @JvmOverloads constructor(context: Context, attrs: Att
Mode.RETRY_UPLOADING -> displayRetry(currentState, true)
Mode.GONE -> displayChildrenAsGone()
}
this.mode = mode
}
private fun deriveMode(currentState: TransferControlViewState): Mode {