feat: i18n
This commit is contained in:
1 parent
058e525387
commit
236990169d
21 files changed
+308
-87
No files matched your search
@@ -8,3 +8,4 @@
|
||||
.externalNativeBuild
|
||||
.cxx
|
||||
local.properties
|
||||
app/*/release
|
||||
@@ -7,6 +7,7 @@ plugins {
|
||||
android {
|
||||
namespace = "com.hinnka.mycamera"
|
||||
compileSdk = 36
|
||||
ndkVersion = "27.0.12077973"
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.hinnka.mycamera"
|
||||
@@ -20,6 +21,12 @@ android {
|
||||
ndk {
|
||||
abiFilters += listOf("arm64-v8a", "armeabi-v7a")
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
cmake {
|
||||
arguments += "-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,max-page-size=16384"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"id": "classic_white",
|
||||
"name": "经典白框",
|
||||
"name": {
|
||||
"en": "White",
|
||||
"zh": "经典白框"
|
||||
},
|
||||
"version": 1,
|
||||
"layout": {
|
||||
"position": "BOTTOM",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"id": "black_border",
|
||||
"name": "品质黑框",
|
||||
"name": {
|
||||
"en": "Black",
|
||||
"zh": "品质黑框"
|
||||
},
|
||||
"version": 1,
|
||||
"layout": {
|
||||
"position": "BORDER",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"id": "no_frame",
|
||||
"name": "无框水印",
|
||||
"name": {
|
||||
"en": "Overlay",
|
||||
"zh": "无框水印"
|
||||
},
|
||||
"version": 1,
|
||||
"layout": {
|
||||
"position": "OVERLAY",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"id": "polaroid",
|
||||
"name": "拍立得",
|
||||
"name": {
|
||||
"en": "Polaroid",
|
||||
"zh": "拍立得"
|
||||
},
|
||||
"version": 1,
|
||||
"layout": {
|
||||
"position": "BORDER",
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
{
|
||||
"id": "film_vintage",
|
||||
"name": "复古胶片",
|
||||
"name": {
|
||||
"en": "Vintage",
|
||||
"zh": "复古胶片"
|
||||
},
|
||||
"version": 1,
|
||||
"layout": {
|
||||
"position": "BORDER",
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
{
|
||||
"id": "cc",
|
||||
"name": {
|
||||
"en": "Fujifilm CC",
|
||||
"en": "CC",
|
||||
"zh": "富士CC"
|
||||
},
|
||||
"path": "cc.plut"
|
||||
@@ -43,7 +43,7 @@
|
||||
{
|
||||
"id": "nc",
|
||||
"name": {
|
||||
"en": "Fujifilm NC",
|
||||
"en": "NC",
|
||||
"zh": "富士NC"
|
||||
},
|
||||
"path": "nc.plut"
|
||||
@@ -51,7 +51,7 @@
|
||||
{
|
||||
"id": "ricoh_positive",
|
||||
"name": {
|
||||
"en": "RICOH Positive",
|
||||
"en": "Positive",
|
||||
"zh": "理光正片"
|
||||
},
|
||||
"path": "ricoh_positive.plut"
|
||||
@@ -59,7 +59,7 @@
|
||||
{
|
||||
"id": "ricoh_negative",
|
||||
"name": {
|
||||
"en": "RICOH Negative",
|
||||
"en": "Negative",
|
||||
"zh": "理光负片"
|
||||
},
|
||||
"path": "ricoh_negative.plut"
|
||||
|
||||
@@ -22,10 +22,21 @@ data class FrameConfig(
|
||||
*/
|
||||
data class FrameInfo(
|
||||
val id: String,
|
||||
val name: String,
|
||||
val nameMap: Map<String, String>,
|
||||
val previewResId: Int = 0,
|
||||
val isBuiltIn: Boolean = true
|
||||
)
|
||||
) {
|
||||
/**
|
||||
* 获取当前语言名称
|
||||
*/
|
||||
val name: String
|
||||
get() = getName()
|
||||
|
||||
fun getName(locale: java.util.Locale = java.util.Locale.getDefault()): String {
|
||||
val language = if (locale.language == "zh") "zh" else "en"
|
||||
return nameMap[language] ?: nameMap["en"] ?: id
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 边框模板定义
|
||||
@@ -34,11 +45,16 @@ data class FrameInfo(
|
||||
*/
|
||||
data class FrameTemplate(
|
||||
val id: String,
|
||||
val name: String,
|
||||
val nameMap: Map<String, String>,
|
||||
val version: Int = 1,
|
||||
val layout: FrameLayout,
|
||||
val elements: List<FrameElement>
|
||||
)
|
||||
) {
|
||||
fun getName(locale: java.util.Locale = java.util.Locale.getDefault()): String {
|
||||
val language = if (locale.language == "zh") "zh" else "en"
|
||||
return nameMap[language] ?: nameMap["en"] ?: id
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 边框布局配置
|
||||
|
||||
@@ -30,11 +30,10 @@ object FrameTemplateParser {
|
||||
for (fileName in files) {
|
||||
if (fileName.endsWith(".json")) {
|
||||
val id = fileName.removeSuffix(".json")
|
||||
val name = parseFrameName(context, "$TEMPLATES_FOLDER/$fileName") ?: id
|
||||
frames.add(
|
||||
FrameInfo(
|
||||
id = id,
|
||||
name = name,
|
||||
nameMap = parseFrameNameMap(context, "$TEMPLATES_FOLDER/$fileName"),
|
||||
isBuiltIn = true
|
||||
)
|
||||
)
|
||||
@@ -48,16 +47,37 @@ object FrameTemplateParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析边框模板名称
|
||||
* 解析边框模板名称映射
|
||||
*/
|
||||
private fun parseFrameName(context: Context, path: String): String? {
|
||||
private fun parseFrameNameMap(context: Context, path: String): Map<String, String> {
|
||||
return try {
|
||||
val json = readAssetFile(context, path)
|
||||
JSONObject(json).optString("name").takeIf { it.isNotEmpty() }
|
||||
parseNameMap(JSONObject(json).opt("name"))
|
||||
} catch (e: Exception) {
|
||||
null
|
||||
emptyMap()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析名称映射(支持 String 或 JSONObject)
|
||||
*/
|
||||
private fun parseNameMap(nameObj: Any?): Map<String, String> {
|
||||
val map = mutableMapOf<String, String>()
|
||||
when (nameObj) {
|
||||
is String -> {
|
||||
map["en"] = nameObj
|
||||
map["zh"] = nameObj
|
||||
}
|
||||
is JSONObject -> {
|
||||
val keys = nameObj.keys()
|
||||
while (keys.hasNext()) {
|
||||
val key = keys.next()
|
||||
map[key] = nameObj.getString(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
return map
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 assets 加载并解析边框模板
|
||||
@@ -92,7 +112,7 @@ object FrameTemplateParser {
|
||||
|
||||
return FrameTemplate(
|
||||
id = obj.getString("id"),
|
||||
name = obj.getString("name"),
|
||||
nameMap = parseNameMap(obj.opt("name")),
|
||||
version = obj.optInt("version", 1),
|
||||
layout = parseLayout(obj.getJSONObject("layout")),
|
||||
elements = parseElements(obj.getJSONArray("elements"))
|
||||
|
||||
@@ -97,11 +97,11 @@ data class LutConfig(
|
||||
/**
|
||||
* LUT 强度预设
|
||||
*/
|
||||
enum class LutIntensity(val value: Float, val displayName: String) {
|
||||
NONE(0f, "关闭"),
|
||||
LOW(0.33f, "低"),
|
||||
MEDIUM(0.66f, "中"),
|
||||
FULL(1.0f, "高");
|
||||
enum class LutIntensity(val value: Float, val displayRes: Int) {
|
||||
NONE(0f, com.hinnka.mycamera.R.string.lut_intensity_none),
|
||||
LOW(0.33f, com.hinnka.mycamera.R.string.lut_intensity_low),
|
||||
MEDIUM(0.66f, com.hinnka.mycamera.R.string.lut_intensity_medium),
|
||||
FULL(1.0f, com.hinnka.mycamera.R.string.lut_intensity_high);
|
||||
|
||||
companion object {
|
||||
fun fromValue(value: Float): LutIntensity {
|
||||
@@ -120,7 +120,11 @@ data class LutInfo(
|
||||
val isBuiltIn: Boolean = true,
|
||||
val isDefault: Boolean = false // 是否为默认 LUT
|
||||
) {
|
||||
// 获取显示名称(优先中文)
|
||||
val name: String
|
||||
get() = nameMap["zh"] ?: nameMap["en"] ?: id
|
||||
/**
|
||||
* 获取显示名称(优先当前系统语言)
|
||||
*/
|
||||
fun getName(locale: java.util.Locale = java.util.Locale.getDefault()): String {
|
||||
val language = if (locale.language == "zh") "zh" else "en"
|
||||
return nameMap[language] ?: nameMap["en"] ?: id
|
||||
}
|
||||
}
|
||||
@@ -27,8 +27,10 @@ import androidx.compose.ui.graphics.Path
|
||||
import androidx.compose.ui.graphics.PathOperation
|
||||
import androidx.compose.ui.layout.layout
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.hinnka.mycamera.R
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.compose.LifecycleEventEffect
|
||||
import com.hinnka.mycamera.camera.CameraState
|
||||
@@ -360,7 +362,7 @@ fun Controls(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Cameraswitch,
|
||||
contentDescription = "Switch Camera",
|
||||
contentDescription = stringResource(R.string.switch_camera),
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(32.dp)
|
||||
)
|
||||
|
||||
@@ -3,9 +3,10 @@ package com.hinnka.mycamera.ui.camera
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.*
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.hinnka.mycamera.R
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
@@ -43,7 +44,7 @@ fun CameraTopBar(
|
||||
else -> Icons.Default.FlashOff
|
||||
},
|
||||
modifier = Modifier.size(20.dp).autoRotate(),
|
||||
contentDescription = "Flash",
|
||||
contentDescription = stringResource(R.string.flash),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -62,7 +63,7 @@ fun CameraTopBar(
|
||||
} else {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Timer,
|
||||
contentDescription = "Timer",
|
||||
contentDescription = stringResource(R.string.timer),
|
||||
modifier = Modifier.size(20.dp).autoRotate(),
|
||||
tint = Color.White
|
||||
)
|
||||
@@ -73,7 +74,7 @@ fun CameraTopBar(
|
||||
IconButton(onClick = onHistogramToggle) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.BarChart,
|
||||
contentDescription = "Histogram",
|
||||
contentDescription = stringResource(R.string.histogram),
|
||||
modifier = Modifier.size(20.dp).autoRotate(),
|
||||
tint = if (showHistogram) Color.Yellow else Color.White
|
||||
)
|
||||
@@ -83,7 +84,7 @@ fun CameraTopBar(
|
||||
IconButton(onClick = onGridToggle) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.GridOn,
|
||||
contentDescription = "Grid",
|
||||
contentDescription = stringResource(R.string.grid),
|
||||
modifier = Modifier.size(20.dp).autoRotate(),
|
||||
tint = if (showGrid) Color.Yellow else Color.White
|
||||
)
|
||||
@@ -93,7 +94,7 @@ fun CameraTopBar(
|
||||
IconButton(onClick = onSettingsClick) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Settings,
|
||||
contentDescription = "Settings",
|
||||
contentDescription = stringResource(R.string.settings),
|
||||
modifier = Modifier.size(20.dp).autoRotate(),
|
||||
tint = Color.White
|
||||
)
|
||||
|
||||
@@ -19,8 +19,10 @@ import androidx.compose.ui.input.pointer.pointerInput
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextDecoration
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.hinnka.mycamera.R
|
||||
import com.hinnka.mycamera.camera.CameraInfo
|
||||
import com.hinnka.mycamera.camera.LensType
|
||||
import kotlin.math.abs
|
||||
@@ -80,7 +82,7 @@ fun ZoomControlBar(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.SwapHoriz,
|
||||
contentDescription = "Toggle Display Mode",
|
||||
contentDescription = stringResource(R.string.toggle_display_mode),
|
||||
modifier = Modifier.size(32.dp)
|
||||
.background(Color.Black.copy(alpha = 0.3f), CircleShape)
|
||||
.padding(8.dp),
|
||||
@@ -97,7 +99,7 @@ fun ZoomControlBar(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.AutoAwesome,
|
||||
contentDescription = "Filters",
|
||||
contentDescription = stringResource(R.string.filters_panel),
|
||||
modifier = Modifier.size(32.dp)
|
||||
.background(Color.Black.copy(alpha = 0.3f), CircleShape)
|
||||
.padding(8.dp),
|
||||
|
||||
@@ -22,6 +22,8 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.hinnka.mycamera.R
|
||||
import com.hinnka.mycamera.lut.LutInfo
|
||||
|
||||
/**
|
||||
@@ -47,7 +49,7 @@ fun LutSelector(
|
||||
// LUT 列表
|
||||
availableLuts.forEach { lut ->
|
||||
LutItem(
|
||||
name = lut.name,
|
||||
name = lut.getName(),
|
||||
previewBitmap = lutPreviewBitmaps[lut.id],
|
||||
isSelected = currentLutId == lut.id,
|
||||
onClick = { onLutSelected(lut.id) }
|
||||
@@ -197,7 +199,7 @@ fun LutIntensitySlider(
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
text = "滤镜强度",
|
||||
text = stringResource(R.string.filter_intensity),
|
||||
color = if (enabled) Color.White else Color.Gray,
|
||||
fontSize = 12.sp
|
||||
)
|
||||
|
||||
@@ -86,7 +86,7 @@ fun GalleryScreen(
|
||||
title = {
|
||||
if (isSelectionMode) {
|
||||
Text(
|
||||
text = "${selectedPhotos.size} 已选择",
|
||||
text = stringResource(R.string.items_selected, selectedPhotos.size),
|
||||
color = Color.White
|
||||
)
|
||||
} else {
|
||||
@@ -106,7 +106,7 @@ fun GalleryScreen(
|
||||
}) {
|
||||
Icon(
|
||||
imageVector = if (isSelectionMode) Icons.Default.Close else Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = "Back",
|
||||
contentDescription = stringResource(R.string.back),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -116,7 +116,7 @@ fun GalleryScreen(
|
||||
IconButton(onClick = { viewModel.toggleSelectAll() }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.SelectAll,
|
||||
contentDescription = "Select All",
|
||||
contentDescription = stringResource(R.string.select_all),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -124,7 +124,7 @@ fun GalleryScreen(
|
||||
IconButton(onClick = { launcher.launch("image/*") }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.AddPhotoAlternate,
|
||||
contentDescription = "Import",
|
||||
contentDescription = stringResource(R.string.import_photo),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -159,7 +159,7 @@ fun GalleryScreen(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Delete,
|
||||
contentDescription = "Delete",
|
||||
contentDescription = stringResource(R.string.delete),
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
@@ -185,7 +185,7 @@ fun GalleryScreen(
|
||||
} else {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Share,
|
||||
contentDescription = "Share",
|
||||
contentDescription = stringResource(R.string.share),
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(28.dp)
|
||||
)
|
||||
@@ -348,7 +348,7 @@ private fun PhotoGridItem(
|
||||
|
||||
Icon(
|
||||
imageVector = if (isSelected) Icons.Default.CheckCircle else Icons.Default.RadioButtonUnchecked,
|
||||
contentDescription = if (isSelected) "Selected" else "Not selected",
|
||||
contentDescription = if (isSelected) stringResource(R.string.selected) else stringResource(R.string.not_selected),
|
||||
tint = if (isSelected) AccentOrange else Color.White.copy(alpha = 0.7f),
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopEnd)
|
||||
@@ -367,7 +367,7 @@ private fun PhotoGridItem(
|
||||
.padding(horizontal = 4.dp, vertical = 2.dp)
|
||||
) {
|
||||
Text(
|
||||
text = "Imported",
|
||||
text = stringResource(R.string.imported),
|
||||
color = Color.White,
|
||||
fontSize = 8.sp,
|
||||
fontWeight = androidx.compose.ui.text.font.FontWeight.Bold
|
||||
|
||||
@@ -90,7 +90,7 @@ fun PhotoDetailScreen(
|
||||
IconButton(onClick = onBack) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = "Back",
|
||||
contentDescription = stringResource(R.string.back),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -99,7 +99,7 @@ fun PhotoDetailScreen(
|
||||
IconButton(onClick = { showInfoDialog = true }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Info,
|
||||
contentDescription = "Info",
|
||||
contentDescription = stringResource(R.string.photo_info),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -137,7 +137,7 @@ fun PhotoDetailScreen(
|
||||
} else {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Share,
|
||||
contentDescription = "Share",
|
||||
contentDescription = stringResource(R.string.share),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -155,7 +155,7 @@ fun PhotoDetailScreen(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Edit,
|
||||
contentDescription = "Edit",
|
||||
contentDescription = stringResource(R.string.edit),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -176,7 +176,7 @@ fun PhotoDetailScreen(
|
||||
} else {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Output,
|
||||
contentDescription = "Save",
|
||||
contentDescription = stringResource(R.string.export),
|
||||
tint = AccentOrange
|
||||
)
|
||||
}
|
||||
@@ -191,7 +191,7 @@ fun PhotoDetailScreen(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Delete,
|
||||
contentDescription = "Delete",
|
||||
contentDescription = stringResource(R.string.delete),
|
||||
tint = Color.Red
|
||||
)
|
||||
}
|
||||
@@ -308,14 +308,14 @@ fun PhotoDetailScreen(
|
||||
title = { Text(stringResource(R.string.photo_info)) },
|
||||
text = {
|
||||
Column {
|
||||
InfoRow("拍摄时间", currentPhoto.getFormattedDate())
|
||||
InfoRow("分辨率", currentPhoto.getResolution())
|
||||
InfoRow("文件大小", currentPhoto.getFormattedSize())
|
||||
InfoRow(stringResource(R.string.photo_info_date), currentPhoto.getFormattedDate())
|
||||
InfoRow(stringResource(R.string.photo_info_resolution), currentPhoto.getResolution())
|
||||
InfoRow(stringResource(R.string.photo_info_size), currentPhoto.getFormattedSize())
|
||||
currentPhoto.metadata?.let {
|
||||
InfoRow("焦距", it.focalLength35mm ?: "N/A")
|
||||
InfoRow("光圈", it.aperture ?: "N/A")
|
||||
InfoRow("ISO", it.iso?.toString() ?: "N/A")
|
||||
InfoRow("快门速度", it.shutterSpeed ?: "N/A")
|
||||
InfoRow(stringResource(R.string.photo_info_focal_length), it.focalLength35mm ?: "N/A")
|
||||
InfoRow(stringResource(R.string.photo_info_aperture), it.aperture ?: "N/A")
|
||||
InfoRow(stringResource(R.string.photo_info_iso), it.iso?.toString() ?: "N/A")
|
||||
InfoRow(stringResource(R.string.photo_info_shutter_speed), it.shutterSpeed ?: "N/A")
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -115,7 +115,7 @@ fun PhotoEditScreen(
|
||||
}) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = "Back",
|
||||
contentDescription = stringResource(R.string.back),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -143,7 +143,7 @@ fun PhotoEditScreen(
|
||||
} else {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Check,
|
||||
contentDescription = "Save",
|
||||
contentDescription = stringResource(R.string.save),
|
||||
tint = AccentOrange
|
||||
)
|
||||
}
|
||||
@@ -186,7 +186,7 @@ fun PhotoEditScreen(
|
||||
if (previewBitmap != null) {
|
||||
Image(
|
||||
bitmap = previewBitmap!!.asImageBitmap(),
|
||||
contentDescription = "Edit preview",
|
||||
contentDescription = stringResource(R.string.edit),
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
@@ -197,7 +197,7 @@ fun PhotoEditScreen(
|
||||
.data(currentPhoto.uri)
|
||||
.crossfade(true)
|
||||
.build(),
|
||||
contentDescription = "Original",
|
||||
contentDescription = stringResource(R.string.original),
|
||||
contentScale = ContentScale.Fit,
|
||||
modifier = Modifier.fillMaxSize()
|
||||
)
|
||||
@@ -255,7 +255,7 @@ fun PhotoEditScreen(
|
||||
// LUT 选项
|
||||
itemsIndexed(availableLuts) { index, lut ->
|
||||
LutOption(
|
||||
name = lut.name,
|
||||
name = lut.getName(),
|
||||
previewBitmap = lutPreviews.getOrNull(index),
|
||||
isSelected = editLutId == lut.id,
|
||||
onClick = { viewModel.setEditLut(lut.id) }
|
||||
|
||||
@@ -20,6 +20,8 @@ import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.hinnka.mycamera.R
|
||||
import com.hinnka.mycamera.camera.AspectRatio
|
||||
import com.hinnka.mycamera.frame.FrameInfo
|
||||
import com.hinnka.mycamera.ui.camera.autoRotate
|
||||
@@ -53,7 +55,7 @@ fun SettingsScreen(
|
||||
TopAppBar(
|
||||
title = {
|
||||
Text(
|
||||
text = "设置",
|
||||
text = stringResource(R.string.settings_title),
|
||||
color = Color.White,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
@@ -66,7 +68,7 @@ fun SettingsScreen(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
contentDescription = "返回",
|
||||
contentDescription = stringResource(R.string.back),
|
||||
tint = Color.White
|
||||
)
|
||||
}
|
||||
@@ -86,7 +88,7 @@ fun SettingsScreen(
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
|
||||
// 画面比例设置
|
||||
SettingsSection(title = "拍摄设置") {
|
||||
SettingsSection(title = stringResource(R.string.settings_section_capture)) {
|
||||
AspectRatioSetting(
|
||||
currentRatio = state.aspectRatio,
|
||||
onRatioSelected = { viewModel.setAspectRatio(it) }
|
||||
@@ -96,10 +98,10 @@ fun SettingsScreen(
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
|
||||
// 显示设置
|
||||
SettingsSection(title = "显示设置") {
|
||||
SettingsSection(title = stringResource(R.string.settings_section_display)) {
|
||||
SwitchSettingItem(
|
||||
title = "水平仪显示",
|
||||
description = "在拍摄时显示水平仪,帮助保持画面水平",
|
||||
title = stringResource(R.string.settings_level_indicator),
|
||||
description = stringResource(R.string.settings_level_description),
|
||||
checked = showLevelIndicator,
|
||||
onCheckedChange = { viewModel.setShowLevelIndicator(it) }
|
||||
)
|
||||
@@ -110,8 +112,8 @@ fun SettingsScreen(
|
||||
)
|
||||
|
||||
SwitchSettingItem(
|
||||
title = "网格线显示",
|
||||
description = "在拍摄时显示网格线,辅助构图",
|
||||
title = stringResource(R.string.settings_grid_lines),
|
||||
description = stringResource(R.string.settings_grid_description),
|
||||
checked = state.showGrid,
|
||||
onCheckedChange = { viewModel.toggleGrid() }
|
||||
)
|
||||
@@ -120,7 +122,7 @@ fun SettingsScreen(
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
|
||||
// 边框水印设置
|
||||
SettingsSection(title = "边框水印") {
|
||||
SettingsSection(title = stringResource(R.string.settings_section_frame)) {
|
||||
FrameWatermarkSetting(
|
||||
currentFrameId = viewModel.currentFrameId,
|
||||
availableFrames = viewModel.availableFrameList,
|
||||
@@ -131,10 +133,10 @@ fun SettingsScreen(
|
||||
Spacer(modifier = Modifier.height(24.dp))
|
||||
|
||||
// 拍摄设置
|
||||
SettingsSection(title = "拍摄操作") {
|
||||
SettingsSection(title = stringResource(R.string.settings_section_operation)) {
|
||||
SwitchSettingItem(
|
||||
title = "快门声音",
|
||||
description = "拍照时播放快门声音",
|
||||
title = stringResource(R.string.settings_shutter_sound),
|
||||
description = stringResource(R.string.settings_shutter_sound_description),
|
||||
checked = shutterSoundEnabled,
|
||||
onCheckedChange = { viewModel.setShutterSoundEnabled(it) }
|
||||
)
|
||||
@@ -145,8 +147,8 @@ fun SettingsScreen(
|
||||
)
|
||||
|
||||
SwitchSettingItem(
|
||||
title = "音量键拍摄",
|
||||
description = "使用音量键进行拍摄",
|
||||
title = stringResource(R.string.settings_volume_key),
|
||||
description = stringResource(R.string.settings_volume_key_description),
|
||||
checked = volumeKeyCapture,
|
||||
onCheckedChange = { viewModel.setVolumeKeyCapture(it) }
|
||||
)
|
||||
@@ -157,8 +159,8 @@ fun SettingsScreen(
|
||||
)
|
||||
|
||||
SwitchSettingItem(
|
||||
title = "拍摄后自动保存",
|
||||
description = "拍摄后自动保存照片,否则需要手动确认",
|
||||
title = stringResource(R.string.settings_auto_save),
|
||||
description = stringResource(R.string.settings_auto_save_description),
|
||||
checked = autoSaveAfterCapture,
|
||||
onCheckedChange = { viewModel.setAutoSaveAfterCapture(it) }
|
||||
)
|
||||
@@ -260,7 +262,7 @@ fun AspectRatioSetting(
|
||||
) {
|
||||
Column(modifier = modifier.fillMaxWidth()) {
|
||||
Text(
|
||||
text = "画面比例",
|
||||
text = stringResource(R.string.aspect_ratio),
|
||||
color = Color.White,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
@@ -325,7 +327,7 @@ fun FrameWatermarkSetting(
|
||||
) {
|
||||
Column(modifier = modifier.fillMaxWidth()) {
|
||||
Text(
|
||||
text = "边框样式",
|
||||
text = stringResource(R.string.settings_frame_style),
|
||||
color = Color.White,
|
||||
fontSize = 16.sp,
|
||||
fontWeight = FontWeight.Normal,
|
||||
@@ -342,7 +344,7 @@ fun FrameWatermarkSetting(
|
||||
) {
|
||||
// "无边框" 选项
|
||||
FrameItem(
|
||||
name = "无",
|
||||
name = stringResource(R.string.none),
|
||||
isSelected = currentFrameId == null,
|
||||
onClick = { onFrameSelected(null) },
|
||||
isNone = true
|
||||
@@ -361,7 +363,7 @@ fun FrameWatermarkSetting(
|
||||
Spacer(modifier = Modifier.height(12.dp))
|
||||
|
||||
Text(
|
||||
text = "为拍摄的照片添加装饰性边框和水印",
|
||||
text = stringResource(R.string.settings_frame_description),
|
||||
color = Color.White.copy(alpha = 0.6f),
|
||||
fontSize = 13.sp
|
||||
)
|
||||
@@ -457,7 +459,7 @@ private fun FrameItem(
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Check,
|
||||
contentDescription = "Selected",
|
||||
contentDescription = stringResource(R.string.selected),
|
||||
tint = Color.White,
|
||||
modifier = Modifier.size(24.dp)
|
||||
)
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
<resources>
|
||||
<string name="app_name">Photon Camera</string>
|
||||
|
||||
<!-- Camera Controls -->
|
||||
<string name="capture">拍摄</string>
|
||||
<string name="switch_camera">切换摄像头</string>
|
||||
<string name="settings">设置</string>
|
||||
<string name="flash">闪光灯</string>
|
||||
<string name="timer">定时器</string>
|
||||
<string name="histogram">直方图</string>
|
||||
<string name="grid">网格</string>
|
||||
<string name="back">返回</string>
|
||||
|
||||
<!-- Exposure Controls -->
|
||||
<string name="exposure_compensation">EV</string>
|
||||
<string name="iso">ISO</string>
|
||||
<string name="shutter_speed">快门</string>
|
||||
<string name="auto">自动</string>
|
||||
|
||||
<!-- Focus -->
|
||||
<string name="focus">对焦</string>
|
||||
<string name="tap_to_focus">点击对焦</string>
|
||||
|
||||
<!-- Aspect Ratio -->
|
||||
<string name="aspect_ratio">画面比例</string>
|
||||
<string name="ratio_3_2">3:2</string>
|
||||
<string name="ratio_4_3">4:3</string>
|
||||
<string name="ratio_16_9">16:9</string>
|
||||
<string name="ratio_1_1">1:1</string>
|
||||
|
||||
<!-- Permissions -->
|
||||
<string name="camera_permission_required">需要相机权限</string>
|
||||
<string name="grant_permission">授予权限</string>
|
||||
|
||||
<!-- Zoom -->
|
||||
<string name="zoom">变焦</string>
|
||||
|
||||
<!-- Gallery -->
|
||||
<string name="gallery">相册</string>
|
||||
<string name="photo_detail">照片详情</string>
|
||||
<string name="share">分享</string>
|
||||
<string name="delete">删除</string>
|
||||
<string name="export">导出</string>
|
||||
<string name="edit">编辑</string>
|
||||
<string name="select_all">全选</string>
|
||||
<string name="cancel">取消</string>
|
||||
<string name="save">保存</string>
|
||||
<string name="rotate">旋转</string>
|
||||
<string name="crop">裁剪</string>
|
||||
<string name="brightness">亮度</string>
|
||||
<string name="delete_confirm">删除这张照片吗?</string>
|
||||
<string name="delete_multiple_confirm">删除 %d 张照片吗?</string>
|
||||
<string name="no_photos">暂无照片</string>
|
||||
<string name="photo_info">照片信息</string>
|
||||
<string name="filter">滤镜</string>
|
||||
<string name="intensity">强度</string>
|
||||
<string name="original">原图</string>
|
||||
<string name="export_confirm">导出已应用滤镜的照片吗?</string>
|
||||
<string name="items_selected">已选择 %d</string>
|
||||
<string name="not_selected">未选择</string>
|
||||
<string name="selected">已选择</string>
|
||||
<string name="imported">导入</string>
|
||||
<string name="photo_info_date">拍摄时间</string>
|
||||
<string name="photo_info_resolution">分辨率</string>
|
||||
<string name="photo_info_size">文件大小</string>
|
||||
<string name="photo_info_focal_length">焦距</string>
|
||||
<string name="photo_info_aperture">光圈</string>
|
||||
<string name="photo_info_iso">ISO</string>
|
||||
<string name="photo_info_shutter_speed">快门速度</string>
|
||||
|
||||
<!-- Frame Watermark -->
|
||||
<string name="frame">边框</string>
|
||||
<string name="none">无</string>
|
||||
<string name="show_app_branding">显示 App 品牌</string>
|
||||
<string name="export_with_frame_confirm">导出带有边框水印的照片吗?</string>
|
||||
<string name="import_photo">导入</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings_title">设置</string>
|
||||
<string name="settings_section_capture">拍摄设置</string>
|
||||
<string name="settings_section_display">显示设置</string>
|
||||
<string name="settings_level_indicator">水平仪显示</string>
|
||||
<string name="settings_level_description">在拍摄时显示水平仪,帮助保持画面水平</string>
|
||||
<string name="settings_grid_lines">网格线显示</string>
|
||||
<string name="settings_grid_description">在拍摄时显示网格线,辅助构图</string>
|
||||
<string name="settings_section_frame">边框水印</string>
|
||||
<string name="settings_frame_style">边框样式</string>
|
||||
<string name="settings_frame_description">为拍摄的照片添加装饰性边框和水印</string>
|
||||
<string name="settings_section_operation">拍摄操作</string>
|
||||
<string name="settings_shutter_sound">快门声音</string>
|
||||
<string name="settings_shutter_sound_description">拍照时播放快门声音</string>
|
||||
<string name="settings_volume_key">音量键拍摄</string>
|
||||
<string name="settings_volume_key_description">使用音量键进行拍摄</string>
|
||||
<string name="settings_auto_save">拍摄后自动保存</string>
|
||||
<string name="settings_auto_save_description">拍摄后自动保存照片,否则需要手动确认</string>
|
||||
|
||||
<!-- LUT -->
|
||||
<string name="filter_intensity">滤镜强度</string>
|
||||
<string name="lut_intensity_none">关闭</string>
|
||||
<string name="lut_intensity_low">低</string>
|
||||
<string name="lut_intensity_medium">中</string>
|
||||
<string name="lut_intensity_high">高</string>
|
||||
<string name="filters_panel">滤镜面板</string>
|
||||
<string name="toggle_display_mode">切换显示模式</string>
|
||||
</resources>
|
||||
@@ -5,6 +5,11 @@
|
||||
<string name="capture">Capture</string>
|
||||
<string name="switch_camera">Switch Camera</string>
|
||||
<string name="settings">Settings</string>
|
||||
<string name="flash">Flash</string>
|
||||
<string name="timer">Timer</string>
|
||||
<string name="histogram">Histogram</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="back">Back</string>
|
||||
|
||||
<!-- Exposure Controls -->
|
||||
<string name="exposure_compensation">EV</string>
|
||||
@@ -51,6 +56,17 @@
|
||||
<string name="intensity">Intensity</string>
|
||||
<string name="original">Original</string>
|
||||
<string name="export_confirm">Export photo with LUT applied?</string>
|
||||
<string name="items_selected">%d Selected</string>
|
||||
<string name="not_selected">Not selected</string>
|
||||
<string name="selected">Selected</string>
|
||||
<string name="imported">Imported</string>
|
||||
<string name="photo_info_date">Date</string>
|
||||
<string name="photo_info_resolution">Resolution</string>
|
||||
<string name="photo_info_size">Size</string>
|
||||
<string name="photo_info_focal_length">Focal Length</string>
|
||||
<string name="photo_info_aperture">Aperture</string>
|
||||
<string name="photo_info_iso">ISO</string>
|
||||
<string name="photo_info_shutter_speed">Shutter Speed</string>
|
||||
|
||||
<!-- Frame Watermark -->
|
||||
<string name="frame">Frame</string>
|
||||
@@ -58,4 +74,32 @@
|
||||
<string name="show_app_branding">Show App Branding</string>
|
||||
<string name="export_with_frame_confirm">Export photo with frame watermark?</string>
|
||||
<string name="import_photo">Import</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="settings_title">Settings</string>
|
||||
<string name="settings_section_capture">Capture</string>
|
||||
<string name="settings_section_display">Display</string>
|
||||
<string name="settings_level_indicator">Horizontal Level</string>
|
||||
<string name="settings_level_description">Show horizontal level indicator while shooting</string>
|
||||
<string name="settings_grid_lines">Grid Lines</string>
|
||||
<string name="settings_grid_description">Show grid lines for composition</string>
|
||||
<string name="settings_section_frame">Frame Watermark</string>
|
||||
<string name="settings_frame_style">Frame Style</string>
|
||||
<string name="settings_frame_description">Add decorative frame and watermark to photos</string>
|
||||
<string name="settings_section_operation">Operations</string>
|
||||
<string name="settings_shutter_sound">Shutter Sound</string>
|
||||
<string name="settings_shutter_sound_description">Play sound when taking a photo</string>
|
||||
<string name="settings_volume_key">Volume Key Capture</string>
|
||||
<string name="settings_volume_key_description">Use volume keys to take photos</string>
|
||||
<string name="settings_auto_save">Auto Save</string>
|
||||
<string name="settings_auto_save_description">Automatically save photos after capture</string>
|
||||
|
||||
<!-- LUT -->
|
||||
<string name="filter_intensity">Filter Intensity</string>
|
||||
<string name="lut_intensity_none">None</string>
|
||||
<string name="lut_intensity_low">Low</string>
|
||||
<string name="lut_intensity_medium">Medium</string>
|
||||
<string name="lut_intensity_high">High</string>
|
||||
<string name="filters_panel">Filters</string>
|
||||
<string name="toggle_display_mode">Toggle Display Mode</string>
|
||||
</resources>
|
||||
Reference in new issue
Block a user