Skip to content

Commit

Permalink
Merge pull request #96 from Team-Walkie/feat/fix_album_crash
Browse files Browse the repository at this point in the history
[Feat/fix album crash] 커스텀 그리드 앨범 관련 버그 수정
  • Loading branch information
yonghanJu authored Jan 2, 2025
2 parents e11dad0 + 1fbb823 commit c651f7f
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 14 deletions.
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 @@ -136,6 +135,7 @@ fun RunningScreen(
viewModel::saveHistory,
viewModel::takeSnapShot,
viewModel::sendLike,
viewModel::removeImage,
onClickProfile = { user ->
navController.navigate("userPage/${user.uid}/${user.nickname}/${true}")
},
Expand All @@ -157,6 +157,7 @@ fun RunningContent(
saveHistory: (Bitmap, RunningFinishData) -> Unit,
onTakeSnapShot: (RunningFinishData) -> Unit,
onSendLike: (uid: Long) -> Unit,
onRemoveImage: () -> Unit,
onClickProfile: (user: User) -> Unit,
) {
Column(
Expand All @@ -172,6 +173,7 @@ fun RunningContent(
saveHistory,
onSendLike,
onClickProfile,
onRemoveImage,
)
RunningInfoScreen(
modifier = Modifier.height(280.dp),
Expand Down Expand Up @@ -210,6 +212,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 @@ -384,13 +387,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 @@ -545,7 +554,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 @@ -291,6 +291,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

0 comments on commit c651f7f

Please sign in to comment.