Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.externalNativeBuild
.cxx
*.iml
.idea/artifacts
.idea/caches
.idea/compiler.xml
.idea/deviceManager.xml
Expand Down Expand Up @@ -40,3 +41,6 @@ app/src/main/res/raw/changelog.md

# Mustache output
Module.md

# Kotlin Multiplatform
.kotlin/
2 changes: 1 addition & 1 deletion .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ dependencies {
implementation(project(":core"))
implementation(project(":foundation"))
implementation(project(":theme-orange"))
implementation(project(":theme-orange-compact"))
// implementation(project(":theme-orange-compact"))
implementation(project(":theme-sosh"))
implementation(project(":theme-wireframe"))

Expand Down Expand Up @@ -194,7 +194,7 @@ fun updateBuildConfig() {
gradle.projectsEvaluated {
tasks["preBuild"].apply {
dependsOn(":checkDocumentation")
dependsOn(":checkNotice")
//dependsOn(":checkNotice")
dependsOn(tasks["updateAppChangelog"])
}
updateBuildConfig()
Expand Down
8 changes: 4 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.MaterialComponents.NoActionBar">
<provider
android:name="com.orange.ouds.theme.orange.OrangeFontProvider"
android:authorities="com.orange.ouds.theme.orange.fontprovider"
android:exported="false" />
<!-- <provider-->
<!-- android:name="com.orange.ouds.theme.orange.OrangeFontProvider"-->
<!-- android:authorities="com.orange.ouds.theme.orange.fontprovider"-->
<!-- android:exported="false" />-->
<activity
android:name="com.orange.ouds.app.ui.MainActivity"
android:exported="true">
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/orange/ouds/app/OudsApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import com.google.firebase.Firebase
import com.google.firebase.crashlytics.crashlytics
import com.orange.ouds.theme.orange.OrangeFontFamily
import com.orange.ouds.theme.orange.OrangeHelveticaNeueArabic
import com.orange.ouds.theme.orange.OrangeHelveticaNeueLatin
//import com.orange.ouds.theme.orange.OrangeFontFamily
//import com.orange.ouds.theme.orange.OrangeHelveticaNeueArabic
//import com.orange.ouds.theme.orange.OrangeHelveticaNeueLatin
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
Expand All @@ -39,9 +39,9 @@ class OudsApplication : Application() {
// Thus we use the Android Downloadable Fonts feature to retrieve the files on a remote server.
// However the preferred way of using the Helvetica Neue font in the Orange themes is configuring
// bundled font files with `OrangeHelveticaNeueLatin.Bundled` and/or `OrangeHelveticaNeueArabic.Bundled`.
OrangeFontFamily.preloadDownloadableFontFamilies(this, listOf(OrangeHelveticaNeueLatin.Downloadable, OrangeHelveticaNeueArabic.Downloadable)) {
areDownloadableOrangeFontFamiliesPreloaded = true
}
// OrangeFontFamily.preloadDownloadableFontFamilies(this, listOf(OrangeHelveticaNeueLatin.Downloadable, OrangeHelveticaNeueArabic.Downloadable)) {
// areDownloadableOrangeFontFamiliesPreloaded = true
// }
}

private fun initializeCrashlytics() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ package com.orange.ouds.app.ui
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
Expand Down Expand Up @@ -53,7 +51,7 @@ fun ChangeThemeSettingsDialog(themeState: ThemeState, onThemeSettingsChange: (Ou

@Composable
private fun ChangeThemeSettingsDialogContent(themeState: ThemeState, onThemeSettingsChange: (OudsThemeSettings) -> Unit) {
var themeSettings by rememberSaveable { mutableStateOf(themeState.settings) }
var themeSettings by rememberSaveable(stateSaver = OudsThemeSettings.Saver) { mutableStateOf(themeState.settings) }
DialogContent(
title = stringResource(R.string.app_themeSettingsDialog_label)
) {
Expand Down
8 changes: 5 additions & 3 deletions app/src/main/java/com/orange/ouds/app/ui/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.foundation.RestrictedOudsApi
import com.orange.ouds.foundation.extensions.orElse
import com.orange.ouds.theme.OudsThemeSettings
import com.orange.ouds.theme.orange.ORANGE_THEME_NAME
import com.orange.ouds.theme.wireframe.WIREFRAME_THEME_NAME
//import com.orange.ouds.theme.orange.ORANGE_THEME_NAME
import dev.chrisbanes.haze.HazeStyle
import dev.chrisbanes.haze.hazeEffect
import dev.chrisbanes.haze.hazeSource
Expand All @@ -67,7 +68,8 @@ import dev.chrisbanes.haze.rememberHazeState
fun MainScreen(mainViewModel: MainViewModel = hiltViewModel()) {
MainScreen(
themeSettings = mainViewModel.getUserThemeSettings().orElse { OudsThemeSettings() },
currentThemeName = mainViewModel.getUserThemeName().orElse { ORANGE_THEME_NAME },
//currentThemeName = mainViewModel.getUserThemeName().orElse { ORANGE_THEME_NAME },
currentThemeName = mainViewModel.getUserThemeName().orElse { WIREFRAME_THEME_NAME },
onThemeChange = { themeName ->
mainViewModel.storeUserThemeName(themeName)
},
Expand Down Expand Up @@ -204,7 +206,7 @@ private fun PreviewMainScreen() = AppPreview {
// See https://issuetracker.google.com/issues/240601093
MainScreen(
themeSettings = OudsThemeSettings(),
currentThemeName = ORANGE_THEME_NAME,
currentThemeName = WIREFRAME_THEME_NAME,//ORANGE_THEME_NAME,
onThemeChange = {},
onThemeSettingsChange = {}
)
Expand Down
38 changes: 23 additions & 15 deletions app/src/main/java/com/orange/ouds/app/ui/ThemeState.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,17 @@ import com.orange.ouds.theme.orange.OrangeFontFamily
import com.orange.ouds.theme.orange.OrangeHelveticaNeueArabic
import com.orange.ouds.theme.orange.OrangeHelveticaNeueLatin
import com.orange.ouds.theme.orange.OrangeTheme
import com.orange.ouds.theme.orangecompact.ORANGE_COMPACT_THEME_NAME
import com.orange.ouds.theme.orangecompact.OrangeCompactTheme
import com.orange.ouds.theme.sosh.SOSH_THEME_NAME
import com.orange.ouds.theme.sosh.SoshTheme
//import com.orange.ouds.theme.orange.ORANGE_THEME_NAME
//import com.orange.ouds.theme.orange.OrangeFontFamily
//import com.orange.ouds.theme.orange.OrangeHelveticaNeueArabic
//import com.orange.ouds.theme.orange.OrangeHelveticaNeueLatin
//import com.orange.ouds.theme.orange.OrangeTheme
//import com.orange.ouds.theme.orangecompact.ORANGE_COMPACT_THEME_NAME
//import com.orange.ouds.theme.orangecompact.OrangeCompactTheme
//import com.orange.ouds.theme.sosh.SOSH_THEME_NAME
//import com.orange.ouds.theme.sosh.SoshTheme
import com.orange.ouds.theme.wireframe.WIREFRAME_THEME_NAME
import com.orange.ouds.theme.wireframe.WireframeTheme

Expand All @@ -38,11 +45,11 @@ fun rememberThemeState(
settings: OudsThemeSettings = OudsThemeSettings(),
themeNames: List<String> = listOf(
ORANGE_THEME_NAME,
ORANGE_COMPACT_THEME_NAME,
// ORANGE_COMPACT_THEME_NAME,
SOSH_THEME_NAME,
WIREFRAME_THEME_NAME
),
currentThemeName: String = ORANGE_THEME_NAME,
currentThemeName: String = WIREFRAME_THEME_NAME,//ORANGE_THEME_NAME,
areDownloadableOrangeFontFamiliesPreloaded: Boolean = false
) = rememberSaveable(settings, themeNames, currentThemeName, areDownloadableOrangeFontFamiliesPreloaded, saver = ThemeState.Saver) {
ThemeState(settings, themeNames, currentThemeName, areDownloadableOrangeFontFamiliesPreloaded)
Expand All @@ -64,17 +71,18 @@ class ThemeState(
save = { state ->
with(state) {
listOf(
settings,
with(OudsThemeSettings.Saver) { save(settings) },
themeNames,
currentThemeName,
areDownloadableOrangeFontFamilyPreloaded
)
}
},
restore = { list ->
restore = { list: List<Any?> ->
val settings = list[0]?.let { OudsThemeSettings.Saver.restore(it) }
@Suppress("UNCHECKED_CAST")
ThemeState(
list[0] as OudsThemeSettings,
settings as OudsThemeSettings,
list[1] as List<String>,
list[2] as String,
list[3] as Boolean
Expand Down Expand Up @@ -107,7 +115,7 @@ class ThemeState(

private fun getCurrentTheme(name: String): OudsThemeContract {
return themes.firstOrNull { it.name == name }
.orElse { themes.firstOrNull { it.name == ORANGE_THEME_NAME } }
.orElse { themes.firstOrNull { it.name == WIREFRAME_THEME_NAME } }
.orElse { themes.first() }
}

Expand All @@ -122,13 +130,13 @@ class ThemeState(
roundedCornerProgressIndicators = roundedCornerProgressIndicators.orElse { false },
roundedCornerTextInputs = roundedCornerTextInputs.orElse { false }
)
ORANGE_COMPACT_THEME_NAME -> OrangeCompactTheme(
orangeFontFamily = OrangeFontFamily(OrangeHelveticaNeueLatin.Downloadable, OrangeHelveticaNeueArabic.Downloadable),
roundedCornerAlertMessages = roundedCornerAlertMessages.orElse { false },
roundedCornerButtons = roundedCornerButtons.orElse { false },
roundedCornerProgressIndicators = roundedCornerProgressIndicators.orElse { false },
roundedCornerTextInputs = roundedCornerTextInputs.orElse { false }
)
// ORANGE_COMPACT_THEME_NAME -> OrangeCompactTheme(
// orangeFontFamily = OrangeFontFamily(OrangeHelveticaNeueLatin.Downloadable, OrangeHelveticaNeueArabic.Downloadable),
// roundedCornerAlertMessages = roundedCornerAlertMessages.orElse { false },
// roundedCornerButtons = roundedCornerButtons.orElse { false },
// roundedCornerProgressIndicators = roundedCornerProgressIndicators.orElse { false },
// roundedCornerTextInputs = roundedCornerTextInputs.orElse { false }
// )
SOSH_THEME_NAME -> SoshTheme()
WIREFRAME_THEME_NAME -> WireframeTheme()
else -> null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,11 @@ package com.orange.ouds.app.ui.components

import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.WindowInsetsSides
import androidx.compose.foundation.layout.asPaddingValues
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.only
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBars
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ import androidx.compose.runtime.staticCompositionLocalOf
import com.orange.ouds.app.R
import com.orange.ouds.theme.OudsThemeContract
import com.orange.ouds.theme.orange.OrangeTheme
import com.orange.ouds.theme.orangecompact.OrangeCompactTheme
import com.orange.ouds.theme.sosh.SoshTheme
//import com.orange.ouds.theme.orange.OrangeTheme
//import com.orange.ouds.theme.orangecompact.OrangeCompactTheme
//import com.orange.ouds.theme.sosh.SoshTheme
import com.orange.ouds.theme.wireframe.WireframeTheme
import kotlin.reflect.KProperty1

Expand All @@ -29,7 +31,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val avatar: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_avatar
is OrangeTheme -> R.drawable.ic_orange_avatar
is SoshTheme -> R.drawable.ic_sosh_avatar
is WireframeTheme -> R.drawable.ic_wireframe_avatar
else -> error(ThemeDrawableResources::avatar)
Expand All @@ -38,7 +40,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val call: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_call
is OrangeTheme -> R.drawable.ic_orange_call
is SoshTheme -> R.drawable.ic_sosh_call
is WireframeTheme -> R.drawable.ic_wireframe_call
else -> error(ThemeDrawableResources::call)
Expand All @@ -47,7 +49,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val filters: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_filters
is OrangeTheme -> R.drawable.ic_orange_filters
is SoshTheme -> R.drawable.ic_sosh_filters
is WireframeTheme -> R.drawable.ic_wireframe_filters
else -> error(ThemeDrawableResources::filters)
Expand All @@ -56,7 +58,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val formChevronDown: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_form_chevron_down
is OrangeTheme -> R.drawable.ic_orange_form_chevron_down
is SoshTheme -> R.drawable.ic_sosh_form_chevron_down
is WireframeTheme -> R.drawable.ic_wireframe_form_chevron_down
else -> error(ThemeDrawableResources::formChevronDown)
Expand All @@ -65,7 +67,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val home: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_home
is OrangeTheme -> R.drawable.ic_orange_home
is SoshTheme -> R.drawable.ic_sosh_home
is WireframeTheme -> R.drawable.ic_wireframe_home
else -> error(ThemeDrawableResources::home)
Expand All @@ -74,7 +76,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val info: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_info
is OrangeTheme -> R.drawable.ic_orange_info
is SoshTheme -> R.drawable.ic_sosh_info
is WireframeTheme -> R.drawable.ic_wireframe_info
else -> error(ThemeDrawableResources::info)
Expand All @@ -83,7 +85,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val menuGrid: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_menu_grid
is OrangeTheme -> R.drawable.ic_orange_menu_grid
is SoshTheme -> R.drawable.ic_sosh_menu_grid
is WireframeTheme -> R.drawable.ic_wireframe_menu_grid
else -> error(ThemeDrawableResources::menuGrid)
Expand All @@ -92,7 +94,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val notificationAlert: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_notification_alert
is OrangeTheme -> R.drawable.ic_orange_notification_alert
is SoshTheme -> R.drawable.ic_sosh_notification_alert
is WireframeTheme -> R.drawable.ic_wireframe_notification_alert
else -> error(ThemeDrawableResources::notificationAlert)
Expand All @@ -101,7 +103,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val palette: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_palette
is OrangeTheme -> R.drawable.ic_orange_palette
is SoshTheme -> R.drawable.ic_sosh_palette
is WireframeTheme -> R.drawable.ic_wireframe_palette
else -> error(ThemeDrawableResources::palette)
Expand All @@ -110,7 +112,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val settings: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_settings
is OrangeTheme -> R.drawable.ic_orange_settings
is SoshTheme -> R.drawable.ic_sosh_settings
is WireframeTheme -> R.drawable.ic_wireframe_settings
else -> error(ThemeDrawableResources::settings)
Expand All @@ -119,7 +121,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val shop: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_shop
is OrangeTheme -> R.drawable.ic_orange_shop
is SoshTheme -> R.drawable.ic_sosh_shop
is WireframeTheme -> R.drawable.ic_wireframe_shop
else -> error(ThemeDrawableResources::shop)
Expand All @@ -128,7 +130,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val smsMessage: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_sms_message
is OrangeTheme -> R.drawable.ic_orange_sms_message
is SoshTheme -> R.drawable.ic_sosh_sms_message
is WireframeTheme -> R.drawable.ic_wireframe_sms_message
else -> error(ThemeDrawableResources::smsMessage)
Expand All @@ -137,7 +139,7 @@ class ThemeDrawableResources(val theme: OudsThemeContract) {
val tipsAndTricks: Int
@DrawableRes
get() = when (theme) {
is OrangeTheme, is OrangeCompactTheme -> R.drawable.ic_orange_tips_and_tricks
is OrangeTheme -> R.drawable.ic_orange_tips_and_tricks
is SoshTheme -> R.drawable.ic_sosh_tips_and_tricks
is WireframeTheme -> R.drawable.ic_wireframe_tips_and_tricks
else -> error(ThemeDrawableResources::tipsAndTricks)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import com.orange.ouds.foundation.InternalOudsApi
import com.orange.ouds.theme.orange.OrangeTheme
import com.orange.ouds.theme.orange.getPreviewOrangeFontFamily

//import com.orange.ouds.theme.orange.OrangeTheme
//import com.orange.ouds.theme.orange.getPreviewOrangeFontFamily

@OptIn(InternalOudsApi::class)
@Composable
fun AppPreview(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ import androidx.compose.ui.unit.dp
import com.orange.ouds.app.R
import com.orange.ouds.app.ui.utilities.Code
import com.orange.ouds.core.theme.OudsTheme
import com.orange.ouds.theme.orange.OrangeTheme
import com.orange.ouds.theme.wireframe.WireframeTheme
//import com.orange.ouds.theme.orange.OrangeTheme
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch

Expand Down Expand Up @@ -109,7 +110,7 @@ internal fun PreviewCodeSnippet() = AppPreview {
comment("Apply Orange theme")
functionCall("OudsTheme") {
trailingLambda = true
constructorCallArgument<OrangeTheme>("theme")
constructorCallArgument<WireframeTheme>("theme")
functionCallArgument("darkThemeEnabled", "isSystemInDarkTheme")
lambdaArgument("content") {
comment("Content")
Expand Down
Loading