Skip to content

Commit

Permalink
[FEATURE] #104 : 바텀 네비게이션 바텀 바 위로 올리기
Browse files Browse the repository at this point in the history
  • Loading branch information
tgyuuAn committed Jan 17, 2024
1 parent 2e12230 commit e2ccc86
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 12 deletions.
21 changes: 14 additions & 7 deletions app/src/main/java/com/wap/wapp/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
package com.wap.wapp

import android.graphics.Color
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBars
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController
import androidx.navigation.NavGraph.Companion.findStartDestination
Expand Down Expand Up @@ -64,6 +67,11 @@ class MainActivity : ComponentActivity() {
},
)

val systemBars = WindowInsets.systemBars
val density = LocalDensity.current
val bottomPadding =
remember { with(density) { systemBars.getBottom(this).toDp() } }

WappBottomBar(
currentRoute = currentRoute,
bottomBarState = bottomBarState,
Expand All @@ -73,7 +81,9 @@ class MainActivity : ComponentActivity() {
destination,
)
},
modifier = Modifier.height(70.dp),
modifier = Modifier
.padding(bottom = bottomPadding)
.height(70.dp),
)
},
) { innerPadding ->
Expand All @@ -89,11 +99,8 @@ class MainActivity : ComponentActivity() {
}

private fun ComponentActivity.setSystemBarStyle() = enableEdgeToEdge(
statusBarStyle = SystemBarStyle.light(
getColor(R.color.yellow34),
getColor(R.color.yellow34),
),
navigationBarStyle = SystemBarStyle.auto(Color.TRANSPARENT, Color.TRANSPARENT),
statusBarStyle = SystemBarStyle.light(getColor(R.color.yellow34), getColor(R.color.yellow34)),
navigationBarStyle = SystemBarStyle.light(getColor(R.color.black25), getColor(R.color.black25)),
)

private fun handleBottomBarState(
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="yellow34">#FFFBCF34</color>
<color name="black25">#FF252424</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface SurveyRepository {

suspend fun getSurvey(surveyId: String): Result<Survey>

suspend fun deleteSurvey(surveyId: String): Result<Survey>
suspend fun deleteSurvey(surveyId: String): Result<Unit>

suspend fun postSurvey(
surveyFormId: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class SurveyRepositoryImpl @Inject constructor(
}.getOrThrow()
}

override suspend fun deleteSurvey(surveyId: String): Result<Survey> =
override suspend fun deleteSurvey(surveyId: String): Result<Unit> =
surveyDataSource.deleteSurvey(surveyId)

override suspend fun postSurvey(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
package com.wap.wapp.core.domain.usecase.event

import com.wap.wapp.core.data.repository.event.EventRepository
import com.wap.wapp.core.data.repository.survey.SurveyFormRepository
import javax.inject.Inject

class DeleteEventUseCase @Inject constructor(
private val eventRepository: EventRepository,
private val surveyFormRepository: SurveyFormRepository,
) {
suspend operator fun invoke(eventId: String): Result<Unit> =
suspend operator fun invoke(eventId: String): Result<Unit> = runCatching {
eventRepository.deleteEvent(eventId)
surveyFormRepository.getSurveyFormList(eventId).mapCatching { surveyFormList ->
surveyFormList.map { surveyForm ->
surveyFormRepository.deleteSurveyForm(surveyForm.surveyFormId)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.wap.wapp.core.domain.usecase.survey

import com.wap.wapp.core.data.repository.survey.SurveyRepository
import com.wap.wapp.core.model.survey.Survey
import javax.inject.Inject

class DeleteSurveyUseCase @Inject constructor(
private val surveyRepository: SurveyRepository,
) {
suspend operator fun invoke(surveyId: String): Result<Survey> =
suspend operator fun invoke(surveyId: String): Result<Unit> =
surveyRepository.deleteSurvey(surveyId)
}

0 comments on commit e2ccc86

Please sign in to comment.