kopia lustrzana https://github.com/ryukoposting/Signal-Android
Fix disable state bug with CircularProgressMaterialButton.
rodzic
089a3d386f
commit
a44c3c5c2f
|
@ -12,8 +12,10 @@ import androidx.annotation.StringRes
|
||||||
import androidx.core.animation.doOnEnd
|
import androidx.core.animation.doOnEnd
|
||||||
import androidx.core.content.withStyledAttributes
|
import androidx.core.content.withStyledAttributes
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
|
import com.google.android.material.progressindicator.CircularProgressIndicator
|
||||||
import com.google.android.material.theme.overlay.MaterialThemeOverlay
|
import com.google.android.material.theme.overlay.MaterialThemeOverlay
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
|
import org.thoughtcrime.securesms.util.visible
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,6 +35,7 @@ class CircularProgressMaterialButton @JvmOverloads constructor(
|
||||||
private var animator: Animator? = null
|
private var animator: Animator? = null
|
||||||
|
|
||||||
private val materialButton: MaterialButton = findViewById(R.id.button)
|
private val materialButton: MaterialButton = findViewById(R.id.button)
|
||||||
|
private val progressIndicator: CircularProgressIndicator = findViewById(R.id.progress_indicator)
|
||||||
|
|
||||||
var text: CharSequence?
|
var text: CharSequence?
|
||||||
get() = materialButton.text
|
get() = materialButton.text
|
||||||
|
@ -52,6 +55,12 @@ class CircularProgressMaterialButton @JvmOverloads constructor(
|
||||||
materialButton.setText(resId)
|
materialButton.setText(resId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setEnabled(enabled: Boolean) {
|
||||||
|
super.setEnabled(enabled)
|
||||||
|
materialButton.isEnabled = enabled
|
||||||
|
progressIndicator.visible = enabled
|
||||||
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(): Parcelable {
|
override fun onSaveInstanceState(): Parcelable {
|
||||||
return Bundle().apply {
|
return Bundle().apply {
|
||||||
putParcelable(SUPER_STATE, super.onSaveInstanceState())
|
putParcelable(SUPER_STATE, super.onSaveInstanceState())
|
||||||
|
|
Ładowanie…
Reference in New Issue