feat: add Toolbox screen and migrate LUT creator access
This commit is contained in:
1 parent
7a4389ad51
commit
98ec3f2fce
7 files changed
+184
-16
No files matched your search
@@ -66,6 +66,7 @@ import com.hinnka.mycamera.lut.creator.LutCreatorScreen
|
||||
import com.hinnka.mycamera.lut.creator.LutCreatorViewModel
|
||||
import com.hinnka.mycamera.screencapture.ScreenCaptureRenderConfigStore
|
||||
import com.hinnka.mycamera.ui.camera.CameraScreen
|
||||
import com.hinnka.mycamera.ui.camera.ToolboxScreen
|
||||
import com.hinnka.mycamera.ui.gallery.BurstDetailScreen
|
||||
import com.hinnka.mycamera.ui.gallery.GalleryDetailScreen
|
||||
import com.hinnka.mycamera.ui.gallery.GalleryScreen
|
||||
@@ -100,6 +101,7 @@ object Routes {
|
||||
const val FRAME_MANAGEMENT = "frame_management"
|
||||
const val FRAME_EDITOR = "frame_editor?frameId={frameId}&imageFrame={imageFrame}"
|
||||
const val LUT_CREATOR = "lut_creator"
|
||||
const val TOOLBOX = "toolbox"
|
||||
const val PHANTOM_PIP_CROP = "phantom_pip_crop"
|
||||
|
||||
fun photoDetail(tab: GalleryTab = GalleryTab.PHOTON, index: Int = 0, photoId: String? = null) =
|
||||
@@ -489,6 +491,9 @@ fun NavigationHost(
|
||||
onFrameManagementClick = {
|
||||
navController.navigate(Routes.FRAME_MANAGEMENT)
|
||||
},
|
||||
onToolboxClick = {
|
||||
navController.navigate(Routes.TOOLBOX)
|
||||
},
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
GalleryDetailScreen(
|
||||
@@ -524,6 +529,9 @@ fun NavigationHost(
|
||||
onFrameManagementClick = {
|
||||
navController.navigate(Routes.FRAME_MANAGEMENT)
|
||||
},
|
||||
onToolboxClick = {
|
||||
navController.navigate(Routes.TOOLBOX)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -651,9 +659,6 @@ fun NavigationHost(
|
||||
onBack = {
|
||||
navController.popBackStack()
|
||||
},
|
||||
onLutCreatorClick = {
|
||||
navController.navigate(Routes.LUT_CREATOR)
|
||||
},
|
||||
pendingZipImportUris = pendingZipImportUris,
|
||||
onZipImportHandled = onZipImportHandled,
|
||||
locateLutId = locateLutId
|
||||
@@ -672,6 +677,15 @@ fun NavigationHost(
|
||||
)
|
||||
}
|
||||
|
||||
composable(Routes.TOOLBOX) {
|
||||
ToolboxScreen(
|
||||
onBack = { navController.popBackStack() },
|
||||
onLutCreatorClick = {
|
||||
navController.navigate(Routes.LUT_CREATOR)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
composable(Routes.FRAME_MANAGEMENT) {
|
||||
FrameManagementScreen(
|
||||
viewModel = cameraViewModel,
|
||||
|
||||
@@ -106,6 +106,7 @@ fun CameraScreen(
|
||||
onSettingsClick: () -> Unit,
|
||||
onFilterManagementClick: (String?) -> Unit,
|
||||
onFrameManagementClick: () -> Unit,
|
||||
onToolboxClick: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
@@ -1139,6 +1140,10 @@ fun CameraScreen(
|
||||
activePanel = ActivePanel.NONE
|
||||
onFrameManagementClick()
|
||||
},
|
||||
onToolboxClick = {
|
||||
activePanel = ActivePanel.NONE
|
||||
onToolboxClick()
|
||||
},
|
||||
phantomMode = phantomMode,
|
||||
onPhantomModeToggle = {
|
||||
if (it && (!Settings.canDrawOverlays(context) || !Environment.isExternalStorageManager())) {
|
||||
|
||||
@@ -66,6 +66,7 @@ fun CameraTopSheet(
|
||||
onMeteringModeChange: (MeteringMode) -> Unit,
|
||||
onFilterManageClick: () -> Unit,
|
||||
onFrameManageClick: () -> Unit,
|
||||
onToolboxClick: () -> Unit,
|
||||
phantomMode: Boolean,
|
||||
onPhantomModeToggle: (Boolean) -> Unit,
|
||||
onMoreSettingsClick: () -> Unit,
|
||||
@@ -394,6 +395,13 @@ fun CameraTopSheet(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.spacedBy(10.dp)
|
||||
) {
|
||||
QuickSettingButton(
|
||||
title = stringResource(R.string.toolbox_title),
|
||||
icon = Icons.Default.Palette,
|
||||
onClick = onToolboxClick,
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
|
||||
QuickSettingButton(
|
||||
title = stringResource(R.string.settings_filter_management),
|
||||
icon = Icons.Default.AutoAwesome,
|
||||
@@ -729,7 +737,7 @@ fun QuickSettingButton(
|
||||
.clip(RoundedCornerShape(8.dp))
|
||||
.background(Color.White.copy(alpha = 0.15f))
|
||||
.clickable { onClick() }
|
||||
.padding(horizontal = 16.dp),
|
||||
.padding(horizontal = 8.dp),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Row(
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.hinnka.mycamera.ui.camera
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.lazy.grid.GridCells
|
||||
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
|
||||
import androidx.compose.foundation.lazy.grid.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Palette
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.hinnka.mycamera.R
|
||||
|
||||
data class ToolboxItem(
|
||||
val titleRes: Int,
|
||||
val descriptionRes: Int,
|
||||
val icon: ImageVector,
|
||||
val onClick: () -> Unit
|
||||
)
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun ToolboxScreen(
|
||||
onBack: () -> Unit,
|
||||
onLutCreatorClick: () -> Unit,
|
||||
modifier: Modifier = Modifier
|
||||
) {
|
||||
val items = listOf(
|
||||
ToolboxItem(
|
||||
titleRes = R.string.lut_creator_title,
|
||||
descriptionRes = R.string.lut_creator_desc,
|
||||
icon = Icons.Default.Palette,
|
||||
onClick = onLutCreatorClick
|
||||
)
|
||||
)
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
CenterAlignedTopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = stringResource(R.string.toolbox_title),
|
||||
fontSize = 18.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
},
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onBack) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = "Back"
|
||||
)
|
||||
}
|
||||
},
|
||||
colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
|
||||
containerColor = Color.Black,
|
||||
titleContentColor = Color.White,
|
||||
navigationIconContentColor = Color.White
|
||||
)
|
||||
)
|
||||
},
|
||||
containerColor = Color.Black,
|
||||
modifier = modifier.fillMaxSize()
|
||||
) { padding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(padding)
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 16.dp)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.toolbox_description),
|
||||
color = Color.White.copy(alpha = 0.6f),
|
||||
fontSize = 14.sp,
|
||||
modifier = Modifier.padding(vertical = 16.dp)
|
||||
)
|
||||
|
||||
LazyVerticalGrid(
|
||||
columns = GridCells.Fixed(2),
|
||||
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
items(items) { item ->
|
||||
ToolboxCard(item)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ToolboxCard(item: ToolboxItem) {
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(140.dp)
|
||||
.clip(RoundedCornerShape(16.dp))
|
||||
.clickable { item.onClick() },
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = Color.White.copy(alpha = 0.1f)
|
||||
)
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(16.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Icon(
|
||||
imageVector = item.icon,
|
||||
contentDescription = null,
|
||||
tint = Color(0xFFFF6B35),
|
||||
modifier = Modifier.size(32.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
Text(
|
||||
text = stringResource(item.titleRes),
|
||||
color = Color.White,
|
||||
fontSize = 15.sp,
|
||||
fontWeight = FontWeight.Bold,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
Spacer(modifier = Modifier.height(4.dp))
|
||||
Text(
|
||||
text = stringResource(item.descriptionRes),
|
||||
color = Color.White.copy(alpha = 0.5f),
|
||||
fontSize = 11.sp,
|
||||
textAlign = TextAlign.Center,
|
||||
lineHeight = 14.sp,
|
||||
maxLines = 2
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,6 @@ private fun isZipImportUri(uri: Uri): Boolean {
|
||||
fun FilterManagementScreen(
|
||||
viewModel: CameraViewModel,
|
||||
onBack: () -> Unit,
|
||||
onLutCreatorClick: () -> Unit = {},
|
||||
pendingZipImportUris: List<Uri> = emptyList(),
|
||||
onZipImportHandled: () -> Unit = {},
|
||||
locateLutId: String? = null,
|
||||
@@ -477,17 +476,6 @@ fun FilterManagementScreen(
|
||||
)
|
||||
}
|
||||
|
||||
// 制作 LUT 按钮
|
||||
IconButton(
|
||||
onClick = onLutCreatorClick,
|
||||
enabled = !isImporting
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Palette,
|
||||
contentDescription = "Create LUT",
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
|
||||
// 导入按钮
|
||||
IconButton(
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
<string name="settings">设置</string>
|
||||
<string name="flash">闪光灯</string>
|
||||
<string name="timer">定时器</string>
|
||||
<string name="toolbox_title">工具箱</string>
|
||||
<string name="toolbox_description">实用工具与创意功能</string>
|
||||
<string name="histogram">直方图</string>
|
||||
<string name="grid">网格</string>
|
||||
<string name="back">返回</string>
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
<string name="settings">Settings</string>
|
||||
<string name="flash">Flash</string>
|
||||
<string name="timer">Timer</string>
|
||||
<string name="toolbox_title">Toolbox</string>
|
||||
<string name="toolbox_description">Utility tools and creative features</string>
|
||||
<string name="histogram">Histogram</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="back">Back</string>
|
||||
|
||||
Reference in new issue
Block a user