From f74c33107be5ae3f0f496cdbaf7ea9b55a51b56d Mon Sep 17 00:00:00 2001 From: Ahmad Ansori Palembani Date: Sat, 24 Aug 2024 13:47:58 +0700 Subject: [PATCH] chore: Set default text value to blank --- .../presentation/component/LoadingButtonComposeView.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/yokai/presentation/component/LoadingButtonComposeView.kt b/app/src/main/java/yokai/presentation/component/LoadingButtonComposeView.kt index 949c5b6993..195e7ce736 100644 --- a/app/src/main/java/yokai/presentation/component/LoadingButtonComposeView.kt +++ b/app/src/main/java/yokai/presentation/component/LoadingButtonComposeView.kt @@ -23,7 +23,7 @@ class LoadingButtonComposeView @JvmOverloads constructor( defStyleAttr: Int = 0, ) : AbstractComposeView(context, attrs, defStyleAttr) { - var text by mutableStateOf("placeholder") + var text by mutableStateOf("") private var onClick: () -> Unit = {} private var isLoading by mutableStateOf(false) @@ -32,7 +32,9 @@ class LoadingButtonComposeView @JvmOverloads constructor( setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnDetachedFromWindowOrReleasedFromPool) attrs?.let { 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) + } } }