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

[Feat/fix album crash] 커스텀 그리드 앨범 관련 버그 수정 #96

Merged
merged 4 commits into from
Jan 2, 2025
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
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ android {
minSdk = 26
targetSdk = 33
versionCode = 1
versionName = "1.0.17"
versionName = "1.0.18"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.compose.foundation.layout.PaddingValues
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.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
Expand Down Expand Up @@ -54,7 +55,7 @@ fun GalleryGrid(
onPermissionDismiss: () -> Unit,
) {
val context = LocalContext.current
val hasPermission = checkPermission(context)
val hasPermission = remember { checkPermission(context) }

if (hasPermission.not()) {
PermissionDialog(
Expand All @@ -72,7 +73,9 @@ fun GalleryGrid(


LazyVerticalGrid(
modifier = modifier,
modifier = modifier
.fillMaxWidth()
.height(400.dp),
columns = GridCells.Fixed(column),
contentPadding = PaddingValues(4.dp),
horizontalArrangement = Arrangement.spacedBy(2.dp),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ fun PostingScreen(runningHistory: RunningHistory, finish: () -> Unit) {
val viewModel = koinViewModel<AddPostViewModel>()
val isUploading = viewModel.uploadingState.collectAsStateWithLifecycle()

var runningHistoryState by remember { mutableStateOf(runningHistory) }

val listState = rememberLazyListState()

LazyColumn(
Expand All @@ -125,6 +127,16 @@ fun PostingScreen(runningHistory: RunningHistory, finish: () -> Unit) {
.align(Alignment.Center)
.padding(bottom = 24.dp),
)

Text(
style = WalkieTypography.Body1_Normal,
text = "초기화",
modifier = Modifier
.align(Alignment.CenterEnd)
.padding(bottom = 24.dp).clickable {
runningHistoryState = runningHistory.copy(bitmap = null)
},
)
}

Row(
Expand All @@ -149,7 +161,6 @@ fun PostingScreen(runningHistory: RunningHistory, finish: () -> Unit) {
}
}

var runningHistoryState by remember { mutableStateOf(runningHistory) }

Map(runningHistoryState, textVisibleState, isUploading.value, text)

Expand Down Expand Up @@ -206,7 +217,7 @@ fun PostingScreen(runningHistory: RunningHistory, finish: () -> Unit) {
},
onPermissionDismiss = {
photoEditState = false
}
},
)
} else {
BasicTextField(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import androidx.compose.material.icons.filled.MyLocation
import androidx.compose.material.icons.filled.Pause
import androidx.compose.material.icons.filled.PlayArrow
import androidx.compose.material.icons.filled.Stop
import androidx.compose.material.icons.outlined.PhotoCamera
import androidx.compose.material3.Button
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
Expand Down Expand Up @@ -126,6 +125,7 @@ fun RunningScreen(
viewModel::saveHistory,
viewModel::takeSnapShot,
viewModel::sendLike,
viewModel::removeImage,
onClickProfile = { user ->
navController.navigate("userPage/${user.uid}/${user.nickname}/${true}")
},
Expand All @@ -147,6 +147,7 @@ fun RunningContent(
saveHistory: (Bitmap, RunningFinishData) -> Unit,
onTakeSnapShot: (RunningFinishData) -> Unit,
onSendLike: (uid: Long) -> Unit,
onRemoveImage: () -> Unit,
onClickProfile: (user: User) -> Unit,
) {
Column(
Expand All @@ -162,6 +163,7 @@ fun RunningContent(
saveHistory,
onSendLike,
onClickProfile,
onRemoveImage,
)
RunningInfoScreen(
modifier = Modifier.height(280.dp),
Expand Down Expand Up @@ -200,6 +202,7 @@ fun RunningMapScreen(
onSaveHistory: (Bitmap, RunningFinishData) -> Unit,
onSendLike: (uid: Long) -> Unit,
onClickProfile: (user: User) -> Unit,
onRemoveImage: () -> Unit,
) {
var mapProperties by remember {
mutableStateOf(
Expand Down Expand Up @@ -374,13 +377,19 @@ fun RunningMapScreen(
modifier = Modifier.clickable { onEditClose() },
)
Text("이미지", style = WalkieTypography.SubTitle)
Icon(
Icons.Outlined.PhotoCamera,
"camera",
modifier = Modifier.clickable {
/* TODO */
},
)

Text("초기화", style = WalkieTypography.Body1_Normal, modifier = Modifier.clickable {
onRemoveImage()
})


// Icon(
// Icons.Outlined.PhotoCamera,
// "camera",
// modifier = Modifier.clickable {
// /* TODO */
// },
// )
}
}
}
Expand Down Expand Up @@ -535,7 +544,7 @@ fun RunningInfoScreen(
modifier = modifier
.background(Color.White),
onImageSelected = { uri -> onSelectImage(uri) },
onPermissionDismiss = onPermissionDismiss
onPermissionDismiss = onPermissionDismiss,
)
}
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@ class RunningViewModel(
}
}

fun removeImage() = intent {
reduce {
state.copy(selectedImage = UiState.Idle)
}
}

fun saveHistory(bitmap: Bitmap, finishData: RunningFinishData) {
if (savedHistory == finishData.runningPositionList) return
savedHistory = finishData.runningPositionList
Expand Down
Loading