diff --git a/designsystem/src/main/kotlin/com/natura/android/checkbox/GaYaCheckbox.kt b/designsystem/src/main/kotlin/com/natura/android/checkbox/GaYaCheckbox.kt new file mode 100644 index 00000000..fcc4ae8d --- /dev/null +++ b/designsystem/src/main/kotlin/com/natura/android/checkbox/GaYaCheckbox.kt @@ -0,0 +1,110 @@ +package com.natura.android.checkbox + +import android.content.Context +import android.content.res.ColorStateList +import android.util.AttributeSet +import androidx.appcompat.view.ContextThemeWrapper +import androidx.appcompat.widget.AppCompatCheckBox +import com.natura.android.R +import com.natura.android.resources.getColorTokenFromTheme + +class GaYaCheckbox : AppCompatCheckBox { + + constructor(context: Context) : super(context, null, R.attr.checkboxStyleSecondary) { + init() + } + + constructor(context: Context, attrs: AttributeSet?) : super( + context, + attrs, + R.attr.checkboxStyleSecondary + ) { + init() + } + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) { + init() + } + + constructor(context: Context, themeResId: Int) : super( + ContextThemeWrapper(context, themeResId), + null, + R.attr.checkboxStyleSecondary + ) { + init() + } + + private fun init() { + val colorChecked = getColorTokenFromTheme(context, R.attr.colorInputComponent) + val colorUnchecked = getColorTokenFromTheme(context, R.attr.colorInputComponent) + val colorIndeterminate = getColorTokenFromTheme(context, R.attr.colorInputComponent) + val colorDisabled = getColorTokenFromTheme(context, R.attr.colorContentDisabled) + + val states = arrayOf( + intArrayOf(android.R.attr.state_checked, -android.R.attr.state_enabled), + intArrayOf(-android.R.attr.state_checked, -android.R.attr.state_enabled), + intArrayOf(android.R.attr.state_checked), + intArrayOf(-android.R.attr.state_checked), + intArrayOf(R.attr.state_indeterminate) + ) + + val colors = intArrayOf( + colorDisabled, + colorDisabled, + colorChecked, + colorUnchecked, + colorIndeterminate + ) + + buttonTintList = ColorStateList(states, colors) + updateDrawable() + } + + var state = GaYaCheckboxState.UNCHECKED + set(value) { + field = value + refreshDrawableState() + updateDrawable() + } + + private lateinit var indeterminateState: IntArray + + private var onStateChangedListener: ((GaYaCheckboxState) -> Unit)? = null + + fun setOnStateChangedListener(listener: (GaYaCheckboxState) -> Unit) { + onStateChangedListener = listener + } + + private fun updateDrawable() { + val btnDrawable = when (state) { + GaYaCheckboxState.INDETERMINATE -> R.drawable.checkbox_status_indeterminate + GaYaCheckboxState.UNCHECKED -> R.drawable.checkbox_status_unchecked + GaYaCheckboxState.CHECKED -> R.drawable.checkbox_status_checked + } + setButtonDrawable(btnDrawable) + onStateChangedListener?.invoke(state) + } + + override fun onCreateDrawableState(extraSpace: Int): IntArray { + indeterminateState = intArrayOf(R.attr.state_indeterminate) + val drawableState = super.onCreateDrawableState(extraSpace + 1) + mergeDrawableStates(drawableState, indeterminateState) + return drawableState + } + + override fun setChecked(checked: Boolean) { + this.state = when (checked) { + true -> GaYaCheckboxState.CHECKED + else -> GaYaCheckboxState.UNCHECKED + } + super.setChecked(checked) + } +} + +enum class GaYaCheckboxState { + UNCHECKED, CHECKED, INDETERMINATE +} diff --git a/designsystem/src/main/kotlin/com/natura/android/radiobutton/GaYaRadiobutton.kt b/designsystem/src/main/kotlin/com/natura/android/radiobutton/GaYaRadiobutton.kt new file mode 100644 index 00000000..bccb5615 --- /dev/null +++ b/designsystem/src/main/kotlin/com/natura/android/radiobutton/GaYaRadiobutton.kt @@ -0,0 +1,76 @@ +package com.natura.android.radiobutton + +import android.content.Context +import android.content.res.ColorStateList +import android.util.AttributeSet +import androidx.appcompat.view.ContextThemeWrapper +import androidx.appcompat.widget.AppCompatRadioButton +import com.natura.android.R +import com.natura.android.resources.getColorTokenFromTheme + +class GaYaRadiobutton : AppCompatRadioButton { + + constructor(context: Context) : super(context, null, R.attr.radioButtonStyle) { + init() + } + + constructor(context: Context, attrs: AttributeSet?) : super( + context, + attrs, + R.attr.radioButtonStyle + ) { + init() + } + + constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( + context, + attrs, + defStyleAttr + ) { + init() + } + + constructor(context: Context, themeResId: Int) : super( + ContextThemeWrapper(context, themeResId), + null, + R.attr.radioButtonStyle + ) { + init() + } + + private val colorChecked by lazy { getColorTokenFromTheme(context, R.attr.colorInputComponent) } + private val colorUnchecked by lazy { + getColorTokenFromTheme( + context, + R.attr.colorInputComponent + ) + } + private val colorDisabled by lazy { + getColorTokenFromTheme( + context, + R.attr.colorContentDisabled + ) + } + + private val colorStateList by lazy { + val states = arrayOf( + intArrayOf(android.R.attr.state_checked, -android.R.attr.state_enabled), + intArrayOf(-android.R.attr.state_checked, -android.R.attr.state_enabled), + intArrayOf(android.R.attr.state_checked), + intArrayOf(-android.R.attr.state_checked) + ) + + val colors = intArrayOf( + colorDisabled, + colorDisabled, + colorChecked, + colorUnchecked + ) + + ColorStateList(states, colors) + } + + private fun init() { + buttonTintList = colorStateList + } +} diff --git a/designsystem/src/main/res/drawable/filled_content_crueltyfreebunny.xml b/designsystem/src/main/res/drawable/filled_content_crueltyfreebunny.xml new file mode 100644 index 00000000..d8f5f422 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_crueltyfreebunny.xml @@ -0,0 +1,10 @@ + + + diff --git a/designsystem/src/main/res/drawable/filled_content_exfoliator.xml b/designsystem/src/main/res/drawable/filled_content_exfoliator.xml new file mode 100644 index 00000000..bb4b4eb8 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_exfoliator.xml @@ -0,0 +1,23 @@ + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_giftpricefair.xml b/designsystem/src/main/res/drawable/filled_content_giftpricefair.xml new file mode 100644 index 00000000..b9663f57 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_giftpricefair.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_giftpricegreat.xml b/designsystem/src/main/res/drawable/filled_content_giftpricegreat.xml new file mode 100644 index 00000000..da2627cd --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_giftpricegreat.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_giftpricehigh.xml b/designsystem/src/main/res/drawable/filled_content_giftpricehigh.xml new file mode 100644 index 00000000..ab2b6a60 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_giftpricehigh.xml @@ -0,0 +1,30 @@ + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_giftpricespecial.xml b/designsystem/src/main/res/drawable/filled_content_giftpricespecial.xml new file mode 100644 index 00000000..74fa5619 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_giftpricespecial.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_plasticfree.xml b/designsystem/src/main/res/drawable/filled_content_plasticfree.xml new file mode 100644 index 00000000..9471bb43 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_plasticfree.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_snorkelmask.xml b/designsystem/src/main/res/drawable/filled_content_snorkelmask.xml new file mode 100644 index 00000000..be74a507 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_snorkelmask.xml @@ -0,0 +1,12 @@ + + + + diff --git a/designsystem/src/main/res/drawable/filled_media_play.xml b/designsystem/src/main/res/drawable/filled_media_play.xml index 8ab3f805..4fab6af8 100644 --- a/designsystem/src/main/res/drawable/filled_media_play.xml +++ b/designsystem/src/main/res/drawable/filled_media_play.xml @@ -3,7 +3,8 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularbottom.xml b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularbottom.xml index a8fa532e..01dbfdab 100644 --- a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularbottom.xml +++ b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularbottom.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularleft.xml b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularleft.xml index 4d361c3b..019bf96a 100644 --- a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularleft.xml +++ b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularleft.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularright.xml b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularright.xml index aacc7eba..c2723e60 100644 --- a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularright.xml +++ b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregularright.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregulartop.xml b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregulartop.xml index cecf8da2..319bf9ee 100644 --- a/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregulartop.xml +++ b/designsystem/src/main/res/drawable/filled_navigation_arrowctrlregulartop.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/filled_product_eyeshadow.xml b/designsystem/src/main/res/drawable/filled_product_eyeshadow.xml new file mode 100644 index 00000000..c7eec80a --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_product_eyeshadow.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_product_hairdetox.xml b/designsystem/src/main/res/drawable/filled_product_hairdetox.xml new file mode 100644 index 00000000..d0e687a1 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_product_hairdetox.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/designsystem/src/main/res/drawable/filled_product_organicalcohol.xml b/designsystem/src/main/res/drawable/filled_product_organicalcohol.xml new file mode 100644 index 00000000..f6c62ab2 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_product_organicalcohol.xml @@ -0,0 +1,18 @@ + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_product_recyclablepackaging.xml b/designsystem/src/main/res/drawable/filled_product_recyclablepackaging.xml new file mode 100644 index 00000000..5896523f --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_product_recyclablepackaging.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_product_refill.xml b/designsystem/src/main/res/drawable/filled_product_refill.xml new file mode 100644 index 00000000..f4b6f118 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_product_refill.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_crueltyfreebunny.xml b/designsystem/src/main/res/drawable/outlined_content_crueltyfreebunny.xml new file mode 100644 index 00000000..6e139dfa --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_crueltyfreebunny.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_exfoliator.xml b/designsystem/src/main/res/drawable/outlined_content_exfoliator.xml new file mode 100644 index 00000000..cbb8d132 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_exfoliator.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_giftpricefair.xml b/designsystem/src/main/res/drawable/outlined_content_giftpricefair.xml new file mode 100644 index 00000000..f6361d1e --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_giftpricefair.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_giftpricegreat.xml b/designsystem/src/main/res/drawable/outlined_content_giftpricegreat.xml new file mode 100644 index 00000000..b1a1082b --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_giftpricegreat.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_giftpricehigh.xml b/designsystem/src/main/res/drawable/outlined_content_giftpricehigh.xml new file mode 100644 index 00000000..ad7ed4c2 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_giftpricehigh.xml @@ -0,0 +1,28 @@ + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_giftpricespecial.xml b/designsystem/src/main/res/drawable/outlined_content_giftpricespecial.xml new file mode 100644 index 00000000..985ab574 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_giftpricespecial.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_plasticfree.xml b/designsystem/src/main/res/drawable/outlined_content_plasticfree.xml new file mode 100644 index 00000000..1c598990 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_plasticfree.xml @@ -0,0 +1,13 @@ + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_snorkelmask.xml b/designsystem/src/main/res/drawable/outlined_content_snorkelmask.xml new file mode 100644 index 00000000..36a84a18 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_snorkelmask.xml @@ -0,0 +1,13 @@ + + + + diff --git a/designsystem/src/main/res/drawable/outlined_media_play.xml b/designsystem/src/main/res/drawable/outlined_media_play.xml index 5941032a..5843372d 100644 --- a/designsystem/src/main/res/drawable/outlined_media_play.xml +++ b/designsystem/src/main/res/drawable/outlined_media_play.xml @@ -3,7 +3,8 @@ android:height="24dp" android:viewportWidth="24" android:viewportHeight="24"> - + diff --git a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularbottom.xml b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularbottom.xml index 22c25c1d..266f9331 100644 --- a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularbottom.xml +++ b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularbottom.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularleft.xml b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularleft.xml index 6e83e900..8a437f89 100644 --- a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularleft.xml +++ b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularleft.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularright.xml b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularright.xml index 14a7249a..9fbb0239 100644 --- a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularright.xml +++ b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregularright.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregulartop.xml b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregulartop.xml index fcf35bd9..29c8c187 100644 --- a/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregulartop.xml +++ b/designsystem/src/main/res/drawable/outlined_navigation_arrowctrlregulartop.xml @@ -1,10 +1,10 @@ diff --git a/designsystem/src/main/res/drawable/outlined_product_eyeshadow.xml b/designsystem/src/main/res/drawable/outlined_product_eyeshadow.xml new file mode 100644 index 00000000..472eda33 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_product_eyeshadow.xml @@ -0,0 +1,36 @@ + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_product_hairdetox.xml b/designsystem/src/main/res/drawable/outlined_product_hairdetox.xml new file mode 100644 index 00000000..85253ab6 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_product_hairdetox.xml @@ -0,0 +1,14 @@ + + + + diff --git a/designsystem/src/main/res/drawable/outlined_product_organicalcohol.xml b/designsystem/src/main/res/drawable/outlined_product_organicalcohol.xml new file mode 100644 index 00000000..feae6ef5 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_product_organicalcohol.xml @@ -0,0 +1,18 @@ + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_product_recyclablepackaging.xml b/designsystem/src/main/res/drawable/outlined_product_recyclablepackaging.xml new file mode 100644 index 00000000..a3395f43 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_product_recyclablepackaging.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_product_refill.xml b/designsystem/src/main/res/drawable/outlined_product_refill.xml new file mode 100644 index 00000000..034745fd --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_product_refill.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 497862a8..7c876b25 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -11,6 +11,12 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.AppCompat.Light"> + + diff --git a/sample/src/main/assets/icons_map.txt b/sample/src/main/assets/icons_map.txt index 39aa6548..8402ea8a 100644 --- a/sample/src/main/assets/icons_map.txt +++ b/sample/src/main/assets/icons_map.txt @@ -47,10 +47,16 @@ filled_communication_noconnection filled_content_bathtub filled_content_channel filled_content_childfriendly +filled_content_crueltyfreebunny filled_content_design filled_content_divulgation filled_content_dropper +filled_content_exfoliator filled_content_gauge +filled_content_giftpricefair +filled_content_giftpricegreat +filled_content_giftpricehigh +filled_content_giftpricespecial filled_content_gymdumbbell filled_content_hairbeard filled_content_handsoap @@ -62,9 +68,11 @@ filled_content_mortar filled_content_oil filled_content_oilunavailable filled_content_palette +filled_content_plasticfree filled_content_quote filled_content_sensitive filled_content_shower +filled_content_snorkelmask filled_content_soap filled_content_soapbubble filled_content_violence @@ -142,8 +150,10 @@ filled_product_combcream filled_product_conditioner filled_product_cube filled_product_deodorantrollon +filled_product_eyeshadow filled_product_fashion filled_product_haircream +filled_product_hairdetox filled_product_hairdresser filled_product_hairgel filled_product_makeconcealer @@ -151,7 +161,10 @@ filled_product_makeeyeliner filled_product_makefoundation filled_product_makemask filled_product_nailpolish +filled_product_organicalcohol filled_product_pencilblush +filled_product_recyclablepackaging +filled_product_refill filled_product_shampoo filled_product_soapliquid filled_social_fireworks @@ -264,17 +277,23 @@ outlined_content_childfriendly outlined_content_christmascard outlined_content_cloud outlined_content_consistency +outlined_content_crueltyfreebunny outlined_content_design outlined_content_divulgation outlined_content_dropper outlined_content_education outlined_content_emptybag outlined_content_exchangereports +outlined_content_exfoliator outlined_content_flower outlined_content_fragrance outlined_content_gallery outlined_content_gauge outlined_content_gift +outlined_content_giftpricefair +outlined_content_giftpricegreat +outlined_content_giftpricehigh +outlined_content_giftpricespecial outlined_content_global outlined_content_gymdumbbell outlined_content_hairbeard @@ -305,6 +324,7 @@ outlined_content_oilunavailable outlined_content_palette outlined_content_password outlined_content_planb +outlined_content_plasticfree outlined_content_productshowcase outlined_content_produtivity outlined_content_rainycloud @@ -312,6 +332,7 @@ outlined_content_report outlined_content_saleinsight outlined_content_sensitive outlined_content_shower +outlined_content_snorkelmask outlined_content_snow outlined_content_soap outlined_content_soapbubble @@ -433,6 +454,7 @@ outlined_product_childish outlined_product_combcream outlined_product_conditioner outlined_product_cube +outlined_product_eyeshadow outlined_product_dailycare outlined_product_deodorantrollon outlined_product_ekos @@ -441,6 +463,7 @@ outlined_product_face outlined_product_fashion outlined_product_hair outlined_product_haircream +outlined_product_hairdetox outlined_product_hairdresser outlined_product_hairgel outlined_product_lashes @@ -452,6 +475,7 @@ outlined_product_makefoundation outlined_product_makemask outlined_product_makeup outlined_product_nailpolish +outlined_product_organicalcohol outlined_product_outlet outlined_product_pencil outlined_product_pencilblush @@ -462,7 +486,9 @@ outlined_product_perfumerytbs outlined_product_powder outlined_product_primer outlined_product_promotionproduct +outlined_product_recyclablepackaging outlined_product_relatedproducts +outlined_product_refill outlined_product_repurchase outlined_product_scent outlined_product_shampoo diff --git a/sample/src/main/kotlin/com/natura/android/sample/MainActivity.kt b/sample/src/main/kotlin/com/natura/android/sample/MainActivity.kt index 96a56a82..5287044d 100644 --- a/sample/src/main/kotlin/com/natura/android/sample/MainActivity.kt +++ b/sample/src/main/kotlin/com/natura/android/sample/MainActivity.kt @@ -26,8 +26,10 @@ import com.natura.android.sample.components.AvatarActivity import com.natura.android.sample.components.ChipActivity import com.natura.android.sample.components.AlertActivity import com.natura.android.sample.components.GaYaButtonActivity +import com.natura.android.sample.components.GaYaCheckboxActivity import com.natura.android.sample.components.GaYaChipActivity import com.natura.android.sample.components.GaYaIconButtonActivity +import com.natura.android.sample.components.GaYaRadiobuttonActivity import com.natura.android.sample.components.GaYaShortcutActivity import com.natura.android.sample.components.SnackbarActivity import com.natura.android.sample.components.listitem.ListItemActivity @@ -219,5 +221,13 @@ class MainActivity : AppCompatActivity() { binding.gayaShortcutButton.setOnClickListener { startActivity(Intent(this, GaYaShortcutActivity::class.java)) } + + binding.gayaCheckboxButton.setOnClickListener { + startActivity(Intent(this, GaYaCheckboxActivity::class.java)) + } + + binding.gayaRadiobuttonButton.setOnClickListener { + startActivity(Intent(this, GaYaRadiobuttonActivity::class.java)) + } } } diff --git a/sample/src/main/kotlin/com/natura/android/sample/components/GaYaCheckboxActivity.kt b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaCheckboxActivity.kt new file mode 100644 index 00000000..47602693 --- /dev/null +++ b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaCheckboxActivity.kt @@ -0,0 +1,50 @@ +package com.natura.android.sample.components + +import android.os.Bundle +import android.view.MenuItem +import android.widget.LinearLayout +import androidx.appcompat.app.AppCompatActivity +import com.natura.android.checkbox.GaYaCheckbox +import com.natura.android.checkbox.GaYaCheckboxState +import com.natura.android.sample.R +import com.natura.android.sample.setChosenDefaultTheme + +class GaYaCheckboxActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + setChosenDefaultTheme() + + val checkboxPrimaryChecked: GaYaCheckbox by lazy { findViewById(R.id.checkboxPrimaryChecked) } + val checkboxPrimaryIndeterminate: GaYaCheckbox by lazy { findViewById(R.id.checkboxPrimaryIndeterminate) } + + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_gaya_checkbox) + + supportActionBar?.setDisplayHomeAsUpEnabled(true) + supportActionBar?.title = "GaYaCheckbox" + + checkboxPrimaryIndeterminate.state = GaYaCheckboxState.INDETERMINATE + checkboxPrimaryChecked.state = GaYaCheckboxState.CHECKED + + val gaYaCheckbox = GaYaCheckbox(this).apply { + text = "Adicionado programaticamente" + isChecked = true + isEnabled = true + } + + val gaYaCheckboxAvon = GaYaCheckbox(this, R.style.Theme_Avon_Light_SSOT).apply { + text = "GaYaCheckbox Avon" + isChecked = true + isEnabled = true + } + + val container: LinearLayout = findViewById(R.id.lnlProgramatically) + container.addView(gaYaCheckbox) + container.addView(gaYaCheckboxAvon) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + onBackPressed() + return true + } +} diff --git a/sample/src/main/kotlin/com/natura/android/sample/components/GaYaRadiobuttonActivity.kt b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaRadiobuttonActivity.kt new file mode 100644 index 00000000..a173e6c7 --- /dev/null +++ b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaRadiobuttonActivity.kt @@ -0,0 +1,43 @@ +package com.natura.android.sample.components + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.MenuItem +import android.widget.LinearLayout +import com.natura.android.radiobutton.GaYaRadiobutton +import com.natura.android.sample.R +import com.natura.android.sample.setChosenDefaultTheme + +class GaYaRadiobuttonActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + setChosenDefaultTheme() + + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_gaya_radiobutton) + + supportActionBar?.setDisplayHomeAsUpEnabled(true) + supportActionBar?.title = "GaYaRadiobutton" + + val gaYaRadiobutton = GaYaRadiobutton(this).apply { + text = "Adicionado programaticamente" + isChecked = true + isEnabled = true + } + + val gaYaRadiobuttonAvon = GaYaRadiobutton(this, R.style.Theme_Avon_Light_SSOT).apply { + text = "GaYaRadiobutton Avon" + isChecked = true + isEnabled = true + } + + val container: LinearLayout = findViewById(R.id.lnlProgramatically) + container.addView(gaYaRadiobutton) + container.addView(gaYaRadiobuttonAvon) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + onBackPressed() + return true + } +} diff --git a/sample/src/main/res/layout/activity_gaya_checkbox.xml b/sample/src/main/res/layout/activity_gaya_checkbox.xml new file mode 100644 index 00000000..d673f586 --- /dev/null +++ b/sample/src/main/res/layout/activity_gaya_checkbox.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_gaya_radiobutton.xml b/sample/src/main/res/layout/activity_gaya_radiobutton.xml new file mode 100644 index 00000000..32b0f38d --- /dev/null +++ b/sample/src/main/res/layout/activity_gaya_radiobutton.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index d01df89d..ef41ce3d 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -234,6 +234,18 @@ android:textAlignment="textStart" android:textColor="@color/highEmphasis" /> +