Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ captures/
.cxx/
*.apk
output.json
report

# IntelliJ
*.iml
Expand Down
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ android {
}

dependencies {
implementation(projects.core.designsystem)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso)
Expand Down
9 changes: 4 additions & 5 deletions app/src/main/java/com/conf/mad/todo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.conf.mad.todo.ui.theme.TodoMadTheme
import com.conf.mad.todo.designsystem.TodoTheme

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
TodoMadTheme {
TodoTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
color = TodoTheme.colors.background
) {
Greeting("Android")
}
Expand All @@ -40,7 +39,7 @@ fun Greeting(name: String, modifier: Modifier = Modifier) {
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
TodoMadTheme {
TodoTheme {
Greeting("Android")
}
}
11 changes: 0 additions & 11 deletions app/src/main/java/com/conf/mad/todo/ui/theme/Color.kt

This file was deleted.

70 changes: 0 additions & 70 deletions app/src/main/java/com/conf/mad/todo/ui/theme/Theme.kt

This file was deleted.

34 changes: 0 additions & 34 deletions app/src/main/java/com/conf/mad/todo/ui/theme/Type.kt

This file was deleted.

1 change: 1 addition & 0 deletions core/designsystem/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
11 changes: 11 additions & 0 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
id("conf.mad.convention.android.feature")
}

android {
namespace = "com.conf.mad.todo.designsystem"
defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}
}
Empty file.
2 changes: 2 additions & 0 deletions core/designsystem/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.conf.mad.todo.designsystem

import androidx.compose.ui.graphics.Color

// Red Scale
val Red = Color(0xFFFF3434)
val Pink = Color(0xFFFFD2D2)

// Blue Scale
val Blue = Color(0xFF5182FF)
val SkyBlue = Color(0xFFE2EFFF)
val LightBlue = Color(0xFFF8FBFF)

// Gray Scale
val Black = Color(0xFF000000)
val Snow = Color(0xFFFFFFFF)
val GrayGugu = Color(0xFF999999)
val GrayAbby = Color(0xFFABABAB)
val GrayCeci = Color(0xFFCCCCCC)
val GrayEunbi = Color(0xFFEBEBEB)
val GrayFry = Color(0xFFF6F6F6)
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
package com.conf.mad.todo.designsystem

import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.Stable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.graphics.Color

@Stable
class TodoColors(
primary: Color,
onPrimary: Color,
secondary: Color,
background: Color,
onBackground: Color,
surface: Color,
onSurface60: Color,
onSurface50: Color,
onSurface40: Color,
onSurface30: Color,
onSurface20: Color,
onSurface10: Color,
surfaceContainer: Color,
onSurfaceContainer: Color,
isLight: Boolean
) {
var primary by mutableStateOf(primary)
private set
var onPrimary by mutableStateOf(onPrimary)
private set
var secondary by mutableStateOf(secondary)
private set
var background by mutableStateOf(background)
private set
var onBackground by mutableStateOf(onBackground)
private set
var surface by mutableStateOf(surface)
private set
var onSurface60 by mutableStateOf(onSurface60)
private set
var onSurface50 by mutableStateOf(onSurface50)
private set
var onSurface40 by mutableStateOf(onSurface40)
private set
var onSurface30 by mutableStateOf(onSurface30)
private set
var onSurface20 by mutableStateOf(onSurface20)
private set
var onSurface10 by mutableStateOf(onSurface10)
private set
var surfaceContainer by mutableStateOf(surfaceContainer)
private set
var onSurfaceContainer by mutableStateOf(onSurfaceContainer)
private set

var isLight by mutableStateOf(isLight)

fun copy(): TodoColors = TodoColors(
primary,
onPrimary,
secondary,
background,
onBackground,
surface,
onSurface60,
onSurface50,
onSurface40,
onSurface30,
onSurface20,
onSurface10,
surfaceContainer,
onSurfaceContainer,
isLight
)

fun update(other: TodoColors) {
primary = other.primary
onPrimary = other.onPrimary
secondary = other.secondary
background = other.background
onBackground = other.onBackground
surface = other.surface
onSurface60 = other.onSurface60
onSurface50 = other.onSurface50
onSurface40 = other.onSurface40
onSurface30 = other.onSurface30
onSurface20 = other.onSurface20
onSurface10 = other.onSurface10
surfaceContainer = other.surfaceContainer
onSurfaceContainer = other.onSurfaceContainer
isLight = other.isLight
}
}

fun todoColors(
primary: Color = Red,
onPrimary: Color = Pink,
secondary: Color = Blue,
background: Color = LightBlue,
onBackground: Color = Black,
surface: Color = Snow,
onSurface60: Color = Black,
onSurface50: Color = GrayGugu,
onSurface40: Color = GrayAbby,
onSurface30: Color = GrayCeci,
onSurface20: Color = GrayEunbi,
onSurface10: Color = GrayFry,
surfaceContainer: Color = GrayFry,
onSurfaceContainer: Color = Black,
isLight: Boolean = true
): TodoColors {
return TodoColors(
primary,
onPrimary,
secondary,
background,
onBackground,
surface,
onSurface60,
onSurface50,
onSurface40,
onSurface30,
onSurface20,
onSurface10,
surfaceContainer,
onSurfaceContainer,
isLight
)
}

private val LocalTodoColors = staticCompositionLocalOf<TodoColors> {
error("No TodoColors provided")
}
private val LocalTodoTypography = staticCompositionLocalOf<TodoTypography> {
error("No TodoTypography provided")
}

object TodoTheme {
val colors: TodoColors @Composable get() = LocalTodoColors.current
val typography: TodoTypography @Composable get() = LocalTodoTypography.current
}

@Composable
fun ProvideTodoColorAndTypography(
colors: TodoColors,
typography: TodoTypography,
content: @Composable () -> Unit
) {
val provideColors = remember { colors.copy() }
provideColors.update(colors)
val provideTypography = remember { typography.copy() }
provideTypography.update(typography)
CompositionLocalProvider(
LocalTodoColors provides provideColors,
LocalTodoTypography provides provideTypography,
content = content
)
}

@Composable
fun TodoTheme(
darkTheme: Boolean = false,
content: @Composable () -> Unit
) {
val colors = todoColors()
val typography = TodoTypography()
ProvideTodoColorAndTypography(colors, typography) {
MaterialTheme(content = content)
}
}
Loading