Skip to content

Commit

Permalink
Merge pull request #593 from Team-WSS/bugfix/592
Browse files Browse the repository at this point in the history
bugfix: 컴포즈 뷰 다크모드 상단바 디자인 수정
  • Loading branch information
junseo511 authored Feb 21, 2025
2 parents c568ab5 + a3f3500 commit 19ed06d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.into.websoso.core.common.util

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.content.res.Resources
Expand All @@ -14,6 +15,8 @@ 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.graphics.toArgb
import androidx.core.view.WindowCompat
import androidx.datastore.core.DataStore
import androidx.datastore.core.handlers.ReplaceFileCorruptionHandler
import androidx.datastore.preferences.SharedPreferencesMigration
Expand All @@ -28,6 +31,7 @@ import androidx.lifecycle.repeatOnLifecycle
import com.into.websoso.BuildConfig
import com.into.websoso.core.common.ui.custom.WebsosoCustomSnackBar
import com.into.websoso.core.common.ui.custom.WebsosoCustomToast
import com.into.websoso.core.designsystem.theme.White
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
import java.io.Serializable
Expand Down Expand Up @@ -158,3 +162,11 @@ fun <T> Flow<T>.collectWithLifecycle(
}
}
}

fun Activity.setupWhiteStatusBar() {
this.window.statusBarColor = White.toArgb()

WindowCompat.getInsetsController(this.window, this.window.decorView).apply {
isAppearanceLightStatusBars = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,13 @@ import androidx.compose.ui.platform.LocalContext
private val DarkColorScheme = darkColorScheme(
primary = Primary100,
onPrimary = White,
primaryContainer = Primary200,
onPrimaryContainer = Gray20,
secondary = Secondary100,
onSecondary = White,
onSecondaryContainer = Gray50,
tertiary = Gray300,
onTertiary = White,
background = Black,
onBackground = Gray20,
onSurface = Gray200,
onError = White,
)

private val LightColorScheme = lightColorScheme(
primary = Primary100,
onPrimary = White,
primaryContainer = Primary50,
onPrimaryContainer = Gray20,
secondary = Secondary100,
onSecondary = White,
onSecondaryContainer = Gray50,
tertiary = Gray300,
onTertiary = Black,
background = White,
onBackground = Gray300,
surface = Gray20,
onSurface = Gray70,
onError = White,
)

private val LocalWebsosoTypography = staticCompositionLocalOf<WebsosoTypography> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import com.into.websoso.core.common.ui.model.ResultFrom
import com.into.websoso.core.common.util.setupWhiteStatusBar
import com.into.websoso.core.designsystem.theme.WebsosoTheme
import com.into.websoso.ui.feedDetail.FeedDetailActivity
import com.into.websoso.ui.notification.model.NotificationModel
Expand All @@ -19,6 +20,7 @@ class NotificationActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.setupWhiteStatusBar()

setContent {
WebsosoTheme {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.into.websoso.ui.notification

import androidx.activity.compose.BackHandler
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.into.websoso.core.designsystem.theme.White
import com.into.websoso.ui.notification.component.NotificationAppBar
import com.into.websoso.ui.notification.component.NotificationsContainer
import com.into.websoso.ui.notification.model.NotificationModel
Expand All @@ -24,7 +26,11 @@ fun NotificationScreen(
onBackButtonClick()
}

Column(modifier = Modifier.fillMaxSize()) {
Column(
modifier = Modifier
.fillMaxSize()
.background(White),
) {
NotificationAppBar(onBackButtonClick)
NotificationsContainer(
notifications = uiState.notifications,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.into.websoso.ui.notification.component

import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
Expand All @@ -20,6 +21,7 @@ import com.into.websoso.R
import com.into.websoso.core.common.util.clickableWithoutRipple
import com.into.websoso.core.designsystem.theme.Black
import com.into.websoso.core.designsystem.theme.WebsosoTheme
import com.into.websoso.core.designsystem.theme.White

@Composable
fun NotificationAppBar(
Expand All @@ -28,6 +30,7 @@ fun NotificationAppBar(
) {
Row(
modifier = modifier
.background(White)
.fillMaxWidth()
.padding(horizontal = 6.dp)
.height(44.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import androidx.activity.ComponentActivity
import androidx.activity.addCallback
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import com.into.websoso.core.common.util.setupWhiteStatusBar
import com.into.websoso.core.designsystem.theme.WebsosoTheme
import dagger.hilt.android.AndroidEntryPoint

Expand All @@ -16,6 +17,8 @@ class NotificationDetailActivity : ComponentActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.setupWhiteStatusBar()

handleBackPressed()

setContent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.into.websoso.ui.notificationDetail

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
Expand All @@ -8,6 +9,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.into.websoso.core.designsystem.theme.WebsosoTheme
import com.into.websoso.core.designsystem.theme.White
import com.into.websoso.data.model.NotificationDetailEntity
import com.into.websoso.ui.notification.component.NotificationAppBar
import com.into.websoso.ui.notificationDetail.component.NotificationDetailContent
Expand All @@ -21,7 +23,11 @@ fun NotificationDetailScreen(
) {
val uiState by viewModel.notificationDetailUiState.collectAsStateWithLifecycle()

Column(modifier = modifier.fillMaxSize()) {
Column(
modifier = modifier
.fillMaxSize()
.background(White),
) {
NotificationAppBar(onBackButtonClick)
NotificationDetailContent(
uiState = uiState,
Expand Down

0 comments on commit 19ed06d

Please sign in to comment.