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 app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ android {

dependencies {
implementation(projects.core.designsystem)
implementation(projects.feature.post)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.test.junit)
androidTestImplementation(libs.androidx.test.espresso)
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=".App"
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/java/com/conf/mad/todo/App.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.conf.mad.todo

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

@HiltAndroidApp
class App : Application()
32 changes: 3 additions & 29 deletions app/src/main/java/com/conf/mad/todo/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,17 @@ package com.conf.mad.todo
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
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.designsystem.TodoTheme
import dagger.hilt.android.AndroidEntryPoint

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

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

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
TodoTheme {
Greeting("Android")
}
}
23 changes: 23 additions & 0 deletions app/src/main/java/com/conf/mad/todo/TodoApp.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.conf.mad.todo

import androidx.compose.runtime.Composable
import androidx.navigation.NavHostController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.rememberNavController
import com.conf.mad.todo.designsystem.TodoTheme
import com.conf.mad.todo.post.POST_SCREEN_ROUTE
import com.conf.mad.todo.post.postScreen

@Composable
fun TodoApp(
navController: NavHostController = rememberNavController()
) {
TodoTheme {
NavHost(navController = navController, startDestination = POST_SCREEN_ROUTE) {
postScreen(
onCancel = navController::popBackStack,
onComplete = navController::popBackStack
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class AndroidComposePlugin : Plugin<Project> {
implementation(libs.library("androidx-core"))
implementationPlatform(libs.library("androidx-compose-bom"))
implementation(libs.library("androidx-compose-activity"))
implementation(libs.library("androidx-compose-hilt-navigation"))
implementation(libs.library("androidx-compose-navigation"))
implementation(libs.library("androidx-compose-ui"))
implementation(libs.library("androidx-compose-ui-foundation"))
implementation(libs.library("androidx-compose-material3"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fun TodoTypography(): TodoTypography {
),
medium1 = TextStyle(
fontFamily = PretendardMedium,
fontSize = 20.sp,
fontSize = 16.sp,
lineHeight = 24.sp,
fontWeight = FontWeight.Medium,
letterSpacing = (-0.5).sp,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.conf.mad.todo.designsystem.preview

import androidx.compose.ui.tooling.preview.Preview

@Preview(showBackground = true)
annotation class ComponentPreview
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.conf.mad.todo.designsystem.preview

import androidx.compose.ui.tooling.preview.Preview

@Preview(
name = "Galaxy S23 Ultra",
showBackground = true,
device = "spec:width=360dp,height=772dp,dpi=411"
)
@Preview(
name = "Galaxy S23",
showBackground = true,
device = "spec:width=360dp,height=800dp,dpi=500"
)
annotation class DevicePreview
9 changes: 9 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_add_task.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="158dp"
android:height="19dp"
android:viewportWidth="158"
android:viewportHeight="19">
<path
android:pathData="M18.38,1.39L27.3,17.98H21.66L20.1,14.95H8.13L6.57,17.98H0.95L9.86,1.39H18.38ZM10.07,11.21H18.18L15.02,5.11H13.22L10.07,11.21ZM70.02,0.89H75.13V17.78H70.05V15.91C69.93,16.08 69.73,16.27 69.49,16.49C69.23,16.68 68.87,16.92 68.39,17.16C67.91,17.42 67.29,17.64 66.52,17.81C66.21,17.88 65.87,17.95 65.53,17.98C65.05,18.05 36.57,18.07 36.01,18.07H35.73C33.13,18.07 31.19,17.5 29.92,16.32C28.62,15.14 28,13.63 28,11.78V11.35C28,9.58 28.6,8.11 29.82,6.96C31.02,5.83 32.92,5.26 35.51,5.26H35.87C36.37,5.26 64.81,5.28 65.27,5.33C67.24,5.52 68.82,6.14 70.02,7.2V0.89ZM70.02,11.69V11.59C70.02,10.75 69.59,10.03 68.75,9.41C67.91,8.78 66.78,8.47 65.37,8.47H65.25C64.72,8.47 36.28,8.5 35.85,8.59C35.1,8.71 34.53,8.98 34.12,9.36C33.49,9.94 33.18,10.7 33.18,11.59V11.69C33.18,12.55 33.52,13.27 34.21,13.92C34.65,14.3 35.2,14.57 35.87,14.71C36.3,14.81 64.77,14.86 65.29,14.86H65.41C66.83,14.86 67.96,14.54 68.77,13.92C69.59,13.27 70.02,12.55 70.02,11.69ZM95.31,17.88C93.13,17.88 92.05,16.75 92.05,14.45V9.12H89.48V5.78H92.05V2.26H97.45V5.78H100.04V9.12H97.45V13.51C97.45,13.87 97.52,14.14 97.67,14.3C97.81,14.47 98.1,14.57 98.55,14.57H100.04V17.88H95.31ZM118.91,14.76H119.58V18.14H115.38C114.23,18.14 113.58,17.57 113.39,16.44C113,16.9 112.36,17.35 111.42,17.76C110.49,18.17 109.21,18.36 107.61,18.36H107.32C105.35,18.36 103.89,17.98 102.93,17.21C101.96,16.44 101.51,15.48 101.51,14.3V14.14C101.51,13.01 101.89,12.14 102.71,11.54C103.53,10.97 104.87,10.58 106.74,10.42L112.48,9.89C112.98,9.82 113.25,9.6 113.25,9.24C113.25,9.02 113.2,8.88 113.1,8.74C113,8.62 112.69,8.5 112.19,8.4C111.68,8.28 110.94,8.21 110,8.21L101.51,8.23V5.35H110.53C111.93,5.35 113.13,5.42 114.11,5.59C115.12,5.76 115.86,5.98 116.39,6.22C116.92,6.48 117.32,6.79 117.61,7.18C117.93,7.58 118.09,7.92 118.17,8.23C118.21,8.54 118.26,8.93 118.26,9.36V14.14C118.26,14.54 118.48,14.76 118.91,14.76ZM113.25,12.6V12.22L108.3,12.98C107.61,13.08 107.13,13.22 106.84,13.39C106.57,13.56 106.43,13.8 106.43,14.14V14.16C106.43,14.54 106.6,14.88 106.96,15.17C107.32,15.43 107.89,15.58 108.71,15.58C110.03,15.58 111.13,15.26 111.97,14.66C112.84,14.06 113.25,13.39 113.25,12.6ZM128.72,18.29C123.06,18.29 120.25,16.87 120.25,13.99V13.85H125.89C125.89,14.95 127.02,15.5 129.27,15.5H129.32C130.26,15.5 131,15.43 131.53,15.31C132.06,15.19 132.39,15.07 132.54,14.93C132.66,14.76 132.73,14.59 132.73,14.35V14.3C132.73,13.97 132.54,13.7 132.18,13.54C131.79,13.37 131.03,13.27 129.83,13.25L127.47,13.2C126.11,13.18 124.93,13.06 123.95,12.82C122.99,12.6 122.24,12.29 121.74,11.93C121.26,11.54 120.9,11.16 120.68,10.75C120.47,10.34 120.37,9.91 120.37,9.43V9.29C120.37,8.88 120.42,8.5 120.51,8.16C120.63,7.85 120.85,7.49 121.21,7.15C121.57,6.82 122.03,6.53 122.63,6.29C123.2,6.07 124.02,5.88 125.05,5.74C126.08,5.59 127.31,5.52 128.7,5.52H129.68C135.2,5.52 137.96,6.77 137.96,9.31V9.48H132.37C132.35,9.31 132.3,9.19 132.23,9.07C132.18,8.98 132.03,8.83 131.84,8.69C131.65,8.54 131.31,8.45 130.86,8.35C130.38,8.28 129.8,8.23 129.13,8.23H129.11C127.86,8.23 127.02,8.3 126.59,8.45C126.18,8.57 125.96,8.81 125.96,9.14V9.17C125.96,9.48 126.15,9.72 126.54,9.86C126.95,10.03 127.67,10.13 128.72,10.15L131.07,10.2C133.07,10.22 134.6,10.39 135.68,10.7C136.79,11.02 137.53,11.42 137.89,11.93C138.25,12.43 138.44,13.13 138.44,13.99V14.14C138.44,14.74 138.32,15.29 138.08,15.74C137.84,16.2 137.43,16.63 136.83,17.04C136.23,17.45 135.35,17.76 134.15,17.98C132.95,18.19 131.48,18.29 129.73,18.29H128.72ZM139.85,17.95V1.2H145.3V10.68L150.65,5.83H156.72L150.48,11.3L157.46,17.95H151.06L145.3,12.38V17.95H139.85Z"
android:fillColor="#000000"/>
</vector>
21 changes: 21 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_clear.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,12m-12,0a12,12 0,1 1,24 0a12,12 0,1 1,-24 0"
android:fillColor="#999999"/>
<path
android:pathData="M16,8L8,16"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="square"/>
<path
android:pathData="M8,8L16,16"
android:strokeWidth="2"
android:fillColor="#00000000"
android:strokeColor="#ffffff"
android:strokeLineCap="square"/>
</vector>
9 changes: 9 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_star_default.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="22dp"
android:height="20dp"
android:viewportWidth="22"
android:viewportHeight="20">
<path
android:pathData="M21.247,7.484C21.17,7.238 21.02,7.021 20.818,6.861C20.617,6.701 20.371,6.604 20.114,6.584L14.54,6.102C14.506,6.099 14.474,6.087 14.447,6.067C14.42,6.047 14.398,6.019 14.385,5.988L12.208,0.798C12.107,0.561 11.938,0.359 11.724,0.218C11.509,0.076 11.257,0 11,0C10.743,0 10.491,0.076 10.276,0.218C10.062,0.359 9.893,0.561 9.793,0.798L7.615,5.988C7.602,6.019 7.58,6.047 7.553,6.067C7.526,6.087 7.494,6.099 7.46,6.102L1.886,6.584C1.629,6.604 1.383,6.701 1.182,6.861C0.98,7.021 0.831,7.238 0.753,7.484C0.671,7.731 0.664,7.996 0.733,8.246C0.801,8.496 0.942,8.721 1.138,8.891L5.368,12.58C5.393,12.603 5.413,12.632 5.423,12.665C5.434,12.698 5.435,12.733 5.428,12.767L4.156,18.253C4.097,18.505 4.114,18.77 4.205,19.012C4.296,19.255 4.457,19.466 4.667,19.618C4.874,19.77 5.123,19.858 5.38,19.868C5.638,19.878 5.892,19.811 6.111,19.676L10.903,16.769C10.931,16.752 10.963,16.743 10.996,16.743C11.029,16.743 11.062,16.752 11.09,16.769L15.882,19.676C16.103,19.811 16.359,19.878 16.618,19.868C16.877,19.858 17.128,19.771 17.337,19.619C17.547,19.466 17.708,19.256 17.798,19.012C17.888,18.769 17.904,18.505 17.844,18.253L16.576,12.765C16.569,12.731 16.57,12.696 16.581,12.663C16.591,12.63 16.61,12.601 16.636,12.578L20.865,8.889C21.06,8.718 21.201,8.494 21.269,8.244C21.337,7.994 21.329,7.73 21.247,7.484ZM20.122,8.039L15.893,11.728C15.713,11.885 15.579,12.088 15.505,12.316C15.432,12.543 15.422,12.786 15.477,13.018L16.744,18.506C16.753,18.542 16.751,18.581 16.738,18.617C16.725,18.653 16.701,18.684 16.67,18.705C16.642,18.728 16.607,18.741 16.571,18.742C16.535,18.744 16.499,18.734 16.469,18.714L11.678,15.807C11.474,15.683 11.239,15.618 11,15.618C10.761,15.618 10.526,15.683 10.322,15.807L5.531,18.714C5.501,18.734 5.465,18.744 5.429,18.742C5.393,18.741 5.358,18.728 5.33,18.705C5.299,18.684 5.275,18.653 5.262,18.617C5.249,18.581 5.247,18.542 5.256,18.506L6.523,13.018C6.578,12.786 6.568,12.543 6.495,12.316C6.421,12.088 6.287,11.885 6.107,11.728L1.878,8.039C1.849,8.015 1.828,7.982 1.819,7.945C1.809,7.909 1.81,7.87 1.823,7.834C1.832,7.798 1.853,7.767 1.881,7.743C1.91,7.72 1.945,7.707 1.982,7.705L7.558,7.223C7.796,7.202 8.025,7.117 8.218,6.976C8.412,6.835 8.564,6.644 8.656,6.423L10.834,1.233C10.849,1.201 10.873,1.174 10.903,1.155C10.933,1.135 10.968,1.125 11.004,1.125C11.039,1.125 11.074,1.135 11.104,1.155C11.134,1.174 11.158,1.201 11.174,1.233L13.344,6.423C13.436,6.643 13.587,6.834 13.78,6.975C13.973,7.116 14.201,7.202 14.439,7.223L20.014,7.705C20.051,7.707 20.086,7.72 20.115,7.743C20.143,7.767 20.164,7.798 20.174,7.834C20.187,7.869 20.189,7.908 20.179,7.945C20.17,7.981 20.15,8.014 20.122,8.039Z"
android:fillColor="#000000"/>
</vector>
9 changes: 9 additions & 0 deletions core/designsystem/src/main/res/drawable/ic_star_filled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="20dp"
android:height="20dp"
android:viewportWidth="20"
android:viewportHeight="20">
<path
android:pathData="M19.5,9.11L15.476,12.755L16.682,18.182C16.746,18.465 16.727,18.762 16.629,19.035C16.531,19.308 16.358,19.545 16.131,19.717C15.904,19.888 15.634,19.986 15.353,19.999C15.073,20.011 14.795,19.938 14.554,19.787L9.994,16.917L5.444,19.787C5.203,19.938 4.926,20.011 4.645,19.999C4.365,19.986 4.094,19.888 3.867,19.717C3.64,19.545 3.467,19.308 3.369,19.035C3.271,18.762 3.253,18.465 3.317,18.182L4.52,12.761L0.495,9.11C0.282,8.92 0.128,8.668 0.053,8.387C-0.023,8.106 -0.017,7.808 0.07,7.531C0.157,7.253 0.32,7.008 0.541,6.827C0.761,6.646 1.028,6.536 1.308,6.512L6.613,6.035L8.684,0.908C8.793,0.639 8.975,0.409 9.209,0.248C9.442,0.086 9.717,0 9.998,0C10.279,0 10.553,0.086 10.787,0.248C11.021,0.409 11.203,0.639 11.311,0.908L13.388,6.035L18.692,6.512C18.972,6.536 19.239,6.646 19.459,6.827C19.68,7.008 19.843,7.253 19.93,7.531C20.017,7.808 20.023,8.106 19.947,8.387C19.872,8.668 19.718,8.92 19.505,9.11H19.5Z"
android:fillColor="#FF3434"/>
</vector>
1 change: 1 addition & 0 deletions core/ui/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
12 changes: 12 additions & 0 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
id("conf.mad.convention.android.feature")
}

android {
namespace = "com.conf.mad.todo.ui"

defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}
}
Empty file added core/ui/consumer-rules.pro
Empty file.
2 changes: 2 additions & 0 deletions core/ui/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" />
20 changes: 20 additions & 0 deletions core/ui/src/main/java/com/conf/mad/todo/ui/Clickable.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.conf.mad.todo.ui

import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed

@Composable
inline fun Modifier.noRippleClickable(
crossinline onClick: () -> Unit
): Modifier = then(
clickable(
indication = null,
interactionSource = remember { MutableInteractionSource() }
) {
onClick()
}
)
1 change: 1 addition & 0 deletions feature/post/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
17 changes: 17 additions & 0 deletions feature/post/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
id("conf.mad.convention.android.feature")
}

android {
namespace = "com.conf.mad.todo.post"

defaultConfig {
consumerProguardFiles("consumer-rules.pro")
}
}

dependencies {
implementation(projects.core.designsystem)
implementation(projects.core.ui)
}
Empty file added feature/post/consumer-rules.pro
Empty file.
2 changes: 2 additions & 0 deletions feature/post/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" />
103 changes: 103 additions & 0 deletions feature/post/src/main/java/com/conf/mad/todo/post/PostScreen.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
package com.conf.mad.todo.post

import androidx.compose.foundation.background
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.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.navigation.NavGraphBuilder
import androidx.navigation.compose.composable
import com.conf.mad.todo.designsystem.TodoTheme
import com.conf.mad.todo.designsystem.preview.DevicePreview
import com.conf.mad.todo.post.component.AddTaskTopAppBar
import com.conf.mad.todo.post.component.TaskTextField

const val POST_SCREEN_ROUTE = "post"

fun NavGraphBuilder.postScreen(
onCancel: () -> Unit,
onComplete: () -> Unit
) {
composable(POST_SCREEN_ROUTE) {
PostScreen(onCancel = onCancel, onComplete = onComplete)
}
}

@Composable
fun PostScreen(
onCancel: () -> Unit = {},
onComplete: () -> Unit = {},
) {
var isFavorite by remember {
mutableStateOf(false)
}
var title by remember {
mutableStateOf("")
}
val isPostEnabled by remember(title) {
derivedStateOf {
title.isNotEmpty()
}
}
var content by remember {
mutableStateOf("")
}
Scaffold(
modifier = Modifier
.fillMaxSize()
.background(TodoTheme.colors.surface),
topBar = {
AddTaskTopAppBar(
isFavorite = isFavorite,
isPostEnabled = isPostEnabled,
onPressFavorite = { isFavorite = !isFavorite },
onCancel = { },
onComplete = { }
)
}
) { paddingValues ->
Column(
modifier = Modifier.padding(
bottom = paddingValues.calculateBottomPadding(),
top = paddingValues.calculateTopPadding(),
start = 16.dp,
end = 16.dp
)
) {
Spacer(modifier = Modifier.height(32.dp))
TaskTextField(
value = title,
onValueChange = { title = it },
placeHolder = "투두를 입력해주세요.",
singleLine = true,
useClearText = true,
onPressClearText = { title = "" },
)
Spacer(modifier = Modifier.height(16.dp))
TaskTextField(
value = content,
onValueChange = { content = it },
placeHolder = "원한다면 투두에 설명도 추가할 수 있어요.",
modifier = Modifier.height(336.dp)
)
}
}
}

@DevicePreview
@Composable
private fun PostScreenPreview() {
TodoTheme {
PostScreen()
}
}
Loading