Skip to content
Open
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
5 changes: 1 addition & 4 deletions app/src/main/java/com/haman/daangnphoto/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import com.haman.core.designsystem.theme.DaangnPhotoTheme
import com.haman.daangnphoto.ui.DaangnPhotoApp
import dagger.hilt.android.AndroidEntryPoint

Expand All @@ -15,9 +14,7 @@ class MainActivity : ComponentActivity() {
super.onCreate(savedInstanceState)

setContent {
DaangnPhotoTheme {
DaangnPhotoApp(splashScreen)
}
DaangnPhotoApp(splashScreen)
}
}
}
17 changes: 10 additions & 7 deletions app/src/main/java/com/haman/daangnphoto/ui/DaangnPhotoApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.haman.core.common.state.UiEvent
import com.haman.core.designsystem.component.Toast
import com.haman.core.designsystem.theme.DaangnPhotoTheme
import com.haman.daangnphoto.MainViewModel
import com.haman.daangnphoto.navigation.DaangnNavHost
import kotlinx.coroutines.delay
Expand Down Expand Up @@ -39,13 +40,15 @@ fun DaangnPhotoApp(
else timeOutSplashScreen.value.not()
}

Scaffold {
Box(modifier = Modifier.fillMaxSize()) {
DaangnNavHost(
navController = navController,
mainViewModel = viewModel
)
Event(event = uiEvent.value)
DaangnPhotoTheme {
Scaffold {
Box(modifier = Modifier.fillMaxSize()) {
DaangnNavHost(
navController = navController,
mainViewModel = viewModel
)
Event(event = uiEvent.value)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.haman.core.designsystem.theme

import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material.MaterialTheme
import androidx.compose.material.darkColors
import androidx.compose.runtime.Composable

private val ColorPalette = darkColors(
private val DarkColorPalette = darkColors(
primary = Orange800,
onPrimary = White,
background = Gray900,
Expand All @@ -15,9 +14,11 @@ private val ColorPalette = darkColors(
)

@Composable
fun DaangnBlackTheme(content: @Composable () -> Unit) {
fun DaangnBlackTheme(
content: @Composable () -> Unit
) {
MaterialTheme(
colors = ColorPalette,
colors = DarkColorPalette,
typography = Typography,
shapes = Shapes,
content = content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.haman.feature.detail
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.material.Icon
import androidx.compose.material.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -40,35 +41,39 @@ fun DetailScreen(
}
}

Box(
modifier = Modifier.fillMaxSize()
) {
Icon(
Surface {
Box(
modifier = Modifier
.align(Alignment.TopEnd)
.size(24.dp)
.clickable { onBackPressed() },
painter = painterResource(id = DaangnIcons.close),
contentDescription = "close button"
)
Column(
modifier = Modifier
.align(Alignment.Center)
.padding(vertical = 24.dp),
verticalArrangement = Arrangement.Center
.fillMaxSize()
) {
if (imageState.value?.author != null) {
SubTitle(
modifier = Modifier.padding(8.dp),
text = "by ${imageState.value?.author}"
)
}
imageState.value?.let {
AsyncImage(
image = it,
loadImage = viewModel::getImageByUrl,
scaleType = ContentScale.FillWidth
)
Icon(
modifier = Modifier
.align(Alignment.TopEnd)
.padding(12.dp)
.size(24.dp)
.clickable { onBackPressed() },
painter = painterResource(id = DaangnIcons.close),
contentDescription = "close button"
)
Column(
modifier = Modifier
.align(Alignment.Center)
.padding(vertical = 24.dp),
verticalArrangement = Arrangement.Center
) {
if (imageState.value?.author != null) {
SubTitle(
modifier = Modifier.padding(8.dp),
text = "by ${imageState.value?.author}"
)
}
imageState.value?.let {
AsyncImage(
image = it,
loadImage = viewModel::getImageByUrl,
scaleType = ContentScale.FillWidth
)
}
}
}
}
Expand Down