diff --git a/app/src/main/java/com/moyerun/moyeorun_android/views/RectangleButton.kt b/app/src/main/java/com/moyerun/moyeorun_android/views/RectangleButton.kt index 1b4bd06..11e9bd3 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/views/RectangleButton.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/views/RectangleButton.kt @@ -2,27 +2,11 @@ package com.moyerun.moyeorun_android.views import android.content.Context import android.util.AttributeSet -import androidx.appcompat.content.res.AppCompatResources.getDrawable +import android.view.ContextThemeWrapper import androidx.appcompat.widget.AppCompatButton -import androidx.core.content.ContextCompat import com.moyerun.moyeorun_android.R class RectangleButton constructor( context: Context, - attributeSet: AttributeSet -) : AppCompatButton(context, attributeSet) { - - init { - val typedArray = context.obtainStyledAttributes(attributeSet, R.styleable.RectangleButton) - - val initialBackground = typedArray.getDrawable(R.styleable.RectangleButton_android_background) - this.background = initialBackground ?: getDrawable(context, R.drawable.shape_rectangle_button) - - val initialTextColor = typedArray.getColor(R.styleable.RectangleButton_android_textColor, ContextCompat.getColor(context, R.color.main_white)) - this.setTextColor(initialTextColor) - - this.textSize = 21F - - typedArray.recycle() - } -} \ No newline at end of file + attrs: AttributeSet? = null +) : AppCompatButton(ContextThemeWrapper(context, R.style.RectangleButtonTheme), attrs) \ No newline at end of file diff --git a/app/src/main/java/com/moyerun/moyeorun_android/views/RoundButton.kt b/app/src/main/java/com/moyerun/moyeorun_android/views/RoundButton.kt index 22d57e3..b3b75ce 100644 --- a/app/src/main/java/com/moyerun/moyeorun_android/views/RoundButton.kt +++ b/app/src/main/java/com/moyerun/moyeorun_android/views/RoundButton.kt @@ -2,19 +2,11 @@ package com.moyerun.moyeorun_android.views import android.content.Context import android.util.AttributeSet -import androidx.appcompat.content.res.AppCompatResources +import android.view.ContextThemeWrapper import androidx.appcompat.widget.AppCompatButton -import androidx.core.content.ContextCompat import com.moyerun.moyeorun_android.R class RoundButton constructor( context: Context, - attributeSet: AttributeSet -) : AppCompatButton(context, attributeSet) { - - init { - this.background = AppCompatResources.getDrawable(context, R.drawable.shape_round_botton) - this.setTextColor(ContextCompat.getColor(context, R.color.main_white)) - this.textSize = 18F - } -} \ No newline at end of file + attrs: AttributeSet? = null +) : AppCompatButton(ContextThemeWrapper(context, R.style.RoundButtonTheme), attrs) \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_rectangle_button.xml b/app/src/main/res/drawable/selector_rectangle_button.xml similarity index 60% rename from app/src/main/res/drawable/shape_rectangle_button.xml rename to app/src/main/res/drawable/selector_rectangle_button.xml index 2793da5..caea89d 100644 --- a/app/src/main/res/drawable/shape_rectangle_button.xml +++ b/app/src/main/res/drawable/selector_rectangle_button.xml @@ -1,10 +1,15 @@ - - + + + + + + + diff --git a/app/src/main/res/drawable/selector_rectangle_button_text.xml b/app/src/main/res/drawable/selector_rectangle_button_text.xml new file mode 100644 index 0000000..5ef8ee7 --- /dev/null +++ b/app/src/main/res/drawable/selector_rectangle_button_text.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/shape_round_botton.xml b/app/src/main/res/drawable/selector_round_button.xml similarity index 61% rename from app/src/main/res/drawable/shape_round_botton.xml rename to app/src/main/res/drawable/selector_round_button.xml index 85637e9..a0c1b1a 100644 --- a/app/src/main/res/drawable/shape_round_botton.xml +++ b/app/src/main/res/drawable/selector_round_button.xml @@ -1,11 +1,17 @@ - + + + + + + + diff --git a/app/src/main/res/drawable/selector_round_button_text.xml b/app/src/main/res/drawable/selector_round_button_text.xml new file mode 100644 index 0000000..5ef8ee7 --- /dev/null +++ b/app/src/main/res/drawable/selector_round_button_text.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml deleted file mode 100644 index 3a5c190..0000000 --- a/app/src/main/res/values/attrs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index e374e51..f944f5b 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -11,5 +11,7 @@ #EEF4FF + #0047D0 #C4C4C4 + #828282 \ No newline at end of file diff --git a/app/src/main/res/values/styles_views.xml b/app/src/main/res/values/styles_views.xml new file mode 100644 index 0000000..625864b --- /dev/null +++ b/app/src/main/res/values/styles_views.xml @@ -0,0 +1,20 @@ + + + + + + + + \ No newline at end of file