Updated on 2026-08-14
This commit is contained in:
parent
0ec0d79028
commit
9034dcd682
5 changed files with 9 additions and 13 deletions
|
|
@ -5,6 +5,7 @@ import android.view.View
|
|||
import com.google.android.material.button.MaterialButton
|
||||
import com.tangem.tap.common.extensions.hide
|
||||
import com.tangem.tap.common.extensions.show
|
||||
import com.tangem.tap.features.wallet.redux.ProgressState
|
||||
|
||||
/**
|
||||
[REDACTED_AUTHOR]
|
||||
|
|
@ -12,7 +13,7 @@ import com.tangem.tap.common.extensions.show
|
|||
open class IndeterminateProgressButtonWidget(
|
||||
private val button: MaterialButton,
|
||||
private val progress: View,
|
||||
initialState: ProgressState = ProgressState.None
|
||||
initialState: ProgressState = ProgressState.Done
|
||||
) : ViewStateWidget {
|
||||
|
||||
private var initialButtonText: CharSequence = button.text
|
||||
|
|
@ -29,8 +30,8 @@ open class IndeterminateProgressButtonWidget(
|
|||
val progressState = state as? ProgressState ?: return
|
||||
|
||||
when (progressState) {
|
||||
is ProgressState.None -> switchToNone()
|
||||
is ProgressState.Progress -> switchToProgress()
|
||||
ProgressState.Done, ProgressState.Error -> switchToNone()
|
||||
ProgressState.Loading -> switchToProgress()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,4 @@ interface WidgetState
|
|||
interface ViewStateWidget {
|
||||
val mainView: View
|
||||
fun changeState(state: WidgetState)
|
||||
}
|
||||
|
||||
sealed class ProgressState : WidgetState {
|
||||
object None : ProgressState()
|
||||
data class Progress(val progress: Int = 0) : ProgressState()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue