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

지도 > 바텀시트, 지도 화면, 위치 권한 구현 #45

Merged
merged 13 commits into from
Jan 24, 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
1 change: 0 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ android {
versionName "1.0"

buildConfigField("String", "KAKAO_APP_KEY", properties.getProperty("KAKAO_APP_KEY"))

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:name=".BuddyConApplication"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.yapp.buddycon.designsystem.component.button

import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
Expand All @@ -22,7 +23,8 @@ private val CategoryButtonRadius = 20.dp
@Composable
fun CategoryButton(
gifticonCategory: GifticonCategory,
isSelected: Boolean = false
isSelected: Boolean = false,
onClick: () -> Unit = {}
) {
Box(
modifier = Modifier
Expand All @@ -33,7 +35,7 @@ fun CategoryButton(
.padding(
horizontal = CategoryButtonHorizontalPadding,
vertical = CategoryButtonVerticalPadding
),
).clickable { onClick() },
contentAlignment = Alignment.Center
) {
Text(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
package com.yapp.buddycon.designsystem.component.modal

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.GridItemSpan
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand All @@ -38,6 +35,7 @@ import coil.compose.AsyncImage
import com.yapp.buddycon.designsystem.R
import com.yapp.buddycon.designsystem.component.tag.DDayTag
import com.yapp.buddycon.designsystem.theme.BuddyConTheme
import com.yapp.buddycon.designsystem.theme.Grey40
import com.yapp.buddycon.designsystem.theme.Grey60
import com.yapp.buddycon.designsystem.theme.Paddings
import com.yapp.buddycon.designsystem.theme.Pink100
Expand All @@ -53,59 +51,53 @@ private val GifticonInfoListModalSheetItemRadius = 8.dp
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GifticonInfoListModalSheet(
sheetState: SheetState = rememberModalBottomSheetState(),
modifier: Modifier = Modifier,
countOfUsableGifticon: Int,
countOfImminetGifticon: Int,
gifticonInfos: List<GifticonModel> = listOf(),
onDismiss: () -> Unit
gifticonInfos: List<GifticonModel> = listOf()
) {
ModalBottomSheet(
onDismissRequest = onDismiss,
modifier = Modifier
Column(
modifier = modifier
.fillMaxWidth()
.height(GifticonInfoListModalSheetHeight),
sheetState = sheetState,
shape = RoundedCornerShape(
topStart = GifticonInfoListModalSheetRadius,
topEnd = GifticonInfoListModalSheetRadius
),
containerColor = BuddyConTheme.colors.modalColor
.padding(horizontal = Paddings.xlarge)
) {
Spacer(
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(vertical = Paddings.xlarge)
.size(32.dp, 4.dp)
.background(Grey40, RoundedCornerShape(100.dp))
)
Text(
text = stringResource(R.string.modal_sheet_gifticon),
style = BuddyConTheme.typography.subTitle
)
Row(verticalAlignment = Alignment.Bottom) {
Text(
text = "${countOfUsableGifticon}개",
style = BuddyConTheme.typography.title01
)
Text(
text = String.format(
stringResource(R.string.modal_sheet_imminet_gifticon),
countOfImminetGifticon
),
modifier = Modifier.padding(start = Paddings.medium, bottom = Paddings.small),
style = BuddyConTheme.typography.body04.copy(color = Pink100)
)
}
LazyVerticalGrid(
columns = GridCells.Fixed(2),
modifier = Modifier.fillMaxSize(),
contentPadding = PaddingValues(
start = Paddings.xlarge,
end = Paddings.xlarge,
bottom = Paddings.xlarge
),
modifier = Modifier
.padding(top = Paddings.xlarge)
.fillMaxWidth(),
verticalArrangement = Arrangement.spacedBy(Paddings.xlarge),
horizontalArrangement = Arrangement.spacedBy(Paddings.medium)
) {
item(span = { GridItemSpan(2) }) {
Column {
Text(
text = stringResource(R.string.modal_sheet_gifticon),
style = BuddyConTheme.typography.subTitle
)
Row(verticalAlignment = Alignment.Bottom) {
Text(
text = "${countOfUsableGifticon}개",
style = BuddyConTheme.typography.title01
)
Text(
text = String.format(
stringResource(R.string.modal_sheet_imminet_gifticon),
countOfImminetGifticon
),
modifier = Modifier.padding(start = Paddings.medium, bottom = Paddings.small),
style = BuddyConTheme.typography.body04.copy(color = Pink100)
)
}
}
}
items(gifticonInfos) {
Column {
itemsIndexed(gifticonInfos) { index, item ->
Column(
modifier = Modifier.padding(bottom = if (index == gifticonInfos.lastIndex) Paddings.xlarge else 0.dp)
) {
Box(
modifier = Modifier
.fillMaxWidth()
Expand All @@ -116,8 +108,8 @@ fun GifticonInfoListModalSheet(
shape = RoundedCornerShape(GifticonInfoListModalSheetItemRadius)
) {
AsyncImage(
model = it.imageUrl,
contentDescription = it.name,
model = item.imageUrl,
contentDescription = item.name,
modifier = Modifier.fillMaxSize(),
contentScale = ContentScale.FillBounds
)
Expand All @@ -128,24 +120,24 @@ fun GifticonInfoListModalSheet(
top = Paddings.medium,
start = Paddings.medium
),
dateMillis = it.expirationTime
dateMillis = item.expirationTime
)
}
Text(
text = it.category.value,
text = item.category.value,
modifier = Modifier.padding(top = Paddings.large),
style = BuddyConTheme.typography.body03.copy(color = Pink100),
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
Text(
text = it.name,
text = item.name,
style = BuddyConTheme.typography.body04,
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
Text(
text = "~${it.toExpirationDate()}",
text = "~${item.toExpirationDate()}",
modifier = Modifier.padding(top = Paddings.medium),
style = BuddyConTheme.typography.body03.copy(color = Grey60)
)
Expand All @@ -156,7 +148,7 @@ fun GifticonInfoListModalSheet(
}

@OptIn(ExperimentalMaterial3Api::class)
@Preview
@Preview(showBackground = true, backgroundColor = 255)
@Composable
private fun GifticonInfoListModalSheetPreview() {
var isShowModal by remember { mutableStateOf(true) }
Expand All @@ -168,20 +160,17 @@ private fun GifticonInfoListModalSheetPreview() {
}.time.time

BuddyConTheme {
if (isShowModal) {
GifticonInfoListModalSheet(
countOfUsableGifticon = 4,
countOfImminetGifticon = 1,
gifticonInfos = List(10) {
GifticonModel(
imageUrl = "https://github.com/Team-BuddyCon/ANDROID_V2/assets/34837583/5ab80674-4ffb-4c91-ab10-3743d8c87e58",
category = GifticonCategory.STARBUCKS,
name = "빙그레)바나나맛우유240",
expirationTime = (today + 1000 * 60 * 60 * 24L * (-1..366).random())
)
},
onDismiss = { isShowModal = false }
)
}
GifticonInfoListModalSheet(
countOfUsableGifticon = 4,
countOfImminetGifticon = 1,
gifticonInfos = List(10) {
GifticonModel(
imageUrl = "https://github.com/Team-BuddyCon/ANDROID_V2/assets/34837583/5ab80674-4ffb-4c91-ab10-3743d8c87e58",
category = GifticonCategory.STARBUCKS,
name = "빙그레)바나나맛우유240",
expirationTime = (today + 1000 * 60 * 60 * 24L * (-1..366).random())
)
}
)
}
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
package com.yapp.buddycon.designsystem.component.modal

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.SheetState
import androidx.compose.material3.Text
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
Expand All @@ -28,40 +21,38 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.yapp.buddycon.designsystem.R
import com.yapp.buddycon.designsystem.theme.BuddyConTheme
import com.yapp.buddycon.designsystem.theme.Grey40
import com.yapp.buddycon.designsystem.theme.Paddings
import com.yapp.buddycon.designsystem.theme.Pink100

private val GifticonInfoModalSheetHeight = 167.dp
private val GifticonInfoModalSheetRadius = 24.dp
private val GifticonInfoModalHorizontalPadding = 15.dp
private val GifticonInfoModalItemIconSize = 64.dp
private val GifticonInfoModalDescription = "GifticonInfoModal"
private const val GifticonInfoModalDescription = "GifticonInfoModal"

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GifticonInfoModalSheet(
sheetState: SheetState = rememberModalBottomSheetState(),
fun GifticonInfoModalSheetContent(
modifier: Modifier = Modifier,
countOfUsableGifticon: Int,
countOfImminetGifticon: Int,
onDismiss: () -> Unit
countOfImminetGifticon: Int
) {
ModalBottomSheet(
onDismissRequest = onDismiss,
modifier = Modifier
Column(
modifier = modifier
.background(BuddyConTheme.colors.background)
.fillMaxWidth()
.height(GifticonInfoModalSheetHeight),
sheetState = sheetState,
shape = RoundedCornerShape(
topStart = GifticonInfoModalSheetRadius,
topEnd = GifticonInfoModalSheetRadius
),
containerColor = BuddyConTheme.colors.modalColor
.padding(horizontal = GifticonInfoModalHorizontalPadding),
horizontalAlignment = Alignment.CenterHorizontally
) {
Row(
Spacer(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = GifticonInfoModalHorizontalPadding)
.wrapContentHeight(),
.padding(vertical = Paddings.xlarge)
.size(32.dp, 4.dp)
.background(Grey40, RoundedCornerShape(100.dp))
)
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Column(
Expand Down Expand Up @@ -100,14 +91,10 @@ fun GifticonInfoModalSheet(
@Preview
@Composable
private fun GifticonInfoModalSheetPreview() {
var isShowModal by remember { mutableStateOf(true) }
BuddyConTheme {
if (isShowModal) {
GifticonInfoModalSheet(
countOfUsableGifticon = 12,
countOfImminetGifticon = 1,
onDismiss = { isShowModal = false }
)
}
GifticonInfoModalSheetContent(
countOfUsableGifticon = 12,
countOfImminetGifticon = 1
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ private val SNACKBAR_DISMISS_ICON_DESCRIPTION = "SNACKBAR_DISMISS"

@Composable
fun BuddyConSnackbar(
snackbarHostState: SnackbarHostState = remember { SnackbarHostState() }
modifier: Modifier = Modifier,
snackbarHostState: SnackbarHostState = remember { SnackbarHostState() },
contentAlignment: Alignment = Alignment.BottomCenter
) {
SnackbarHost(
hostState = snackbarHostState
) { snackbarData ->
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.BottomCenter
modifier = modifier.fillMaxSize(),
contentAlignment = contentAlignment
) {
Row(
modifier = Modifier
Expand Down Expand Up @@ -88,7 +90,7 @@ fun showBuddyConSnackBar(
scope.launch {
snackbarHostState.showSnackbar(
message = message,
duration = SnackbarDuration.Long
duration = SnackbarDuration.Short
)
}
}
Expand Down
Loading
Loading