diff --git a/app/build.gradle b/app/build.gradle index b87b96117..a0f268eb6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,6 +8,7 @@ plugins { def config = configHelper.fetchConfig() def appId = config.getOrDefault("APPLICATION_ID", "org.openedx.app") +def platformName = config.getOrDefault("PLATFORM_NAME", "OpenEdx").toLowerCase() android { compileSdk 34 @@ -39,6 +40,18 @@ android { } } + sourceSets { + prod { + res.srcDirs = ["src/$platformName/res"] + } + develop { + res.srcDirs = ["src/$platformName/res"] + } + stage { + res.srcDirs = ["src/$platformName/res"] + } + } + buildTypes { release { minifyEnabled true diff --git a/auth/src/main/java/org/openedx/auth/presentation/logistration/LogistrationFragment.kt b/auth/src/main/java/org/openedx/auth/presentation/logistration/LogistrationFragment.kt index 529058cc6..6379b246c 100644 --- a/auth/src/main/java/org/openedx/auth/presentation/logistration/LogistrationFragment.kt +++ b/auth/src/main/java/org/openedx/auth/presentation/logistration/LogistrationFragment.kt @@ -4,7 +4,6 @@ import android.content.res.Configuration import android.os.Bundle import android.view.LayoutInflater import android.view.ViewGroup -import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.fillMaxSize @@ -12,7 +11,6 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.layout.wrapContentWidth import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.MaterialTheme @@ -27,12 +25,10 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.LocalFocusManager import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.compose.ui.platform.testTag -import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource import androidx.compose.ui.semantics.semantics import androidx.compose.ui.semantics.testTagsAsResourceId @@ -52,7 +48,7 @@ import org.openedx.core.ui.noRippleClickable import org.openedx.core.ui.theme.OpenEdXTheme import org.openedx.core.ui.theme.appColors import org.openedx.core.ui.theme.appTypography -import org.openedx.core.R as coreR +import org.openedx.core.ui.theme.compose.LogistrationLogoView class LogistrationFragment : Fragment() { @@ -131,14 +127,7 @@ private fun LogistrationScreen( vertical = 32.dp, ) ) { - Image( - painter = painterResource(id = coreR.drawable.core_ic_logo), - contentDescription = null, - modifier = Modifier - .padding(top = 64.dp, bottom = 20.dp) - .wrapContentWidth(), - colorFilter = ColorFilter.tint(MaterialTheme.appColors.primary) - ) + LogistrationLogoView() Text( text = stringResource(id = R.string.pre_auth_title), color = MaterialTheme.appColors.textPrimary, diff --git a/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt b/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt index a0a1f3f82..49ebc20f5 100644 --- a/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt +++ b/auth/src/main/java/org/openedx/auth/presentation/signin/compose/SignInView.kt @@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.statusBarsPadding -import androidx.compose.foundation.layout.width import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.text.KeyboardActions @@ -72,6 +71,7 @@ import org.openedx.core.ui.theme.OpenEdXTheme import org.openedx.core.ui.theme.appColors import org.openedx.core.ui.theme.appShapes import org.openedx.core.ui.theme.appTypography +import org.openedx.core.ui.theme.compose.SignInLogoView import org.openedx.core.ui.windowSizeValue import org.openedx.core.R as coreR @@ -151,21 +151,7 @@ internal fun LoginScreen( Modifier.padding(it), horizontalAlignment = Alignment.CenterHorizontally ) { - Box( - modifier = Modifier - .fillMaxWidth() - .fillMaxHeight(0.2f), - contentAlignment = Alignment.Center - ) { - Image( - painter = painterResource(id = coreR.drawable.core_ic_logo), - contentDescription = null, - modifier = Modifier - .padding(top = 20.dp) - .width(170.dp) - .height(48.dp) - ) - } + SignInLogoView() Surface( color = MaterialTheme.appColors.background, shape = MaterialTheme.appShapes.screenBackgroundShape, diff --git a/core/build.gradle b/core/build.gradle index f49961374..93928bfc8 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -16,6 +16,8 @@ plugins { } def currentFlavour = getCurrentFlavor() +def config = configHelper.fetchConfig() +def platformName = config.getOrDefault("PLATFORM_NAME", "OpenEdx").toLowerCase() android { compileSdk 34 @@ -47,8 +49,17 @@ android { } sourceSets { + prod { + java.srcDirs = ["src/$platformName"] + res.srcDirs = ["src/$platformName/res"] + } develop { - res.srcDirs = ['src/openedx/res'] + java.srcDirs = ["src/$platformName"] + res.srcDirs = ["src/$platformName/res"] + } + stage { + java.srcDirs = ["src/$platformName"] + res.srcDirs = ["src/$platformName/res"] } main { assets { diff --git a/core/src/main/java/org/openedx/core/ui/theme/Shape.kt b/core/src/main/java/org/openedx/core/ui/theme/Shape.kt index 592a5a4fd..eed4d481d 100644 --- a/core/src/main/java/org/openedx/core/ui/theme/Shape.kt +++ b/core/src/main/java/org/openedx/core/ui/theme/Shape.kt @@ -1,14 +1,10 @@ package org.openedx.core.ui.theme import androidx.compose.foundation.shape.CornerBasedShape -import androidx.compose.foundation.shape.CornerSize -import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material.MaterialTheme import androidx.compose.material.Shapes import androidx.compose.runtime.Composable import androidx.compose.runtime.ReadOnlyComposable -import androidx.compose.runtime.staticCompositionLocalOf -import androidx.compose.ui.unit.dp data class AppShapes( val material: Shapes, @@ -22,24 +18,6 @@ data class AppShapes( val dialogShape: CornerBasedShape, ) -internal val LocalShapes = staticCompositionLocalOf { - AppShapes( - material = Shapes( - small = RoundedCornerShape(4.dp), - medium = RoundedCornerShape(8.dp), - large = RoundedCornerShape(0.dp) - ), - buttonShape = RoundedCornerShape(8.dp), - navigationButtonShape = RoundedCornerShape(8.dp), - textFieldShape = RoundedCornerShape(CornerSize(8.dp)), - screenBackgroundShape = RoundedCornerShape(topStart = 30.dp, topEnd = 30.dp), - cardShape = RoundedCornerShape(12.dp), - screenBackgroundShapeFull = RoundedCornerShape(24.dp), - courseImageShape = RoundedCornerShape(8.dp), - dialogShape = RoundedCornerShape(24.dp), - ) -} - val MaterialTheme.appShapes: AppShapes @Composable @ReadOnlyComposable diff --git a/core/src/main/java/org/openedx/core/ui/theme/Colors.kt b/core/src/openedx/org/openedx/core/ui/theme/Colors.kt similarity index 100% rename from core/src/main/java/org/openedx/core/ui/theme/Colors.kt rename to core/src/openedx/org/openedx/core/ui/theme/Colors.kt diff --git a/core/src/openedx/org/openedx/core/ui/theme/LocalShapes.kt b/core/src/openedx/org/openedx/core/ui/theme/LocalShapes.kt new file mode 100644 index 000000000..b5415bc5e --- /dev/null +++ b/core/src/openedx/org/openedx/core/ui/theme/LocalShapes.kt @@ -0,0 +1,25 @@ +package org.openedx.core.ui.theme + +import androidx.compose.foundation.shape.CornerSize +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material.Shapes +import androidx.compose.runtime.staticCompositionLocalOf +import androidx.compose.ui.unit.dp + +internal val LocalShapes = staticCompositionLocalOf { + AppShapes( + material = Shapes( + small = RoundedCornerShape(4.dp), + medium = RoundedCornerShape(8.dp), + large = RoundedCornerShape(0.dp) + ), + buttonShape = RoundedCornerShape(8.dp), + navigationButtonShape = RoundedCornerShape(8.dp), + textFieldShape = RoundedCornerShape(CornerSize(8.dp)), + screenBackgroundShape = RoundedCornerShape(topStart = 30.dp, topEnd = 30.dp), + cardShape = RoundedCornerShape(12.dp), + screenBackgroundShapeFull = RoundedCornerShape(24.dp), + courseImageShape = RoundedCornerShape(8.dp), + dialogShape = RoundedCornerShape(24.dp) + ) +} diff --git a/core/src/openedx/org/openedx/core/ui/theme/compose/LogistrationLogoView.kt b/core/src/openedx/org/openedx/core/ui/theme/compose/LogistrationLogoView.kt new file mode 100644 index 000000000..a0a5b339c --- /dev/null +++ b/core/src/openedx/org/openedx/core/ui/theme/compose/LogistrationLogoView.kt @@ -0,0 +1,35 @@ +package org.openedx.core.ui.theme.compose + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.wrapContentWidth +import androidx.compose.material.MaterialTheme +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.ColorFilter +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.openedx.core.R +import org.openedx.core.ui.theme.OpenEdXTheme +import org.openedx.core.ui.theme.appColors + +@Composable +fun LogistrationLogoView() { + Image( + modifier = Modifier + .padding(top = 64.dp, bottom = 20.dp) + .wrapContentWidth(), + painter = painterResource(id = R.drawable.core_ic_logo), + contentDescription = null, + colorFilter = ColorFilter.tint(MaterialTheme.appColors.primary) + ) +} + +@Preview(widthDp = 375) +@Composable +fun LogistrationLogoViewPreview() { + OpenEdXTheme { + LogistrationLogoView() + } +} diff --git a/core/src/openedx/org/openedx/core/ui/theme/compose/SignInLogoView.kt b/core/src/openedx/org/openedx/core/ui/theme/compose/SignInLogoView.kt new file mode 100644 index 000000000..f1f0a9d04 --- /dev/null +++ b/core/src/openedx/org/openedx/core/ui/theme/compose/SignInLogoView.kt @@ -0,0 +1,39 @@ +package org.openedx.core.ui.theme.compose + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxHeight +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.padding +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.res.painterResource +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.dp +import org.openedx.core.R +import org.openedx.core.ui.theme.OpenEdXTheme + +@Composable +fun SignInLogoView() { + Box( + modifier = Modifier + .fillMaxWidth() + .fillMaxHeight(0.2f), + contentAlignment = Alignment.Center + ) { + Image( + painter = painterResource(id = R.drawable.core_ic_logo), + contentDescription = null, + modifier = Modifier.padding(top = 20.dp) + ) + } +} + +@Preview(widthDp = 375, heightDp = 400) +@Composable +fun SignInLogoViewPreview() { + OpenEdXTheme { + SignInLogoView() + } +}