Skip to content
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

πŸ”€ :: (#5) - add design system #6

Merged
merged 17 commits into from
Aug 28, 2024
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
3 changes: 3 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ android {
}

dependencies {
implementation(project(":core:design-system"))
implementation(project(":core:model"))
diejdkll marked this conversation as resolved.
Show resolved Hide resolved

implementation(libs.junit)
androidTestImplementation(libs.androidx.test.ext)
implementation(libs.androidx.core.splashscreen)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools">

<application
android:name=".OndoseeApplication"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
35 changes: 2 additions & 33 deletions app/src/main/java/com/ohnalmwo/ondosee/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,13 @@ package com.ohnalmwo.ondosee
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.ohnalmwo.ondosee.ui.theme.OndoseeTheme
import com.ohnalmwo.ondosee.ui.OndoseeApp

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
OndoseeTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
Greeting("Android")
}
}
OndoseeApp()
}
}
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
OndoseeTheme {
Greeting("Android")
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/ohnalmwo/ondosee/OndoseeApplication.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ohnalmwo.ondosee

import android.app.Application
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class OndoseeApplication : Application()
30 changes: 30 additions & 0 deletions app/src/main/java/com/ohnalmwo/ondosee/ui/OndoseeApp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.ohnalmwo.ondosee.ui

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.Button
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Brush
import com.ohnalmwo.design_system.theme.OndoseeTheme
import com.ohnalmwo.design_system.theme.OndoseeTheme.colors
import com.ohnalmwo.model.enum.ThemeType

@Composable
fun OndoseeApp() {
OndoseeTheme(themeMode = ThemeType.SYSTEM) {
CompositionLocalProvider {
Box(
modifier = Modifier
.background(
brush = Brush.linearGradient(
colors = colors.BACKGROUND_RAIN
)
)
.fillMaxSize()
)
}
}
}
11 changes: 0 additions & 11 deletions app/src/main/java/com/ohnalmwo/ondosee/ui/theme/Color.kt

This file was deleted.

70 changes: 0 additions & 70 deletions app/src/main/java/com/ohnalmwo/ondosee/ui/theme/Theme.kt

This file was deleted.

34 changes: 0 additions & 34 deletions app/src/main/java/com/ohnalmwo/ondosee/ui/theme/Type.kt

This file was deleted.

1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@file:Suppress("DSL_SCOPE_VIOLATION")

import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinCommonCompilation
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

buildscript {
Expand Down
2 changes: 2 additions & 0 deletions core/design-system/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ android {
}

dependencies {
implementation(project(":core:model"))

implementation(libs.coil.kt.compose)
implementation(libs.kotlinx.datetime)
implementation(libs.kotlinx.immutable)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.goms.design_system.theme

import androidx.compose.ui.graphics.Color

abstract class ColorTheme {
//System Colors
abstract val PRIMARY: Color
abstract val WARNING: Color
abstract val ABLE: Color
abstract val DISABLE: Color
abstract val SECONDARY: Color
abstract val TERTIARY: Color

//Background Colors
abstract val BACKGROUND_RAIN: List<Color>
abstract val BACKGROUND_SNOW: List<Color>
abstract val BACKGROUND_THUNDER: List<Color>
abstract val BACKGROUND_WORST: List<Color>
abstract val BACKGROUND_MISE_TOO_BAD: List<Color>
abstract val BACKGROUND_MISE_SO_BAD: List<Color>
abstract val BACKGROUND_MISE_BAD: List<Color>
abstract val BACKGROUND_HEAT_WAVE: List<Color>
abstract val BACKGROUND_HEAVE_SNOW: List<Color>

//Component Colors
abstract val RAIN: Color
abstract val SNOW: Color
abstract val VERY_GOOD: Color
abstract val SO_GOOD: Color
abstract val GOOD: Color
abstract val SOSO: Color
abstract val BAD: Color
abstract val SO_BAD: Color
abstract val TOO_BAD: Color
abstract val WORST: Color

abstract val BLACK: Color
abstract val WHITE: Color

abstract val BACKGROUND: Color
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.ohnalmwo.design_system.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import com.goms.design_system.theme.ColorTheme
import com.ohnalmwo.design_system.theme.color.DarkColor
import com.ohnalmwo.design_system.theme.color.LightColor
import com.ohnalmwo.model.enum.ThemeType

internal val LocalColorTheme = compositionLocalOf<ColorTheme> { error("No ColorTheme provided") }
internal val LocalTypography = compositionLocalOf<OndoseeTypography> { error("No OndoseeTypography provided") }

@Composable
fun OndoseeTheme(
themeMode: ThemeType = ThemeType.SYSTEM,
content: @Composable () -> Unit
) {
val theme = when (themeMode) {
ThemeType.SYSTEM -> isSystemInDarkTheme()
ThemeType.DARK -> true
ThemeType.LIGHT -> false
}

val colors = if (theme) DarkColor else LightColor
val typography = OndoseeTypography

CompositionLocalProvider(
LocalColorTheme provides colors,
LocalTypography provides typography
) {
content()
}
}

object OndoseeTheme {
val colors: ColorTheme
@Composable
get() = LocalColorTheme.current
val typography: OndoseeTypography
@Composable
get() = LocalTypography.current
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package com.ohnalmwo.design_system.theme

import androidx.compose.runtime.Stable
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.sp
import com.ohnalmwo.design_system.theme.font.FontFamily.freesentation


object OndoseeTypography {
@Stable
val titleLarge = TextStyle(
fontFamily = freesentation,
fontSize = 30.sp,
lineHeight = 36.sp
)

@Stable
val titleMedium = TextStyle(
fontFamily = freesentation,
fontSize = 25.sp,
lineHeight = 30.sp
)

@Stable
val titleSmall = TextStyle(
fontFamily = freesentation,
fontSize = 20.sp,
lineHeight = 24.sp
)

@Stable
val textLarge = TextStyle(
fontFamily = freesentation,
fontSize = 17.sp,
lineHeight = 20.sp
)

@Stable
val textMedium = TextStyle(
fontFamily = freesentation,
fontSize = 15.sp,
lineHeight = 18.sp
)

@Stable
val textSmall = TextStyle(
fontFamily = freesentation,
fontSize = 13.sp,
lineHeight = 16.sp
)

@Stable
val caption = TextStyle(
fontFamily = freesentation,
fontSize = 10.sp,
lineHeight = 12.sp
)
}
Loading
Loading