feat: implement frame application in ColorWalkScreen

This commit is contained in:
Hinnka committed 2026-05-30 16:48:28 +08:00
1 parent f206af55cf
commit 356b00461b
4 files changed
+17 -2

No files matched your search

@@ -2,6 +2,7 @@ package com.hinnka.mycamera.ui.camera
import android.graphics.Bitmap
import android.graphics.SweepGradient
import android.widget.Toast
import androidx.compose.animation.core.*
import androidx.compose.foundation.*
import androidx.compose.foundation.gestures.*
@@ -36,6 +37,7 @@ import kotlinx.coroutines.launch
import kotlin.math.*
import kotlin.random.Random
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.platform.LocalContext
@OptIn(ExperimentalMaterial3Api::class)
@Composable
@@ -44,6 +46,7 @@ fun ColorWalkScreen(
onBack: () -> Unit
) {
val scope = rememberCoroutineScope()
val context = LocalContext.current
val animatableHue = remember { Animatable(Random.nextFloat() * 360f) }
val currentHue = animatableHue.value % 360f
@@ -253,7 +256,14 @@ fun ColorWalkScreen(
}
RecommendedFrameSection(
previewBitmap = framePreviewBitmap
previewBitmap = framePreviewBitmap,
onClick = {
scope.launch {
val id = viewModel.saveFrameEditorDraft(frameDraft)
viewModel.setFrame(id)
Toast.makeText(context, R.string.apply_frame_success, Toast.LENGTH_SHORT).show()
}
}
)
Spacer(modifier = Modifier.height(24.dp))
@@ -349,7 +359,8 @@ fun ColorWheel(
@Composable
private fun RecommendedFrameSection(
previewBitmap: Bitmap?
previewBitmap: Bitmap?,
onClick: () -> Unit
) {
Column(modifier = Modifier) {
Row(
@@ -365,6 +376,7 @@ private fun RecommendedFrameSection(
)
Surface(
modifier = Modifier.clickable(onClick = onClick),
color = MaterialTheme.colorScheme.primary.copy(alpha = 0.1f),
shape = RoundedCornerShape(8.dp)
) {
@@ -956,4 +956,5 @@
<string name="puzzle_background_white">纯白</string>
<string name="puzzle_background_black">纯黑</string>
<string name="edit_embedded_video_simultaneously">同时编辑内嵌视频</string>
<string name="apply_frame_success">应用边框成功</string>
</resources>
@@ -647,4 +647,5 @@
<string name="puzzle_background_white">純白</string>
<string name="puzzle_background_black">純黑</string>
<string name="edit_embedded_video_simultaneously">同時編輯內嵌視頻</string>
<string name="apply_frame_success">应用边框成功</string>
</resources>
+1
View File
@@ -956,4 +956,5 @@
<string name="puzzle_background_white">White</string>
<string name="puzzle_background_black">Black</string>
<string name="edit_embedded_video_simultaneously">Simultaneously edit embedded video</string>
<string name="apply_frame_success">Apply frame success</string>
</resources>