Skip to content

Commit

Permalink
ANDROID-13833 Created a clone of VivoNew to mitigate a inheritance st…
Browse files Browse the repository at this point in the history
…yling problem.
  • Loading branch information
dagonco committed Nov 7, 2023
1 parent 32738df commit f7c3b2f
Show file tree
Hide file tree
Showing 16 changed files with 884 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import com.telefonica.mistica.compose.theme.brand.BrandType.O2
import com.telefonica.mistica.compose.theme.brand.BrandType.TELEFONICA
import com.telefonica.mistica.compose.theme.brand.BrandType.VIVO
import com.telefonica.mistica.compose.theme.brand.BrandType.VIVO_NEW
import com.telefonica.mistica.compose.theme.brand.BrandType.VIVO_NEW_OVERRIDE
import com.telefonica.mistica.compose.theme.brand.MovistarBrand
import com.telefonica.mistica.input.DropDownInput
import com.telefonica.mistica.list.ListRowView
Expand Down Expand Up @@ -48,6 +49,7 @@ class CatalogMainActivity : AppCompatActivity() {
ComponentStyle("O2", R.style.MisticaTheme_O2, O2),
ComponentStyle("Vivo", R.style.MisticaTheme_Vivo, VIVO),
ComponentStyle("Vivo New", R.style.MisticaTheme_VivoNew, VIVO_NEW),
ComponentStyle("Vivo New Override", R.style.VivoNewOverride, VIVO_NEW_OVERRIDE),
ComponentStyle("Telefonica", R.style.MisticaTheme_Telefonica, TELEFONICA),
ComponentStyle("Blau", R.style.MisticaTheme_Blau, BLAU),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,23 @@ import com.telefonica.mistica.catalog.ui.compose.components.TabsCatalog
import com.telefonica.mistica.catalog.ui.compose.components.Tags
import com.telefonica.mistica.catalog.ui.compose.components.Texts
import com.telefonica.mistica.catalog.ui.compose.components.Titles
import com.telefonica.mistica.compose.badge.Badge
import com.telefonica.mistica.compose.theme.MisticaTheme
import com.telefonica.mistica.compose.theme.brand.BlauBrand
import com.telefonica.mistica.compose.theme.brand.Brand
import com.telefonica.mistica.compose.theme.brand.BrandType
import com.telefonica.mistica.compose.theme.brand.BrandType.*
import com.telefonica.mistica.compose.theme.brand.BrandType.BLAU
import com.telefonica.mistica.compose.theme.brand.BrandType.MOVISTAR
import com.telefonica.mistica.compose.theme.brand.BrandType.O2
import com.telefonica.mistica.compose.theme.brand.BrandType.TELEFONICA
import com.telefonica.mistica.compose.theme.brand.BrandType.VIVO
import com.telefonica.mistica.compose.theme.brand.BrandType.VIVO_NEW
import com.telefonica.mistica.compose.theme.brand.BrandType.VIVO_NEW_OVERRIDE
import com.telefonica.mistica.compose.theme.brand.MovistarBrand
import com.telefonica.mistica.compose.theme.brand.O2Brand
import com.telefonica.mistica.compose.theme.brand.TelefonicaBrand
import com.telefonica.mistica.compose.theme.brand.VivoBrand
import com.telefonica.mistica.compose.theme.brand.VivoNewBrand
import com.telefonica.mistica.compose.theme.brand.VivoNewOverrideBrand

class ComponentCatalogActivity : FragmentActivity() {

Expand Down Expand Up @@ -244,6 +250,7 @@ class ComponentCatalogActivity : FragmentActivity() {
O2 -> O2Brand
VIVO -> VivoBrand
VIVO_NEW -> VivoNewBrand
VIVO_NEW_OVERRIDE -> VivoNewOverrideBrand
TELEFONICA -> TelefonicaBrand
BLAU -> BlauBrand
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import com.telefonica.mistica.compose.composeview.AbstractMisticaComposeView.Com
import com.telefonica.mistica.compose.composeview.AbstractMisticaComposeView.Companion.BRAND_VALUE_TELEFONICA
import com.telefonica.mistica.compose.composeview.AbstractMisticaComposeView.Companion.BRAND_VALUE_VIVO
import com.telefonica.mistica.compose.composeview.AbstractMisticaComposeView.Companion.BRAND_VALUE_VIVO_NEW
import com.telefonica.mistica.compose.composeview.AbstractMisticaComposeView.Companion.BRAND_VALUE_VIVO_NEW_OVERRIDE
import com.telefonica.mistica.compose.theme.MisticaTheme
import com.telefonica.mistica.compose.theme.brand.BlauBrand
import com.telefonica.mistica.compose.theme.brand.Brand
Expand All @@ -20,6 +21,7 @@ import com.telefonica.mistica.compose.theme.brand.O2Brand
import com.telefonica.mistica.compose.theme.brand.TelefonicaBrand
import com.telefonica.mistica.compose.theme.brand.VivoBrand
import com.telefonica.mistica.compose.theme.brand.VivoNewBrand
import com.telefonica.mistica.compose.theme.brand.VivoNewOverrideBrand

abstract class AbstractMisticaComposeView @JvmOverloads constructor(
context: Context,
Expand Down Expand Up @@ -69,6 +71,7 @@ abstract class AbstractMisticaComposeView @JvmOverloads constructor(
const val BRAND_VALUE_TELEFONICA = 3
const val BRAND_VALUE_BLAU = 4
const val BRAND_VALUE_VIVO_NEW = 5
const val BRAND_VALUE_VIVO_NEW_OVERRIDE = 6
}
}

Expand All @@ -79,5 +82,6 @@ fun Int.mapToComposeBrand(): Brand = when (this) {
BRAND_VALUE_TELEFONICA -> TelefonicaBrand
BRAND_VALUE_BLAU -> BlauBrand
BRAND_VALUE_VIVO_NEW -> VivoNewBrand
BRAND_VALUE_VIVO_NEW_OVERRIDE -> VivoNewOverrideBrand
else -> TelefonicaBrand
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ interface Brand {
val radius: MisticaRadius
}

enum class BrandType { BLAU, MOVISTAR, O2, TELEFONICA, VIVO, VIVO_NEW }
enum class BrandType { BLAU, MOVISTAR, O2, TELEFONICA, VIVO, VIVO_NEW, VIVO_NEW_OVERRIDE }
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.telefonica.mistica.compose.theme.brand

import com.telefonica.mistica.R

object VivoNewOverrideBrand : Brand {

override val compatibilityTheme: Int
get() = R.style.VivoNewOverride

override val lightColors = VivoNewOverrideBrandColors.lightColors

override val darkColors = VivoNewOverrideBrandColors.darkColors

override val preset5FontWeight = VivoNewOverrideBrandFontWeights.text5FontWeight

override val preset6FontWeight = VivoNewOverrideBrandFontWeights.text6FontWeight

override val preset7FontWeight = VivoNewOverrideBrandFontWeights.text7FontWeight

override val preset8FontWeight = VivoNewOverrideBrandFontWeights.text8FontWeight

override val cardTitleFontWeight = VivoNewOverrideBrandFontWeights.cardTitleFontWeight

override val buttonFontWeight = VivoNewOverrideBrandFontWeights.buttonFontWeight

override val linkFontWeight = VivoNewOverrideBrandFontWeights.linkFontWeight

override val title1FontWeight = VivoNewOverrideBrandFontWeights.title1FontWeight

override val indicatorFontWeight = VivoNewOverrideBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = VivoNewOverrideBrandFontWeights.tabsLabelFontWeight

override val tabsLabelFontSize = VivoNewOverrideBrandFontSizes.tabsLabelFontSize

override val radius = VivoNewOverrideBrandRadius.radius
}
Loading

0 comments on commit f7c3b2f

Please sign in to comment.