chore: Set default text value to blank

This commit is contained in:
Ahmad Ansori Palembani 2024-08-24 13:47:58 +07:00
parent 05bbacda19
commit f74c33107b
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -23,7 +23,7 @@ class LoadingButtonComposeView @JvmOverloads constructor(
defStyleAttr: Int = 0, defStyleAttr: Int = 0,
) : AbstractComposeView(context, attrs, defStyleAttr) { ) : AbstractComposeView(context, attrs, defStyleAttr) {
var text by mutableStateOf("placeholder") var text by mutableStateOf("")
private var onClick: () -> Unit = {} private var onClick: () -> Unit = {}
private var isLoading by mutableStateOf(false) private var isLoading by mutableStateOf(false)
@ -32,7 +32,9 @@ class LoadingButtonComposeView @JvmOverloads constructor(
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindowOrReleasedFromPool) setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindowOrReleasedFromPool)
attrs?.let { attrs?.let {
val arr = context.obtainStyledAttributes(it, R.styleable.LoadingButtonComposeView) val arr = context.obtainStyledAttributes(it, R.styleable.LoadingButtonComposeView)
text = context.getString(arr.getResourceId(R.styleable.LoadingButtonComposeView_android_text, R.string.log_in)) arr.getResourceId(R.styleable.LoadingButtonComposeView_android_text, -1).takeIf { it >= 0 }?.let { resId ->
text = context.getString(resId)
}
} }
} }