Skip to content

Commit

Permalink
ANDROID-15048 Update. Compose migration with new titles
Browse files Browse the repository at this point in the history
  • Loading branch information
haynlo committed Aug 30, 2024
1 parent b34175f commit f8880d0
Show file tree
Hide file tree
Showing 18 changed files with 254 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.telefonica.mistica.catalog.ui.compose.components

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
Expand All @@ -21,7 +23,8 @@ fun Titles() {
.padding(16.dp)
) {
DefaultTitles()
TitleStyle.values().forEach {
TitleStyle.entries.forEach {
Spacer(modifier = Modifier.height(24.dp))
TitlesWithStyleOverridden(it)
}
}
Expand Down
133 changes: 118 additions & 15 deletions catalog/src/main/res/layout/title_catalog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,40 @@
android:orientation="vertical">

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title"
android:id="@+id/short_default_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:isTitleHeading="true"
app:title="Short default Title" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title"
android:id="@+id/long_default_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:title="Some default title that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_link"
android:id="@+id/short_default_title_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:title="Short default Title" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title_with_link"
android:id="@+id/long_default_title_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:title="Some default title that can get really long and almost fill the whole line" />

<Space
android:layout_width="match_parent"
android:layout_height="24dp" />

<com.telefonica.mistica.title.TitleView
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down Expand Up @@ -76,15 +80,29 @@
app:title="Some title 1 that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_1"
android:id="@+id/short_title_with_style_1_with_link_and_chevron"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:linkWithChevron="true"
app:titleStyle="title1"
app:title="Some title 1 with chevron" />

<Space
android:layout_width="match_parent"
android:layout_height="24dp" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:titleStyle="title2"
app:title="Some title 2" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_1_with_link"
android:id="@+id/short_title_with_style_2_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
Expand All @@ -93,15 +111,15 @@
app:title="Some title 2" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title_with_style_1"
android:id="@+id/long_title_with_style_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:titleStyle="title2"
app:title="Some title 2 that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title_with_style_1_with_link"
android:id="@+id/long_title_with_style_2_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
Expand All @@ -110,25 +128,110 @@
app:title="Some title 2 that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_1_with_link_and_chevron"
android:id="@+id/short_title_with_style_2_with_link_and_chevron"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:linkWithChevron="true"
app:titleStyle="title1"
app:title="Some title 1 with chevron" />
app:titleStyle="title2"
app:title="Some title 2 with chevron" />

<Space
android:layout_width="match_parent"
android:layout_height="24dp" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_2_with_link_and_chevron"
android:id="@+id/short_title_with_style_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:titleStyle="title3"
app:title="Some title 3" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_3_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:titleStyle="title3"
app:title="Some title 3" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title_with_style_3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:titleStyle="title3"
app:title="Some title 3 that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title_with_style_3_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:titleStyle="title3"
app:title="Some title 3 that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_3_with_link_and_chevron"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:linkWithChevron="true"
app:titleStyle="title2"
app:title="Some title 2 with chevron" />
app:titleStyle="title3"
app:title="Some title 3 with chevron" />

</LinearLayout>
<Space
android:layout_width="match_parent"
android:layout_height="24dp" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:titleStyle="title4"
app:title="Some title 4" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_4_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:titleStyle="title4"
app:title="Some title 4" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title_with_style_4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:titleStyle="title4"
app:title="Some title 4 that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/long_title_with_style_4_with_link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:titleStyle="title4"
app:title="Some title 4 that can get really long and almost fill the whole line" />

<com.telefonica.mistica.title.TitleView
android:id="@+id/short_title_with_style_4_with_link_and_chevron"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
app:link="Some link"
app:linkWithChevron="true"
app:titleStyle="title4"
app:title="Some title 4 with chevron" />

</LinearLayout>
</ScrollView>
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ fun MisticaTheme(
presetSmallButtonFontWeight = brand.buttonFontWeight,
presetLinkFontWeight = brand.linkFontWeight,
presetTitle1FontWeight = brand.title1FontWeight,
presetTitle2FontWeight = brand.title2FontWeight,
presetTitle3FontWeight = brand.title3FontWeight,
presetTitle3FontSize = brand.title3FontSize,
presetIndicatorFontWeight = brand.indicatorFontWeight,
presetTabsLabelFontWeight = brand.tabsLabelFontWeight,
presetTabsLabelFontSize = brand.tabsLabelFontSize,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.telefonica.mistica.compose.theme.brand

import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.TextUnit
import com.telefonica.mistica.R
import com.telefonica.mistica.compose.theme.brushes.MisticaBrushes

Expand Down Expand Up @@ -36,6 +38,12 @@ object BlauBrand : Brand {

override val title1FontWeight = BlauBrandFontWeights.title1FontWeight

override val title2FontWeight = BlauBrandFontWeights.title2FontWeight

override val title3FontWeight = BlauBrandFontWeights.title3FontWeight

override val title3FontSize = BlauBrandFontSizes.title3FontSize

override val indicatorFontWeight = BlauBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = BlauBrandFontWeights.tabsLabelFontWeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ interface Brand {
val buttonFontWeight: FontWeight
val linkFontWeight: FontWeight
val title1FontWeight: FontWeight
val title2FontWeight: FontWeight
val title3FontWeight: FontWeight
val title3FontSize: TextUnit
val indicatorFontWeight: FontWeight
val tabsLabelFontWeight: FontWeight
val tabsLabelFontSize: TextUnit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,20 @@ object MovistarBrand : Brand {

override val title1FontWeight = MovistarBrandFontWeights.title1FontWeight

override val title2FontWeight = MovistarBrandFontWeights.title2FontWeight

override val title3FontWeight = MovistarBrandFontWeights.title3FontWeight

override val title3FontSize = MovistarBrandFontSizes.title3FontSize

override val indicatorFontWeight = MovistarBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = MovistarBrandFontWeights.tabsLabelFontWeight

override val tabsLabelFontSize = MovistarBrandFontSizes.tabsLabelFontSize

override val values: MisticaValues
get() = super.values.copy(titleStyle = TitleStyle.TITLE_2)
get() = super.values.copy(titleStyle = TitleStyle.TITLE_3)

override val radius = MovistarBrandRadius.radius
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ object O2Brand : Brand {

override val title1FontWeight = O2BrandFontWeights.title1FontWeight

override val title2FontWeight = O2BrandFontWeights.title2FontWeight

override val title3FontWeight = O2BrandFontWeights.title3FontWeight

override val title3FontSize = O2BrandFontSizes.title3FontSize

override val indicatorFontWeight = O2BrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = O2BrandFontWeights.tabsLabelFontWeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ object O2NewBrand : Brand {

override val title1FontWeight = O2NewBrandFontWeights.title1FontWeight

override val title2FontWeight = O2NewBrandFontWeights.title2FontWeight

override val title3FontWeight = O2NewBrandFontWeights.title3FontWeight

override val title3FontSize = O2NewBrandFontSizes.title3FontSize

override val indicatorFontWeight = O2NewBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = O2NewBrandFontWeights.tabsLabelFontWeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ object TelefonicaBrand : Brand {

override val title1FontWeight = TelefonicaBrandFontWeights.title1FontWeight

override val title2FontWeight = TelefonicaBrandFontWeights.title2FontWeight

override val title3FontWeight = TelefonicaBrandFontWeights.title3FontWeight

override val title3FontSize = TelefonicaBrandFontSizes.title3FontSize

override val indicatorFontWeight = TelefonicaBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = TelefonicaBrandFontWeights.tabsLabelFontWeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ object TuBrand : Brand {

override val title1FontWeight: FontWeight = TuBrandFontWeights.title1FontWeight

override val title2FontWeight: FontWeight = TuBrandFontWeights.title2FontWeight

override val title3FontWeight: FontWeight = TuBrandFontWeights.title3FontWeight

override val title3FontSize: TextUnit = TuBrandFontSizes.title3FontSize

override val indicatorFontWeight: FontWeight = TuBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight: FontWeight = TuBrandFontWeights.tabsLabelFontWeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ object VivoBrand : Brand {

override val title1FontWeight = VivoBrandFontWeights.title1FontWeight

override val title2FontWeight = VivoBrandFontWeights.title2FontWeight

override val title3FontWeight = VivoBrandFontWeights.title3FontWeight

override val title3FontSize = VivoBrandFontSizes.title3FontSize

override val indicatorFontWeight = VivoBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = VivoBrandFontWeights.tabsLabelFontWeight
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ object VivoNewBrand : Brand {

override val title1FontWeight = VivoNewBrandFontWeights.title1FontWeight

override val title2FontWeight = VivoNewBrandFontWeights.title2FontWeight

override val title3FontWeight = VivoNewBrandFontWeights.title3FontWeight

override val title3FontSize = VivoNewBrandFontSizes.title3FontSize

override val indicatorFontWeight = VivoNewBrandFontWeights.indicatorFontWeight

override val tabsLabelFontWeight = VivoNewBrandFontWeights.tabsLabelFontWeight
Expand Down
Loading

0 comments on commit f8880d0

Please sign in to comment.