diff --git a/designsystem/src/main/kotlin/com/natura/android/button/GaYaButton.kt b/designsystem/src/main/kotlin/com/natura/android/button/GaYaButton.kt index 33d0ecf7..a68301e1 100644 --- a/designsystem/src/main/kotlin/com/natura/android/button/GaYaButton.kt +++ b/designsystem/src/main/kotlin/com/natura/android/button/GaYaButton.kt @@ -76,14 +76,6 @@ class GaYaButton : MaterialButton { applyStyle() } -// fun setBtnIcon(icon: String?) { -// icon?.let { -// val drawableId = getIconResourceIdFromName(context, it) -// val drawable = ContextCompat.getDrawable(context, drawableId) -// setIcon(drawable) -// } -// } - fun setBtnIcon(iconName: String?) { iconName?.let { val drawableId = getIconResourceIdFromName(context, it) diff --git a/designsystem/src/main/kotlin/com/natura/android/switch/GaYaSwitch.kt b/designsystem/src/main/kotlin/com/natura/android/switch/GaYaSwitch.kt new file mode 100644 index 00000000..1fee1ef4 --- /dev/null +++ b/designsystem/src/main/kotlin/com/natura/android/switch/GaYaSwitch.kt @@ -0,0 +1,141 @@ +package com.natura.android.switch + +import android.content.Context +import android.content.res.ColorStateList +import android.graphics.Color +import android.util.AttributeSet +import androidx.appcompat.view.ContextThemeWrapper +import androidx.appcompat.widget.SwitchCompat +import com.natura.android.R +import com.natura.android.resources.getColorTokenFromTheme + +class GaYaSwitch : SwitchCompat { + + constructor(context: Context) : super(context, null, R.attr.switchStyle) { + init() + } + + constructor(context: Context, attrs: AttributeSet?) : super( + context, + attrs, + R.attr.switchStyle + ) { + 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.switchStyle + ) { + init() + } + + private val colorCheckedThumb by lazy { + getColorTokenFromTheme( + context, + R.attr.colorInputComponent + ) + } + private val colorUncheckedThumb by lazy { getColorTokenFromTheme(context, R.attr.colorSurface) } + private val colorDisabledThumb by lazy { + getColorTokenFromTheme( + context, + R.attr.colorNeutral400 + ) + } + + private val colorCheckedTrack by lazy { + adjustAlpha( + getColorTokenFromTheme( + context, + R.attr.colorInputComponent + ) + ) + } + private val colorUncheckedTrack by lazy { + adjustAlpha( + getColorTokenFromTheme( + context, + R.attr.colorNeutral900 + ) + ) + } + private val colorDisabledTrack by lazy { + adjustAlpha( + getColorTokenFromTheme( + context, + R.attr.colorNeutral900 + ) + ) + } + + private val thumbColorStateList 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( + colorDisabledThumb, + colorDisabledThumb, + colorCheckedThumb, + colorUncheckedThumb + ) + + ColorStateList(states, colors) + } + + private val trackColorStateList 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( + colorDisabledTrack, + colorDisabledTrack, + colorCheckedTrack, + colorUncheckedTrack + ) + + ColorStateList(states, colors) + } + + private fun init() { + thumbTintList = thumbColorStateList + trackTintList = trackColorStateList + } + + private fun adjustAlpha(color: Int): Int { + val alpha = Math.round(Color.alpha(color) * 0.48f) + val red = Color.red(color) + val green = Color.green(color) + val blue = Color.blue(color) + return Color.argb(alpha, red, green, blue) + } +} diff --git a/designsystem/src/main/kotlin/com/natura/android/tag/GaYaTag.kt b/designsystem/src/main/kotlin/com/natura/android/tag/GaYaTag.kt new file mode 100644 index 00000000..2d41b882 --- /dev/null +++ b/designsystem/src/main/kotlin/com/natura/android/tag/GaYaTag.kt @@ -0,0 +1,286 @@ +package com.natura.android.tag + +import android.content.Context +import android.content.res.TypedArray +import android.graphics.drawable.GradientDrawable +import android.util.AttributeSet +import android.view.View +import android.widget.ImageView +import android.widget.TextView +import androidx.constraintlayout.widget.ConstraintLayout +import androidx.core.content.ContextCompat +import androidx.core.content.res.ResourcesCompat +import com.natura.android.R +import com.natura.android.exceptions.MissingThemeException +import com.natura.android.resources.getColorTokenFromTheme +import com.natura.android.resources.getDimenFromTheme +import com.natura.android.resources.getIconResourceIdFromName + +class GaYaTag @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : ConstraintLayout(context, attrs, defStyleAttr) { + + private var tagAttributesArray: TypedArray + + var label: String? = "" + set(value) { + field = value + labelContainer.text = value + } + + var color: Int = GaYaTagColor.Primary.value + set(value) { + field = value + configureAppearance(getDrawable()) + } + + var icon: String? = null + set(value) { + field = value + configureIcon() + } + + var size: Int = GaYaTagSize.Small.value + set(value) { + field = value + configureSize() + } + + var position: Int = GaYaTagPosition.Center.value + set(value) { + field = value + configureAppearance(getDrawable()) + } + + private lateinit var labelContainer: TextView + private lateinit var iconContainer: ImageView + private lateinit var backgroundContainer: View + + init { + tagAttributesArray = context.obtainStyledAttributes(attrs, R.styleable.GaYaTag) + + try { + View.inflate(context, R.layout.gayatag, this) + } catch (e: Exception) { + throw MissingThemeException() + } + + tagAttributesArray = + context.obtainStyledAttributes(attrs, R.styleable.GaYaTag) + + configureViews() + getAttributes() + + tagAttributesArray.recycle() + } + + private fun configureViews() { + labelContainer = findViewById(R.id.tag_label) + iconContainer = findViewById(R.id.tag_icon) + backgroundContainer = findViewById(R.id.tag_background) + + configureAppearance(getDrawable()) + } + + private fun getDrawable(): GradientDrawable { + val backgroundDrawable = ResourcesCompat.getDrawable( + context.resources, + R.drawable.tag_background, + null + ) + return backgroundDrawable?.mutate() as GradientDrawable + } + + private fun getAttributes() { + tagAttributesArray.apply { + label = getString(R.styleable.GaYaTag_gtag_label) ?: "" + color = getInt(R.styleable.GaYaTag_gtag_color, GaYaTagColor.Primary.value) + size = getInt(R.styleable.GaYaTag_gtag_size, GaYaTagSize.Small.value) + position = getInt(R.styleable.GaYaTag_gtag_position, GaYaTagPosition.Center.value) + icon = getString(R.styleable.GaYaTag_gtag_icon) ?: "" + } + + configureAppearance(getDrawable()) + } + + private fun configureAppearance(backgroundDrawable: GradientDrawable) { + + configureIcon() + configureSize() + + val backgroundColor = when (color) { + GaYaTagColor.Primary.value -> R.color.gaya_background_primary_v23 + GaYaTagColor.PrimaryLightest.value -> R.color.gaya_background_primary_lightest_v23 + GaYaTagColor.PrimaryDarkest.value -> R.color.gaya_background_primary_darkest_v23 + + GaYaTagColor.Secondary.value -> R.color.gaya_background_secondary_v23 + GaYaTagColor.SecondaryLightest.value -> R.color.gaya_background_secondary_lightest_v23 + GaYaTagColor.SecondaryDarkest.value -> R.color.gaya_background_secondary_darkest_v23 + + GaYaTagColor.Success.value -> R.color.gaya_background_success_v23 + GaYaTagColor.SuccessLightest.value -> R.color.gaya_background_success_lightest_v23 + GaYaTagColor.SuccessDarkest.value -> R.color.gaya_background_success_darkest_v23 + + GaYaTagColor.Alert.value -> R.color.gaya_background_alert_v23 + GaYaTagColor.AlertLightest.value -> R.color.gaya_background_alert_lightest_v23 + GaYaTagColor.AlertDarkest.value -> R.color.gaya_background_alert_darkest_v23 + + GaYaTagColor.Warning.value -> R.color.gaya_background_warning_v23 + GaYaTagColor.WarningLightest.value -> R.color.gaya_background_warning_lightest_v23 + GaYaTagColor.WarningDarkest.value -> R.color.gaya_background_warning_darkest_v23 + + GaYaTagColor.Info.value -> R.color.gaya_background_info_v23 + GaYaTagColor.InfoLightest.value -> R.color.gaya_background_info_lightest_v23 + GaYaTagColor.InfoDarkest.value -> R.color.gaya_background_info_darkest_v23 + + else -> R.color.gaya_background_primary_v23 + } + + backgroundDrawable.color = ContextCompat.getColorStateList( + context, + backgroundColor + ) + + val radiusEnabled: Float + val radiusDisabled: Float + + if (size == GaYaTagSize.Small.value) { + radiusEnabled = getDimenFromTheme(context, R.attr.tagSmallBorderRadiusEnable) + radiusDisabled = getDimenFromTheme(context, R.attr.tagSmallBorderRadiusDisable) + } else { + radiusEnabled = getDimenFromTheme(context, R.attr.tagStandardBorderRadiusEnable) + radiusDisabled = getDimenFromTheme(context, R.attr.tagStandardBorderRadiusDisable) + } + + when (position) { + GaYaTagPosition.Center.value -> backgroundDrawable.cornerRadius = radiusEnabled + GaYaTagPosition.Right.value -> + backgroundDrawable.cornerRadii = + floatArrayOf( + radiusEnabled, + radiusEnabled, + radiusDisabled, + radiusDisabled, + radiusDisabled, + radiusDisabled, + radiusEnabled, + radiusEnabled + ) + + GaYaTagPosition.Left.value -> + backgroundDrawable.cornerRadii = + floatArrayOf( + radiusDisabled, + radiusDisabled, + radiusEnabled, + radiusEnabled, + radiusEnabled, + radiusEnabled, + radiusDisabled, + radiusDisabled + ) + } + + backgroundContainer.background = backgroundDrawable + + val onContentColor = when (color) { + GaYaTagColor.Primary.value -> R.attr.colorOnPrimary + GaYaTagColor.PrimaryLightest.value -> R.attr.colorOnPrimaryLightest + GaYaTagColor.PrimaryDarkest.value -> R.attr.colorOnPrimaryDarkest + + GaYaTagColor.Secondary.value -> R.attr.colorOnSecondary + GaYaTagColor.SecondaryLightest.value -> R.attr.colorOnSecondaryLightest + GaYaTagColor.SecondaryDarkest.value -> R.attr.colorOnSecondaryDarkest + + GaYaTagColor.Success.value -> R.attr.colorOnSuccess + GaYaTagColor.SuccessLightest.value -> R.attr.colorOnSuccessLightest + GaYaTagColor.SuccessDarkest.value -> R.attr.colorOnSuccessDarkest + + GaYaTagColor.Alert.value -> R.attr.colorOnAlert + GaYaTagColor.AlertLightest.value -> R.attr.colorOnAlertLightest + GaYaTagColor.AlertDarkest.value -> R.attr.colorOnAlertDarkest + + GaYaTagColor.Warning.value -> R.attr.colorOnWarning + GaYaTagColor.WarningLightest.value -> R.attr.colorOnWarningLightest + GaYaTagColor.WarningDarkest.value -> R.attr.colorOnWarningDarkest + + GaYaTagColor.Info.value -> R.attr.colorOnInfo + GaYaTagColor.InfoLightest.value -> R.attr.colorOnInfoLightest + GaYaTagColor.InfoDarkest.value -> R.attr.colorOnInfoDarkest + + else -> R.color.gaya_background_primary_v23 + } + + labelContainer.setTextColor( + getColorTokenFromTheme( + context, + onContentColor + ) + ) + + iconContainer.setColorFilter( + getColorTokenFromTheme(context, onContentColor), + android.graphics.PorterDuff.Mode.SRC_IN + ) + } + + private fun configureIcon() { + if (icon.isNullOrEmpty()) { + iconContainer.visibility = View.GONE + } else { + val iconDrawableId = getIconResourceIdFromName(context, icon.toString()) + iconContainer.visibility = View.VISIBLE + iconContainer.setImageResource(iconDrawableId) + } + } + + private fun configureSize() { + val params = backgroundContainer.layoutParams + params.height = if (size == GaYaTagSize.Small.value) { + getDimenFromTheme(context, R.attr.sizeSmall).toInt() + } else { + getDimenFromTheme(context, R.attr.sizeStandard).toInt() + } + backgroundContainer.layoutParams = params + } + +} + +enum class GaYaTagColor(val value: Int) { + Primary(0), + PrimaryDarkest(1), + PrimaryLightest(2), + + Secondary(3), + SecondaryDarkest(4), + SecondaryLightest(5), + + Success(6), + SuccessDarkest(7), + SuccessLightest(8), + + Alert(9), + AlertDarkest(10), + AlertLightest(11), + + Warning(12), + WarningDarkest(13), + WarningLightest(14), + + Info(15), + InfoDarkest(16), + InfoLightest(17) +} + +enum class GaYaTagSize(val value: Int) { + Small(0), + Standard(1) +} + +enum class GaYaTagPosition(val value: Int) { + Center(0), + Left(1), + Right(2) +} diff --git a/designsystem/src/main/res/color/gaya_background_alert_darkest_v23.xml b/designsystem/src/main/res/color/gaya_background_alert_darkest_v23.xml new file mode 100644 index 00000000..8c733ab2 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_alert_darkest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_alert_lightest_v23.xml b/designsystem/src/main/res/color/gaya_background_alert_lightest_v23.xml new file mode 100644 index 00000000..c71ac204 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_alert_lightest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_alert_v23.xml b/designsystem/src/main/res/color/gaya_background_alert_v23.xml new file mode 100644 index 00000000..2c4cd9e5 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_alert_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_info_darkest_v23.xml b/designsystem/src/main/res/color/gaya_background_info_darkest_v23.xml new file mode 100644 index 00000000..33c96408 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_info_darkest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_info_lightest_v23.xml b/designsystem/src/main/res/color/gaya_background_info_lightest_v23.xml new file mode 100644 index 00000000..8e9a8586 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_info_lightest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_info_v23.xml b/designsystem/src/main/res/color/gaya_background_info_v23.xml new file mode 100644 index 00000000..3382d0ec --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_info_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_primary_darkest_v23.xml b/designsystem/src/main/res/color/gaya_background_primary_darkest_v23.xml new file mode 100644 index 00000000..80c31468 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_primary_darkest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_primary_lightest_v23.xml b/designsystem/src/main/res/color/gaya_background_primary_lightest_v23.xml new file mode 100644 index 00000000..3ef97158 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_primary_lightest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_primary_v23.xml b/designsystem/src/main/res/color/gaya_background_primary_v23.xml new file mode 100644 index 00000000..bea72bab --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_primary_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_secondary_darkest_v23.xml b/designsystem/src/main/res/color/gaya_background_secondary_darkest_v23.xml new file mode 100644 index 00000000..44f74c82 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_secondary_darkest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_secondary_lightest_v23.xml b/designsystem/src/main/res/color/gaya_background_secondary_lightest_v23.xml new file mode 100644 index 00000000..36ff3c7e --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_secondary_lightest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_secondary_v23.xml b/designsystem/src/main/res/color/gaya_background_secondary_v23.xml new file mode 100644 index 00000000..ff00f5a3 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_secondary_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_success_darkest_v23.xml b/designsystem/src/main/res/color/gaya_background_success_darkest_v23.xml new file mode 100644 index 00000000..25923591 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_success_darkest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_success_lightest_v23.xml b/designsystem/src/main/res/color/gaya_background_success_lightest_v23.xml new file mode 100644 index 00000000..36154e8a --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_success_lightest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_success_v23.xml b/designsystem/src/main/res/color/gaya_background_success_v23.xml new file mode 100644 index 00000000..a3431bda --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_success_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_warning_darkest_v23.xml b/designsystem/src/main/res/color/gaya_background_warning_darkest_v23.xml new file mode 100644 index 00000000..d09a0035 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_warning_darkest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_warning_lightest_v23.xml b/designsystem/src/main/res/color/gaya_background_warning_lightest_v23.xml new file mode 100644 index 00000000..cec2fa1e --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_warning_lightest_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/color/gaya_background_warning_v23.xml b/designsystem/src/main/res/color/gaya_background_warning_v23.xml new file mode 100644 index 00000000..23ef00b4 --- /dev/null +++ b/designsystem/src/main/res/color/gaya_background_warning_v23.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_christmasstocking.xml b/designsystem/src/main/res/drawable/filled_content_christmasstocking.xml new file mode 100644 index 00000000..b544baa6 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_christmasstocking.xml @@ -0,0 +1,12 @@ + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_christmastree.xml b/designsystem/src/main/res/drawable/filled_content_christmastree.xml new file mode 100644 index 00000000..9e8ea29c --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_christmastree.xml @@ -0,0 +1,9 @@ + + + diff --git a/designsystem/src/main/res/drawable/filled_content_daynight.xml b/designsystem/src/main/res/drawable/filled_content_daynight.xml new file mode 100644 index 00000000..de0af6da --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_daynight.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_energy.xml b/designsystem/src/main/res/drawable/filled_content_energy.xml new file mode 100644 index 00000000..ad39a1b4 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_energy.xml @@ -0,0 +1,10 @@ + + + diff --git a/designsystem/src/main/res/drawable/filled_content_farmrows.xml b/designsystem/src/main/res/drawable/filled_content_farmrows.xml new file mode 100644 index 00000000..71866864 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_farmrows.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_content_teddybear.xml b/designsystem/src/main/res/drawable/filled_content_teddybear.xml new file mode 100644 index 00000000..6dc9f272 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_teddybear.xml @@ -0,0 +1,10 @@ + + + diff --git a/designsystem/src/main/res/drawable/filled_content_wetwipe.xml b/designsystem/src/main/res/drawable/filled_content_wetwipe.xml new file mode 100644 index 00000000..36cad9f4 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_content_wetwipe.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_makeup_antiacne.xml b/designsystem/src/main/res/drawable/filled_makeup_antiacne.xml new file mode 100644 index 00000000..db1134cd --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_makeup_antiacne.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_makeup_hairdamaged.xml b/designsystem/src/main/res/drawable/filled_makeup_hairdamaged.xml new file mode 100644 index 00000000..febb548e --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_makeup_hairdamaged.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_makeup_hairdandruff.xml b/designsystem/src/main/res/drawable/filled_makeup_hairdandruff.xml new file mode 100644 index 00000000..815ebbc8 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_makeup_hairdandruff.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_makeup_hairreconstruction.xml b/designsystem/src/main/res/drawable/filled_makeup_hairreconstruction.xml new file mode 100644 index 00000000..e90b0ee7 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_makeup_hairreconstruction.xml @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_product_shampooconditioner.xml b/designsystem/src/main/res/drawable/filled_product_shampooconditioner.xml new file mode 100644 index 00000000..d0901368 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_product_shampooconditioner.xml @@ -0,0 +1,20 @@ + + + + + + diff --git a/designsystem/src/main/res/drawable/filled_social_pregnant.xml b/designsystem/src/main/res/drawable/filled_social_pregnant.xml new file mode 100644 index 00000000..05078610 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_social_pregnant.xml @@ -0,0 +1,12 @@ + + + + diff --git a/designsystem/src/main/res/drawable/filled_social_userlock.xml b/designsystem/src/main/res/drawable/filled_social_userlock.xml new file mode 100644 index 00000000..790086d4 --- /dev/null +++ b/designsystem/src/main/res/drawable/filled_social_userlock.xml @@ -0,0 +1,13 @@ + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_christmasstocking.xml b/designsystem/src/main/res/drawable/outlined_content_christmasstocking.xml new file mode 100644 index 00000000..90ceb3ad --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_christmasstocking.xml @@ -0,0 +1,10 @@ + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_christmastree.xml b/designsystem/src/main/res/drawable/outlined_content_christmastree.xml new file mode 100644 index 00000000..8d2eb310 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_christmastree.xml @@ -0,0 +1,10 @@ + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_daynight.xml b/designsystem/src/main/res/drawable/outlined_content_daynight.xml new file mode 100644 index 00000000..3307d376 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_daynight.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_energy.xml b/designsystem/src/main/res/drawable/outlined_content_energy.xml new file mode 100644 index 00000000..88867bf6 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_energy.xml @@ -0,0 +1,10 @@ + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_farmrows.xml b/designsystem/src/main/res/drawable/outlined_content_farmrows.xml new file mode 100644 index 00000000..09ef67f7 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_farmrows.xml @@ -0,0 +1,27 @@ + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_teddybear.xml b/designsystem/src/main/res/drawable/outlined_content_teddybear.xml new file mode 100644 index 00000000..24601eaa --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_teddybear.xml @@ -0,0 +1,19 @@ + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_content_wetwipe.xml b/designsystem/src/main/res/drawable/outlined_content_wetwipe.xml new file mode 100644 index 00000000..5c3d0a32 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_content_wetwipe.xml @@ -0,0 +1,14 @@ + + + + diff --git a/designsystem/src/main/res/drawable/outlined_makeup_antiacne.xml b/designsystem/src/main/res/drawable/outlined_makeup_antiacne.xml new file mode 100644 index 00000000..c3ba82b8 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_makeup_antiacne.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_makeup_hairdamaged.xml b/designsystem/src/main/res/drawable/outlined_makeup_hairdamaged.xml new file mode 100644 index 00000000..5d3a548f --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_makeup_hairdamaged.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_makeup_hairdandruff.xml b/designsystem/src/main/res/drawable/outlined_makeup_hairdandruff.xml new file mode 100644 index 00000000..a40d2129 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_makeup_hairdandruff.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_makeup_hairreconstruction.xml b/designsystem/src/main/res/drawable/outlined_makeup_hairreconstruction.xml new file mode 100644 index 00000000..f98b2bd0 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_makeup_hairreconstruction.xml @@ -0,0 +1,16 @@ + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_product_shampooconditioner.xml b/designsystem/src/main/res/drawable/outlined_product_shampooconditioner.xml new file mode 100644 index 00000000..329dec2c --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_product_shampooconditioner.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/designsystem/src/main/res/drawable/outlined_social_pregnant.xml b/designsystem/src/main/res/drawable/outlined_social_pregnant.xml new file mode 100644 index 00000000..4d62ddf8 --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_social_pregnant.xml @@ -0,0 +1,13 @@ + + + + diff --git a/designsystem/src/main/res/drawable/outlined_social_userlock.xml b/designsystem/src/main/res/drawable/outlined_social_userlock.xml new file mode 100644 index 00000000..6b28500a --- /dev/null +++ b/designsystem/src/main/res/drawable/outlined_social_userlock.xml @@ -0,0 +1,17 @@ + + + + + diff --git a/designsystem/src/main/res/drawable/tag_background.xml b/designsystem/src/main/res/drawable/tag_background.xml index dcdf268d..942ed5fe 100644 --- a/designsystem/src/main/res/drawable/tag_background.xml +++ b/designsystem/src/main/res/drawable/tag_background.xml @@ -1,5 +1,4 @@ - - + + \ No newline at end of file diff --git a/designsystem/src/main/res/layout/gayatag.xml b/designsystem/src/main/res/layout/gayatag.xml new file mode 100644 index 00000000..2ac0b593 --- /dev/null +++ b/designsystem/src/main/res/layout/gayatag.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + diff --git a/designsystem/src/main/res/values/ds_attrs.xml b/designsystem/src/main/res/values/ds_attrs.xml index 18d08c8d..77fa29ff 100644 --- a/designsystem/src/main/res/values/ds_attrs.xml +++ b/designsystem/src/main/res/values/ds_attrs.xml @@ -48,6 +48,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -56,6 +90,14 @@ + + + + + + + + diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index 7c876b25..fdbc5dee 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -11,9 +11,18 @@ android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/Theme.AppCompat.Light"> + + + + android:theme="@style/Theme.Natura.Light" /> @@ -154,9 +163,6 @@ - \ No newline at end of file diff --git a/sample/src/main/assets/icons_map.txt b/sample/src/main/assets/icons_map.txt index 8402ea8a..c0b7787e 100644 --- a/sample/src/main/assets/icons_map.txt +++ b/sample/src/main/assets/icons_map.txt @@ -47,11 +47,16 @@ filled_communication_noconnection filled_content_bathtub filled_content_channel filled_content_childfriendly +filled_content_christmasstocking +filled_content_christmastree filled_content_crueltyfreebunny +filled_content_daynight filled_content_design filled_content_divulgation filled_content_dropper +filled_content_energy filled_content_exfoliator +filled_content_farmrows filled_content_gauge filled_content_giftpricefair filled_content_giftpricegreat @@ -75,7 +80,9 @@ filled_content_shower filled_content_snorkelmask filled_content_soap filled_content_soapbubble +filled_content_teddybear filled_content_violence +filled_content_wetwipe filled_content_wifi filled_content_world filled_default_mockup @@ -93,8 +100,12 @@ filled_finance_pix filled_finance_shield filled_finance_shieldcheck filled_finance_shieldplus +filled_makeup_antiacne filled_makeup_haircoily filled_makeup_haircurly +filled_makeup_hairdamaged +filled_makeup_hairdandruff +filled_makeup_hairreconstruction filled_makeup_hairtowel filled_makeup_hairwavy filled_makeup_hairwoman @@ -166,11 +177,14 @@ filled_product_pencilblush filled_product_recyclablepackaging filled_product_refill filled_product_shampoo +filled_product_shampooconditioner filled_product_soapliquid filled_social_fireworks filled_social_myprofile filled_social_nightlife +filled_social_pregnant filled_social_sparks +filled_social_userlock outlined_action_add outlined_action_addproduct outlined_action_attachment @@ -275,16 +289,21 @@ outlined_content_changeview outlined_content_channel outlined_content_childfriendly outlined_content_christmascard +outlined_content_christmasstocking +outlined_content_christmastree outlined_content_cloud outlined_content_consistency outlined_content_crueltyfreebunny +outlined_content_daynight outlined_content_design outlined_content_divulgation outlined_content_dropper outlined_content_education outlined_content_emptybag +outlined_content_energy outlined_content_exchangereports outlined_content_exfoliator +outlined_content_farmrows outlined_content_flower outlined_content_fragrance outlined_content_gallery @@ -340,9 +359,11 @@ outlined_content_store outlined_content_sun outlined_content_sunandcloud outlined_content_unavailable +outlined_content_teddybear outlined_content_violence outlined_content_virtualmirror outlined_content_wellness +outlined_content_wetwipe outlined_content_wifi outlined_content_world outlined_default_mockup @@ -379,12 +400,16 @@ outlined_finance_suitcase outlined_finance_tagdiscount outlined_finance_transfermoney outlined_makeup_age +outlined_makeup_antiacne outlined_makeup_eyebrow outlined_makeup_eyelashes outlined_makeup_eyeliner outlined_makeup_face outlined_makeup_haircoily outlined_makeup_haircurly +outlined_makeup_hairdamaged +outlined_makeup_hairdandruff +outlined_makeup_hairreconstruction outlined_makeup_hairtowel outlined_makeup_hairwavy outlined_makeup_hairwoman @@ -492,6 +517,7 @@ outlined_product_refill outlined_product_repurchase outlined_product_scent outlined_product_shampoo +outlined_product_shampooconditioner outlined_product_soapliquid outlined_product_vegan outlined_social_addcontact @@ -506,4 +532,6 @@ outlined_social_myprofile outlined_social_network outlined_social_nightlife outlined_social_person +outlined_social_pregnant outlined_social_sparks +outlined_social_userlock 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 5287044d..af2fe711 100644 --- a/sample/src/main/kotlin/com/natura/android/sample/MainActivity.kt +++ b/sample/src/main/kotlin/com/natura/android/sample/MainActivity.kt @@ -31,6 +31,8 @@ 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.GaYaSwitchActivity +import com.natura.android.sample.components.GaYaTagActivity import com.natura.android.sample.components.SnackbarActivity import com.natura.android.sample.components.listitem.ListItemActivity import com.natura.android.sample.databinding.ActivityMainBinding @@ -229,5 +231,13 @@ class MainActivity : AppCompatActivity() { binding.gayaRadiobuttonButton.setOnClickListener { startActivity(Intent(this, GaYaRadiobuttonActivity::class.java)) } + + binding.gayaSwitchButton.setOnClickListener { + startActivity(Intent(this, GaYaSwitchActivity::class.java)) + } + + binding.gayaTagButton.setOnClickListener { + startActivity(Intent(this, GaYaTagActivity::class.java)) + } } } diff --git a/sample/src/main/kotlin/com/natura/android/sample/components/GaYaSwitchActivity.kt b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaSwitchActivity.kt new file mode 100644 index 00000000..062afc0f --- /dev/null +++ b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaSwitchActivity.kt @@ -0,0 +1,45 @@ +package com.natura.android.sample.components + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.Gravity +import android.widget.LinearLayout +import com.natura.android.sample.R +import com.natura.android.sample.databinding.ActivityGayaSwitchBinding +import com.natura.android.sample.setChosenDefaultTheme +import com.natura.android.switch.GaYaSwitch + +class GaYaSwitchActivity : AppCompatActivity() { + + private lateinit var binding: ActivityGayaSwitchBinding + + override fun onCreate(savedInstanceState: Bundle?) { + setChosenDefaultTheme() + + super.onCreate(savedInstanceState) + binding = ActivityGayaSwitchBinding.inflate(layoutInflater) + + setContentView(binding.root) + + supportActionBar?.setDisplayHomeAsUpEnabled(true) + supportActionBar?.title = "GaYaSwitch" + + val gaYaSwitch = GaYaSwitch(this).apply { + isChecked = true + isEnabled = true + } + + val layoutParams = LinearLayout.LayoutParams( + LinearLayout.LayoutParams.WRAP_CONTENT, + LinearLayout.LayoutParams.WRAP_CONTENT + ).apply { + gravity = Gravity.START + } + + gaYaSwitch.layoutParams = layoutParams + + val container: LinearLayout = findViewById(R.id.lnlProgramatically) + container.addView(gaYaSwitch) + + } +} \ No newline at end of file diff --git a/sample/src/main/kotlin/com/natura/android/sample/components/GaYaTagActivity.kt b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaTagActivity.kt new file mode 100644 index 00000000..7ca1e8db --- /dev/null +++ b/sample/src/main/kotlin/com/natura/android/sample/components/GaYaTagActivity.kt @@ -0,0 +1,48 @@ +package com.natura.android.sample.components + +import androidx.appcompat.app.AppCompatActivity +import android.os.Bundle +import android.view.Gravity +import android.view.MenuItem +import android.widget.LinearLayout +import com.natura.android.sample.R +import com.natura.android.sample.databinding.ActivityGayaTagBinding +import com.natura.android.sample.setChosenDefaultTheme +import com.natura.android.switch.GaYaSwitch +import com.natura.android.tag.GaYaTag +import com.natura.android.tag.GaYaTagColor +import com.natura.android.tag.GaYaTagPosition +import com.natura.android.tag.GaYaTagSize + +class GaYaTagActivity : AppCompatActivity() { + + private lateinit var binding: ActivityGayaTagBinding + + override fun onCreate(savedInstanceState: Bundle?) { + setChosenDefaultTheme() + super.onCreate(savedInstanceState) + + binding = ActivityGayaTagBinding.inflate(layoutInflater) + + setContentView(binding.root) + + supportActionBar?.title = "GaYaTag" + supportActionBar?.setHomeButtonEnabled(true) + + val gayaTag = GaYaTag(this).apply { + label = "Adicionado programaticamente" + color = GaYaTagColor.InfoLightest.value + size = GaYaTagSize.Standard.value + icon = "outlined_action_calendar" + position = GaYaTagPosition.Right.value + } + + val container: LinearLayout = findViewById(R.id.lnlProgramatically) + container.addView(gayaTag) + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + onBackPressed() + return true + } +} \ No newline at end of file diff --git a/sample/src/main/res/layout/activity_gaya_switch.xml b/sample/src/main/res/layout/activity_gaya_switch.xml new file mode 100644 index 00000000..fce78ed3 --- /dev/null +++ b/sample/src/main/res/layout/activity_gaya_switch.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/sample/src/main/res/layout/activity_gaya_tag.xml b/sample/src/main/res/layout/activity_gaya_tag.xml new file mode 100644 index 00000000..4b5e1b27 --- /dev/null +++ b/sample/src/main/res/layout/activity_gaya_tag.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 ef41ce3d..24fd6d04 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -439,6 +439,18 @@ android:textAlignment="textStart" android:textColor="@color/highEmphasis" /> +