-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ANDROID-14825 Add fonts in Mistica Catalog app #394
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
catalog/src/main/java/com/telefonica/mistica/catalog/ui/compose/common/CatalogBrands.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
package com.telefonica.mistica.catalog.ui.compose.common | ||
|
||
import androidx.compose.ui.text.font.Font | ||
import androidx.compose.ui.text.font.FontFamily | ||
import androidx.compose.ui.text.font.FontWeight | ||
import androidx.compose.ui.unit.TextUnit | ||
import com.telefonica.mistica.catalog.R | ||
import com.telefonica.mistica.compose.theme.brand.Brand | ||
import com.telefonica.mistica.compose.theme.brand.MovistarBrand | ||
import com.telefonica.mistica.compose.theme.brand.O2Brand | ||
import com.telefonica.mistica.compose.theme.brand.O2NewBrand | ||
import com.telefonica.mistica.compose.theme.brand.TelefonicaBrand | ||
import com.telefonica.mistica.compose.theme.brand.TuBrand | ||
import com.telefonica.mistica.compose.theme.brand.VivoBrand | ||
import com.telefonica.mistica.compose.theme.brand.VivoNewBrand | ||
import com.telefonica.mistica.compose.theme.brushes.MisticaBrushes | ||
import com.telefonica.mistica.compose.theme.color.MisticaColors | ||
import com.telefonica.mistica.compose.theme.values.MisticaRadius | ||
|
||
abstract class CatalogBrand( | ||
baseBrand: Brand, | ||
val theme: Int, | ||
) : Brand { | ||
override val compatibilityTheme: Int | ||
get() = theme | ||
override val lightColors: MisticaColors = baseBrand.lightColors | ||
override val darkColors: MisticaColors = baseBrand.darkColors | ||
override val lightBrushes: MisticaBrushes = baseBrand.lightBrushes | ||
override val darkBrushes: MisticaBrushes = baseBrand.darkBrushes | ||
override val preset5FontWeight: FontWeight = baseBrand.preset5FontWeight | ||
override val preset6FontWeight: FontWeight = baseBrand.preset6FontWeight | ||
override val preset7FontWeight: FontWeight = baseBrand.preset7FontWeight | ||
override val preset8FontWeight: FontWeight = baseBrand.preset8FontWeight | ||
override val preset9FontWeight: FontWeight = baseBrand.preset9FontWeight | ||
override val preset10FontWeight: FontWeight = baseBrand.preset10FontWeight | ||
override val cardTitleFontWeight: FontWeight = baseBrand.cardTitleFontWeight | ||
override val buttonFontWeight: FontWeight = baseBrand.buttonFontWeight | ||
override val linkFontWeight: FontWeight = baseBrand.linkFontWeight | ||
override val title1FontWeight: FontWeight = baseBrand.title1FontWeight | ||
override val title2FontWeight: FontWeight = baseBrand.title2FontWeight | ||
override val title3FontWeight: FontWeight = baseBrand.title3FontWeight | ||
override val title3FontSize: TextUnit = baseBrand.title3FontSize | ||
override val indicatorFontWeight: FontWeight = baseBrand.indicatorFontWeight | ||
override val tabsLabelFontWeight: FontWeight = baseBrand.tabsLabelFontWeight | ||
override val tabsLabelFontSize: TextUnit = baseBrand.tabsLabelFontSize | ||
override val radius: MisticaRadius = baseBrand.radius | ||
override val fontFamily: FontFamily = baseBrand.fontFamily | ||
} | ||
|
||
object CatalogMovistarBrand : CatalogBrand(MovistarBrand, R.style.CatalogMovistar) { | ||
override val fontFamily: FontFamily | ||
get() = FontFamily( | ||
Font(R.font.onair_light, FontWeight.Light), | ||
Font(R.font.onair_regular, FontWeight.Normal), | ||
Font(R.font.onair_medium, FontWeight.Medium), | ||
) | ||
} | ||
|
||
object CatalogO2Brand : CatalogBrand(O2Brand, R.style.CatalogO2) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A minor, could we have O2 with his brother O2New together as Vivo is with its two themes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done! |
||
override val fontFamily: FontFamily | ||
get() = FontFamily( | ||
Font(R.font.onair_light, FontWeight.Light), | ||
Font(R.font.onair_regular, FontWeight.Normal), | ||
Font(R.font.onair_medium, FontWeight.Medium), | ||
) | ||
} | ||
|
||
object CatalogVivoBrand : CatalogBrand(VivoBrand, R.style.CatalogVivo) { | ||
override val fontFamily: FontFamily | ||
get() = FontFamily( | ||
Font(R.font.vivo_type_light, FontWeight.Light), | ||
Font(R.font.vivo_type_regular, FontWeight.Normal), | ||
Font(R.font.vivo_type_medium, FontWeight.Medium), | ||
) | ||
} | ||
|
||
object CatalogVivoNewBrand : CatalogBrand(VivoNewBrand, R.style.CatalogVivoNew) { | ||
override val fontFamily: FontFamily | ||
get() = FontFamily( | ||
Font(R.font.vivo_type_light, FontWeight.Light), | ||
Font(R.font.vivo_type_regular, FontWeight.Normal), | ||
Font(R.font.vivo_type_medium, FontWeight.Medium), | ||
) | ||
} | ||
|
||
object CatalogTelefonicaBrand : CatalogBrand(TelefonicaBrand, R.style.CatalogTelefonica) { | ||
override val fontFamily: FontFamily | ||
get() = FontFamily( | ||
Font(R.font.telefonica_sans_light, FontWeight.Light), | ||
Font(R.font.telefonica_sans_regular, FontWeight.Normal), | ||
Font(R.font.telefonica_sans_medium, FontWeight.Medium), | ||
) | ||
} | ||
|
||
object CatalogBlauBrand : CatalogBrand(TelefonicaBrand, R.style.CatalogBlau) | ||
|
||
object CatalogTuBrand : CatalogBrand(TuBrand, R.style.CatalogTu) { | ||
override val fontFamily: FontFamily | ||
get() = FontFamily( | ||
Font(R.font.telefonica_sans_light, FontWeight.Light), | ||
Font(R.font.telefonica_sans_regular, FontWeight.Normal), | ||
Font(R.font.telefonica_sans_medium, FontWeight.Medium), | ||
) | ||
} | ||
|
||
object CatalogO2NewBrand : CatalogBrand(O2NewBrand, R.style.CatalogO2New) { | ||
override val fontFamily: FontFamily | ||
get() = FontFamily( | ||
Font(R.font.onair_light, FontWeight.Light), | ||
Font(R.font.onair_regular, FontWeight.Normal), | ||
Font(R.font.onair_medium, FontWeight.Medium), | ||
) | ||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
|
||
<style name="CatalogMovistar" parent="MisticaTheme.Movistar"> | ||
<item name="font_family_light">@font/onair_light</item> | ||
<item name="font_family_regular">@font/onair_regular</item> | ||
<item name="font_family_medium">@font/onair_medium</item> | ||
</style> | ||
|
||
<style name="CatalogO2" parent="MisticaTheme.O2"> | ||
<item name="font_family_light">@font/onair_light</item> | ||
<item name="font_family_regular">@font/onair_regular</item> | ||
<item name="font_family_medium">@font/onair_medium</item> | ||
</style> | ||
|
||
<style name="CatalogVivo" parent="MisticaTheme.Vivo"> | ||
<item name="font_family_light">@font/vivo_type_light</item> | ||
<item name="font_family_regular">@font/vivo_type_regular</item> | ||
<item name="font_family_medium">@font/vivo_type_medium</item> | ||
</style> | ||
|
||
<style name="CatalogVivoNew" parent="MisticaTheme.VivoNew"> | ||
<item name="font_family_light">@font/vivo_type_light</item> | ||
<item name="font_family_regular">@font/vivo_type_regular</item> | ||
<item name="font_family_medium">@font/vivo_type_medium</item> | ||
</style> | ||
|
||
<style name="CatalogTelefonica" parent="MisticaTheme.Telefonica"> | ||
<item name="font_family_light">@font/telefonica_sans_light</item> | ||
<item name="font_family_regular">@font/telefonica_sans_regular</item> | ||
<item name="font_family_medium">@font/telefonica_sans_medium</item> | ||
</style> | ||
|
||
<style name="CatalogBlau" parent="MisticaTheme.Blau"/> | ||
|
||
<style name="CatalogTu" parent="MisticaTheme.Tu"> | ||
<item name="font_family_light">@font/telefonica_sans_light</item> | ||
<item name="font_family_regular">@font/telefonica_sans_regular</item> | ||
<item name="font_family_medium">@font/telefonica_sans_medium</item> | ||
</style> | ||
|
||
<style name="CatalogO2New" parent="MisticaTheme.O2New"> | ||
<item name="font_family_light">@font/onair_light</item> | ||
<item name="font_family_regular">@font/onair_regular</item> | ||
<item name="font_family_medium">@font/onair_medium</item> | ||
</style> | ||
|
||
</resources> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now seeing this, it is necessary that theme is computed every time that compatibilityTheme is retrieved? cc: @yamal-alm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we can use
override val compatibilityTheme: Int = theme
insteadThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done