From ee595fd2c620223b13b87ced6740bf1474db258f Mon Sep 17 00:00:00 2001 From: theakashdev Date: Sat, 26 Nov 2022 11:31:56 +0530 Subject: [PATCH] ProgressBar improved. --- app/src/main/res/layout/activity_main.xml | 3 +- .../java/com/akashdev/kotlinx/XProgressBar.kt | 31 ------------------- .../src/main/res/layout/x_progress_bar.xml | 2 -- library/src/main/res/values/attrs.xml | 4 +-- 4 files changed, 3 insertions(+), 37 deletions(-) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 97cb231..655694c 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -17,14 +17,15 @@ \ No newline at end of file diff --git a/library/src/main/java/com/akashdev/kotlinx/XProgressBar.kt b/library/src/main/java/com/akashdev/kotlinx/XProgressBar.kt index 3f0ddf5..c8b0894 100644 --- a/library/src/main/java/com/akashdev/kotlinx/XProgressBar.kt +++ b/library/src/main/java/com/akashdev/kotlinx/XProgressBar.kt @@ -23,12 +23,6 @@ class XProgressBar @JvmOverloads constructor( typedArray = context.obtainStyledAttributes(it, R.styleable.XProgressBar) try { - //visibility of progress - binding.mainLayout.isVisible = typedArray.getBoolean( - /* index = */ R.styleable.XProgressBar_isVisible, - /* defValue = */ true - ) - //loading text binding.textLoading.text = typedArray.getString( /* index = */ @@ -40,37 +34,12 @@ class XProgressBar @JvmOverloads constructor( /* index = */ R.styleable.XProgressBar_isVisibleLoadingText, /* defValue = */ true ) - - //background color - binding.mainLayout.setBackgroundColor( - typedArray.getColor( - /* index = */ R.styleable.XProgressBar_backgroundColor, - /* defValue = */ context.getColor(R.color.x_progress_bar_bg_color) - ) - ) - } finally { typedArray.recycle() } } } - var isVisible - get() = typedArray.getBoolean(R.styleable.XProgressBar_isVisible, false) - set(value) { - binding.mainLayout.isVisible = value - } - - var backgroundColor: Int? - get() = typedArray.getColor( - R.styleable.XProgressBar_backgroundColor, - context.getColor(R.color.x_progress_bar_bg_color) - ) - set(value) { - binding.mainLayout.setBackgroundColor(value!!) - } - - var loadingText get() = typedArray.getString(R.styleable.XProgressBar_loadingText) set(value) { diff --git a/library/src/main/res/layout/x_progress_bar.xml b/library/src/main/res/layout/x_progress_bar.xml index 4e76370..d4b3786 100644 --- a/library/src/main/res/layout/x_progress_bar.xml +++ b/library/src/main/res/layout/x_progress_bar.xml @@ -3,10 +3,8 @@ xmlns:app="http://schemas.android.com/apk/res-auto"> diff --git a/library/src/main/res/values/attrs.xml b/library/src/main/res/values/attrs.xml index 8749450..3295725 100644 --- a/library/src/main/res/values/attrs.xml +++ b/library/src/main/res/values/attrs.xml @@ -1,8 +1,6 @@ - - - + \ No newline at end of file