Updated on 2026-08-14
This commit is contained in:
parent
0ec0d79028
commit
9034dcd682
5 changed files with 9 additions and 13 deletions
|
|
@ -1,7 +1,7 @@
|
|||
package com.tangem.tap.common.entities
|
||||
|
||||
import com.tangem.tap.common.toggleWidget.ProgressState
|
||||
import com.tangem.tap.features.send.redux.states.ButtonState
|
||||
import com.tangem.tap.features.wallet.redux.ProgressState
|
||||
|
||||
open class Button(val enabled: Boolean)
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ open class IndeterminateProgressButton(
|
|||
|
||||
val progressState: ProgressState
|
||||
get() = when (state) {
|
||||
ButtonState.PROGRESS -> ProgressState.Progress()
|
||||
else -> ProgressState.None
|
||||
ButtonState.PROGRESS -> ProgressState.Loading
|
||||
else -> ProgressState.Done
|
||||
}
|
||||
}
|
||||
|
|
@ -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