feat: frequent LUT usage tracking and selection

This commit is contained in:
zhoubinjia committed 2026-11-17 11:29:32 +08:00
1 parent 32dd9acfde
commit 29e3a6a2b2
23 files changed
+181 -41

No files matched your search

@@ -9,6 +9,7 @@ import com.hinnka.mycamera.gallery.PhotoProcessor
import com.hinnka.mycamera.lut.LutImageProcessor
import com.hinnka.mycamera.lut.LutInfo
import com.hinnka.mycamera.lut.LutManager
import com.hinnka.mycamera.lut.initializeFrequentLuts
import com.hinnka.mycamera.processor.DepthBokehProcessor
import com.hinnka.mycamera.raw.DcpInfo
import com.hinnka.mycamera.raw.DcpManager
@@ -105,6 +106,7 @@ class ContentRepository private constructor(context: Context) {
_availableLuts.value = StartupTrace.measure("ContentRepository.getAvailableLuts") {
lutManager.getAvailableLuts()
}
initializeFrequentLuts()
_availableFrames.value = StartupTrace.measure("ContentRepository.getAvailableFrames") {
frameManager.getAvailableFrames()
}
@@ -127,6 +129,22 @@ class ContentRepository private constructor(context: Context) {
*/
fun getAvailableLuts(): List<LutInfo> = _availableLuts.value
private fun initializeFrequentLuts() {
val luts = _availableLuts.value
userPreferencesRepository.updateAsync { initializeFrequentLuts(luts) }
}
/** 收到实际拍摄图像后调用,使用快门时的滤镜快照;预览、编辑和导入不计数。 */
fun recordLutCapture(lutId: String?) {
val luts = _availableLuts.value
if (lutId == null || lutId == "none" || luts.none { it.id == lutId }) return
userPreferencesRepository.updateAsync {
initializeFrequentLuts(luts)
val usage = frequentLutUsage.orEmpty()
frequentLutUsage = usage + (lutId to ((usage[lutId] ?: 0L) + 1L))
}
}
/**
* 获取可用边框列表(用于一次性获取)
*/
@@ -150,6 +168,7 @@ class ContentRepository private constructor(context: Context) {
lutManager.initialize()
frameManager.initialize()
_availableLuts.value = lutManager.getAvailableLuts()
initializeFrequentLuts()
_availableFrames.value = frameManager.getAvailableFrames()
_availableDcps.value = dcpManager.getAvailableDcps()
_availableRawNoiseProfiles.value = rawNoiseProfileManager.getAvailableProfiles()
@@ -334,6 +334,12 @@ class UserPreferences internal constructor(
var cameraOrientationOffsets: Map<String, Int> by stored({ p ->
parseCameraOrientationOffsets(p[K.CAMERA_ORIENTATION_OFFSETS])
}) { p, v -> p[K.CAMERA_ORIENTATION_OFFSETS] = serializeCameraOrientationOffsets(v.filterValues { it != 0 }) }
/** 常用滤镜的拍照次数;使用独立 key,旧的预览选用次数不参与统计。
* null 表示尚未从收藏或内置滤镜初始化。 */
var frequentLutUsage: Map<String, Long>? by json(
"frequent_lut_capture_usage", ::parseFrequentLutUsage, ::serializeFrequentLutUsage
)
/** 滤镜排序(ID 列表)。 */
var filterOrder: List<String> by stored({ p -> p[K.FILTER_ORDER]?.split(",")?.filter { it.isNotEmpty() } ?: emptyList() }) { p, v ->
p[K.FILTER_ORDER] = v.joinToString(",")
@@ -16,6 +16,24 @@ import org.json.JSONObject
/** 内置分类在当前语言下的显示名;持久化时以稳定标识存储。 */
internal fun builtInCategoryLabel(): String = MyCameraApplication.instance.getString(R.string.built_in)
// 使用数组保存首次加入顺序,避免依赖 JSON 对象键的顺序。
internal fun parseFrequentLutUsage(value: String?): Map<String, Long>? {
if (value == null) return null
val entries = JSONArray(value)
return buildMap {
for (index in 0 until entries.length()) {
val entry = entries.getJSONObject(index)
put(entry.getString("id"), entry.getLong("count"))
}
}
}
internal fun serializeFrequentLutUsage(usage: Map<String, Long>): String = JSONArray().apply {
usage.forEach { (id, count) ->
put(JSONObject().put("id", id).put("count", count))
}
}.toString()
/**
* 解析摄像头方向偏移字符串
* 格式:cameraId1:offset1,cameraId2:offset2
@@ -0,0 +1,29 @@
package com.hinnka.mycamera.lut
import com.hinnka.mycamera.data.UserPreferences
private val DEFAULT_FREQUENT_LUT_IDS = listOf("standard", "leica_m9", "monochrome", "cc", "ricoh_negative")
private const val FREQUENT_LUT_LIMIT = 8
/** 只初始化一次;默认推荐的计数为零,不伪造用户使用记录。 */
fun UserPreferences.initializeFrequentLuts(luts: List<LutInfo>) {
if (frequentLutUsage != null || luts.isEmpty()) return
val favorites = sortLutsByUserOrder(luts, filterOrder).filter { it.isFavorite && it.id != "none" }
val seeds = if (favorites.isNotEmpty()) {
favorites.take(DEFAULT_FREQUENT_LUT_IDS.size)
} else {
DEFAULT_FREQUENT_LUT_IDS.mapNotNull { id -> luts.find { it.id == id && it.isBuiltIn } }
}
frequentLutUsage = seeds.associate { it.id to 0L }
}
fun frequentLuts(luts: List<LutInfo>, usage: Map<String, Long>?): List<LutInfo> {
val counts = usage.orEmpty()
// 同频次保持首次加入顺序,不受其他分类的手动排序影响。
val insertionOrder = counts.keys.withIndex().associate { it.value to it.index }
val ranked = luts.filter { it.id != "none" && it.id in counts }
.sortedWith(compareByDescending<LutInfo> { counts[it.id] ?: 0L }
.thenBy { insertionOrder[it.id] })
.take(FREQUENT_LUT_LIMIT)
return luts.filter { it.id == "none" } + ranked
}
@@ -4,9 +4,9 @@ fun sortLutsByUserOrder(
luts: List<LutInfo>,
filterOrder: List<String>
): List<LutInfo> {
if (filterOrder.isEmpty()) return luts
val orderMap = filterOrder.withIndex().associate { it.value to it.index }
return luts.sortedBy { orderMap[it.id] ?: Int.MAX_VALUE }
return luts.sortedWith(compareBy<LutInfo> { it.id != "none" }
.thenBy { orderMap[it.id] ?: Int.MAX_VALUE })
}
fun orderedLutCategoryTitles(
@@ -15,9 +15,10 @@ fun orderedLutCategoryTitles(
builtInText: String,
uncategorizedText: String,
favoriteText: String? = null,
includeEmptyCategories: Boolean = false
includeEmptyCategories: Boolean = false,
frequentText: String? = null
): List<String> {
val reservedCategoryNames = setOfNotNull(builtInText, uncategorizedText, favoriteText)
val reservedCategoryNames = setOfNotNull(builtInText, uncategorizedText, favoriteText, frequentText)
val dynamicCategories = luts.map { it.category }
.distinct()
.filter { it.isNotEmpty() && it !in reservedCategoryNames }
@@ -30,6 +31,7 @@ fun orderedLutCategoryTitles(
val remainingDynamic = dynamicCategories.filterNot { it in orderedKnownCategories }.sorted()
return buildList {
frequentText?.let { add(it) }
favoriteText?.let { add(it) }
if (orderedKnownCategories.isEmpty()) {
add(builtInText)
@@ -50,17 +52,21 @@ fun groupLutsForDisplay(
categoryOrder: List<String>,
builtInText: String,
uncategorizedText: String,
favoriteText: String? = null
favoriteText: String? = null,
frequentText: String? = null,
frequentUsage: Map<String, Long>? = null
): List<Pair<String, List<LutInfo>>> {
val categories = orderedLutCategoryTitles(
luts = luts,
categoryOrder = categoryOrder,
builtInText = builtInText,
uncategorizedText = uncategorizedText,
favoriteText = favoriteText
favoriteText = favoriteText,
frequentText = frequentText
)
return categories.mapNotNull { category ->
val items = when (category) {
frequentText -> frequentLuts(luts, frequentUsage)
favoriteText -> luts.filter { it.isFavorite }
builtInText -> luts.filter { it.isBuiltIn }
uncategorizedText -> luts.filter { !it.isBuiltIn && it.category.isEmpty() }
@@ -798,12 +798,16 @@ private fun ApplyLutScreen(
val listState = rememberLazyListState()
val builtInText = androidx.compose.ui.res.stringResource(R.string.built_in)
val uncategorizedText = androidx.compose.ui.res.stringResource(R.string.uncategorized)
val groupedLuts = remember(lutData.first, lutData.second, builtInText, uncategorizedText) {
val frequentText = androidx.compose.ui.res.stringResource(R.string.frequent_filters)
val frequentUsage by com.hinnka.mycamera.ui.prefs.preferenceValue { it.frequentLutUsage }
val groupedLuts = remember(lutData.first, lutData.second, builtInText, uncategorizedText, frequentText, frequentUsage) {
groupLutsForDisplay(
luts = lutData.first,
categoryOrder = lutData.second,
builtInText = builtInText,
uncategorizedText = uncategorizedText
uncategorizedText = uncategorizedText,
frequentText = frequentText,
frequentUsage = frequentUsage
)
}
@@ -42,6 +42,8 @@ import com.hinnka.mycamera.R
import com.hinnka.mycamera.data.ContentRepository
import com.hinnka.mycamera.frame.FrameInfo
import com.hinnka.mycamera.lut.BaselineColorCorrectionTarget
import com.hinnka.mycamera.lut.frequentLuts
import com.hinnka.mycamera.ui.prefs.preferenceValue
import com.hinnka.mycamera.lut.LutInfo
import com.hinnka.mycamera.model.CameraPreset
import com.hinnka.mycamera.model.LutSelectorMode
@@ -51,6 +53,7 @@ import kotlinx.coroutines.withContext
import com.hinnka.mycamera.ui.icons.AppIcons
private sealed class LutCategoryTab {
data object Frequent : LutCategoryTab()
data object Favorite : LutCategoryTab()
data object BuiltIn : LutCategoryTab()
data object Uncategorized : LutCategoryTab()
@@ -58,6 +61,7 @@ private sealed class LutCategoryTab {
}
private fun LutCategoryTab.stableKey(): String = when (this) {
LutCategoryTab.Frequent -> "fixed:frequent"
LutCategoryTab.Favorite -> "fixed:favorite"
LutCategoryTab.BuiltIn -> "fixed:built_in"
LutCategoryTab.Uncategorized -> "fixed:uncategorized"
@@ -204,6 +208,9 @@ fun LutSelector(
) {
val scrollState = rememberLazyListState()
val coroutineScope = rememberCoroutineScope()
val frequentUsage by preferenceValue { it.frequentLutUsage }
val frequentItems = remember(availableLuts, frequentUsage) { frequentLuts(availableLuts, frequentUsage) }
val frequentText = stringResource(R.string.frequent_filters)
val favoriteText = stringResource(R.string.favorite)
val builtInText = stringResource(R.string.built_in)
val uncategorizedText = stringResource(R.string.uncategorized)
@@ -213,8 +220,8 @@ fun LutSelector(
val noneText = stringResource(R.string.none)
// 分类逻辑
val categoryTabs = remember(availableLuts, categoryOrder, favoriteText, builtInText, uncategorizedText) {
val reservedCategoryNames = setOf(favoriteText, builtInText, uncategorizedText)
val categoryTabs = remember(availableLuts, categoryOrder, frequentText, favoriteText, builtInText, uncategorizedText) {
val reservedCategoryNames = setOf(frequentText, favoriteText, builtInText, uncategorizedText)
val dynamicCategories = availableLuts.map { it.category }
.distinct()
.filter { it.isNotEmpty() && it !in reservedCategoryNames }
@@ -223,6 +230,7 @@ fun LutSelector(
val remainingDynamic = dynamicCategories.filterNot { it in orderedEntries }.sorted()
buildList {
add(LutCategoryTab.Frequent)
add(LutCategoryTab.Favorite)
if (orderedEntries.isEmpty()) {
add(LutCategoryTab.BuiltIn)
@@ -244,6 +252,7 @@ fun LutSelector(
}
}
fun LutCategoryTab.contains(lut: LutInfo): Boolean = when (this) {
LutCategoryTab.Frequent -> frequentItems.any { it.id == lut.id }
LutCategoryTab.Favorite -> lut.isFavorite
LutCategoryTab.BuiltIn -> lut.isBuiltIn
LutCategoryTab.Uncategorized -> !lut.isBuiltIn && lut.category.isEmpty()
@@ -251,13 +260,14 @@ fun LutSelector(
}
fun preferredCategoryFor(lut: LutInfo): LutCategoryTab = when {
frequentItems.any { it.id == lut.id } -> LutCategoryTab.Frequent
lut.isFavorite -> LutCategoryTab.Favorite
lut.category.isNotEmpty() -> LutCategoryTab.Category(lut.category)
lut.isBuiltIn -> LutCategoryTab.BuiltIn
else -> LutCategoryTab.Uncategorized
}
var selectedCategory by remember { mutableStateOf<LutCategoryTab>(LutCategoryTab.BuiltIn) }
var selectedCategory by remember { mutableStateOf<LutCategoryTab>(LutCategoryTab.Frequent) }
val activeLutId = currentLutId
val supportsFrames = onFrameSelected != null
val supportsPresets = presetModeEnabled
@@ -267,19 +277,20 @@ fun LutSelector(
LutSelectorMode.Presets -> if (supportsPresets) LutSelectorMode.Presets else LutSelectorMode.Style
}
LaunchedEffect(activeLutId, availableLuts, categoryTabs) {
LaunchedEffect(activeLutId, availableLuts, categoryTabs, frequentItems) {
if (frequentUsage == null) return@LaunchedEffect
val selectedLut = availableLuts.find { it.id == activeLutId }
selectedCategory = when {
selectedLut != null && selectedCategory.contains(selectedLut) -> selectedCategory
selectedLut?.isFavorite == true -> LutCategoryTab.Favorite
selectedLut != null -> preferredCategoryFor(selectedLut)
selectedCategory in categoryTabs -> selectedCategory
else -> LutCategoryTab.BuiltIn
else -> LutCategoryTab.Frequent
}
}
val filteredLuts = remember(selectedCategory, availableLuts) {
val filteredLuts = remember(selectedCategory, availableLuts, frequentItems) {
when (selectedCategory) {
LutCategoryTab.Frequent -> frequentItems
LutCategoryTab.Favorite -> availableLuts.filter { it.isFavorite }
LutCategoryTab.BuiltIn -> availableLuts.filter { it.isBuiltIn }
LutCategoryTab.Uncategorized -> availableLuts.filter { !it.isBuiltIn && it.category.isEmpty() }
@@ -496,6 +507,7 @@ fun LutSelector(
items(categoryTabs, key = { it.stableKey() }) { category ->
val isSelected = selectedCategory == category
val categoryName = when (category) {
LutCategoryTab.Frequent -> frequentText
LutCategoryTab.Favorite -> favoriteText
LutCategoryTab.BuiltIn -> builtInText
LutCategoryTab.Uncategorized -> uncategorizedText
@@ -643,11 +655,11 @@ private fun LutItem(
onClick: () -> Unit,
onManageClick: (() -> Unit)? = null,
recipeTarget: BaselineColorCorrectionTarget? = null,
isNone: Boolean = false,
isCustom: Boolean = false,
modifier: Modifier = Modifier
) {
val context = LocalContext.current
val isNone = id == "none"
val itemShape = RoundedCornerShape(12.dp)
val borderColor by animateColorAsState(
targetValue = if (isSelected) AccentColor else Color.White.copy(alpha = 0.15f),
@@ -741,7 +753,7 @@ private fun LutItem(
}
if (isNone) {
Icon(
imageVector = AppIcons.FilterNone,
imageVector = AppIcons.Block,
contentDescription = null,
tint = Color.White.copy(alpha = 0.7f),
modifier = Modifier.size(24.dp)
@@ -9,6 +9,33 @@ import androidx.compose.ui.graphics.vector.group
import androidx.compose.ui.unit.dp
object AppIcons {
val Block: ImageVector
get() {
_block?.let { return it }
return ImageVector.Builder(
name = "AppIcons.Block",
defaultWidth = 24.dp,
defaultHeight = 24.dp,
viewportWidth = 24f,
viewportHeight = 24f,
).apply {
addPath(
pathData = addPathNodes(
"M12 2a10 10 0 1 0 0 20a10 10 0 1 0 0-20Z" +
"M12 4a8 8 0 1 0 0 16a8 8 0 1 0 0-16Z"
),
fill = SolidColor(Color.Black),
pathFillType = PathFillType.EvenOdd,
)
addPath(
pathData = addPathNodes("M4.93 6.34 17.66 19.07 19.07 17.66 6.34 4.93Z"),
fill = SolidColor(Color.Black),
)
}.build().also { _block = it }
}
private var _block: ImageVector? = null
val AutoMirroredArrowLeft: ImageVector
get() {
_autoMirroredArrowLeft?.let { return it }
@@ -47,6 +47,7 @@ import com.hinnka.mycamera.video.VideoLogProfile
import com.hinnka.mycamera.color.TransferCurve
import com.hinnka.mycamera.data.CustomImportManager
import com.hinnka.mycamera.data.ZipCubeImportManager
import com.hinnka.mycamera.lut.frequentLuts
import com.hinnka.mycamera.lut.LutInfo
import com.hinnka.mycamera.lut.orderedLutCategoryTitles
import com.hinnka.mycamera.raw.ColorSpace
@@ -71,11 +72,12 @@ private data class CategoryManagementItem(
private fun sanitizeCustomLutCategoryInput(
category: String,
favoriteText: String,
frequentText: String,
builtInText: String,
uncategorizedText: String
): String {
val trimmedCategory = category.trim()
return if (trimmedCategory == favoriteText || trimmedCategory == builtInText || trimmedCategory == uncategorizedText) {
return if (trimmedCategory == frequentText || trimmedCategory == favoriteText || trimmedCategory == builtInText || trimmedCategory == uncategorizedText) {
""
} else {
trimmedCategory
@@ -228,13 +230,15 @@ fun FilterManagementScreen(
// 分类管理状态
val categoryOrder by preferenceValue { it.categoryOrder }
val frequentUsage by preferenceValue { it.frequentLutUsage }
var showCategoryManagement by remember { mutableStateOf(false) }
val builtInText = stringResource(R.string.built_in)
val uncategorizedText = stringResource(R.string.uncategorized)
val favoriteText = stringResource(R.string.favorite)
val reservedCategoryNames = remember(favoriteText, builtInText, uncategorizedText) {
setOf(favoriteText, builtInText, uncategorizedText)
val frequentText = stringResource(R.string.frequent_filters)
val reservedCategoryNames = remember(frequentText, favoriteText, builtInText, uncategorizedText) {
setOf(frequentText, favoriteText, builtInText, uncategorizedText)
}
var selectedCategory by remember { mutableStateOf<String?>(null) }
@@ -245,18 +249,20 @@ fun FilterManagementScreen(
builtInText = builtInText,
uncategorizedText = uncategorizedText,
favoriteText = favoriteText,
includeEmptyCategories = true
includeEmptyCategories = true,
frequentText = frequentText
)
}
val currentTabIndex = categories.indexOf(selectedCategory).takeIf { it >= 0 } ?: 0
val currentCategory = categories[currentTabIndex]
val commonCategories = categories.filter { it !in reservedCategoryNames }
val managedCategories = categories.filter { it != favoriteText && it != uncategorizedText }
val managedCategories = categories.filter { it != frequentText && it != favoriteText && it != uncategorizedText }
LaunchedEffect(currentCategory) {
selectedIds = emptySet()
}
val filteredLutList = remember(currentCategory, localLutList, reservedCategoryNames) {
val filteredLutList = remember(currentCategory, localLutList, reservedCategoryNames, frequentUsage) {
when (currentCategory) {
frequentText -> frequentLuts(localLutList, frequentUsage)
favoriteText -> localLutList.filter { it.isFavorite }
builtInText -> localLutList.filter { it.isBuiltIn }
uncategorizedText -> localLutList.filter { !it.isBuiltIn && it.category.isEmpty() }
@@ -347,11 +353,12 @@ fun FilterManagementScreen(
// 拖拽排序状态
val reorderableLazyListState = rememberReorderableLazyListState(lazyListState) { from, to ->
if (currentCategory == frequentText) return@rememberReorderableLazyListState
val fromId = from.key as? String ?: return@rememberReorderableLazyListState
val toId = to.key as? String ?: return@rememberReorderableLazyListState
// 仅处理滤镜项的排序,忽略非滤镜项(如 import_result)
if (fromId == "import_result" || toId == "import_result") return@rememberReorderableLazyListState
if (fromId == "none" || toId == "none" || fromId == "import_result" || toId == "import_result") return@rememberReorderableLazyListState
// 在原始列表中找到这两个滤镜的位置
val fromIndexInLocal = localLutList.indexOfFirst { it.id == fromId }
@@ -760,7 +767,7 @@ fun FilterManagementScreen(
}
} else null,
showCategory = categories.getOrNull(currentTabIndex) == builtInText && lutInfo.category.isNotEmpty(),
dragModifier = if (isSelectionMode) Modifier else Modifier.draggableHandle()
dragModifier = if (isSelectionMode || currentCategory == frequentText || lutInfo.id == "none") null else Modifier.draggableHandle()
)
}
}
@@ -1134,6 +1141,7 @@ fun FilterManagementScreen(
val sanitizedCategory = sanitizeCustomLutCategoryInput(
category = categoryText,
favoriteText = favoriteText,
frequentText = frequentText,
builtInText = builtInText,
uncategorizedText = uncategorizedText
)
@@ -1323,6 +1331,7 @@ fun FilterManagementScreen(
val targetCategory = sanitizeCustomLutCategoryInput(
category = categoryText,
favoriteText = favoriteText,
frequentText = frequentText,
builtInText = builtInText,
uncategorizedText = uncategorizedText
)
@@ -1507,8 +1516,9 @@ private fun CategoryManagementSheet(
val builtInText = stringResource(R.string.built_in)
val uncategorizedText = stringResource(R.string.uncategorized)
val favoriteText = stringResource(R.string.favorite)
val fixedNames = remember(builtInText, uncategorizedText, favoriteText) {
setOf(builtInText, uncategorizedText, favoriteText)
val frequentText = stringResource(R.string.frequent_filters)
val fixedNames = remember(builtInText, uncategorizedText, favoriteText, frequentText) {
setOf(builtInText, uncategorizedText, favoriteText, frequentText)
}
var localCategories by remember(categories, fixedNames) {
@@ -1780,7 +1790,7 @@ private fun FilterManagementItem(
onEditCategory: (() -> Unit)? = null,
onToggleFavorite: (() -> Unit)? = null,
showCategory: Boolean = false,
dragModifier: Modifier = Modifier,
dragModifier: Modifier? = null,
modifier: Modifier = Modifier
) {
val borderColor = when {
@@ -1820,7 +1830,7 @@ private fun FilterManagementItem(
),
modifier = Modifier.padding(4.dp)
)
} else {
} else if (dragModifier != null) {
Box(
modifier = Modifier
.padding(horizontal = 4.dp)
@@ -42,6 +42,7 @@ import com.hinnka.mycamera.lut.BaselineColorCorrectionTarget
import com.hinnka.mycamera.lut.BakedLutExporter
import com.hinnka.mycamera.lut.LutConfig
import com.hinnka.mycamera.lut.LutConverter
import com.hinnka.mycamera.lut.sortLutsByUserOrder
import com.hinnka.mycamera.lut.LutInfo
import com.hinnka.mycamera.lut.creator.LutGenerator
import com.hinnka.mycamera.model.CameraPreset
@@ -1705,6 +1706,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
image.close()
} else {
burstImageCount++
contentRepository.recordLutCapture(settings.lutId)
CaptureProcessingQueue.enqueue(listOf(image)) {
val context = getApplication<Application>()
if (GalleryManager.loadMetadata(context, photoId) == null) {
@@ -1754,6 +1756,8 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
if (settings == null) {
photo.frames.forEach { it.image.close() }
} else {
// 每次完成的拍摄仅计一次,HDR / 多帧合成不按输入帧数累加。
contentRepository.recordLutCapture(settings.lutId)
val shotSettings = settings
shotSettings.state = photo.state
if (photo.state.useLivePhoto) {
@@ -1990,12 +1994,7 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
contentRepository.availableLuts.combine(
userPreferencesRepository.userPreferences.map { it.filterOrder }
) { luts, order ->
if (order.isEmpty()) {
luts
} else {
val orderMap = order.withIndex().associate { it.value to it.index }
luts.sortedBy { orderMap[it.id] ?: Int.MAX_VALUE }
}
sortLutsByUserOrder(luts, order)
}.collect { sortedLuts ->
availableLutList = sortedLuts
}
@@ -3319,7 +3318,9 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
vibrationHelper.vibrate()
}
val capturedLutId = currentLutId.value
glSurfaceView?.capturePreviewFrame { bitmap ->
contentRepository.recordLutCapture(capturedLutId)
viewModelScope.launch {
saveVideoSnapshot(bitmap)
}
@@ -32,6 +32,7 @@ import com.hinnka.mycamera.hdr.HdrGainmapStrength
import com.hinnka.mycamera.hdr.UnifiedGainmapProducer
import com.hinnka.mycamera.lut.BaselineColorCorrectionTarget
import com.hinnka.mycamera.lut.LutConfig
import com.hinnka.mycamera.lut.sortLutsByUserOrder
import com.hinnka.mycamera.lut.LutInfo
import com.hinnka.mycamera.lut.PhotoTransformation
import com.hinnka.mycamera.lut.VideoExportOption
@@ -911,12 +912,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
contentRepository.availableLuts.combine(
userPreferencesRepository.userPreferences.map { it.filterOrder }
) { luts, order ->
if (order.isEmpty()) {
luts
} else {
val orderMap = order.withIndex().associate { it.value to it.index }
luts.sortedBy { orderMap[it.id] ?: Int.MAX_VALUE }
}
sortLutsByUserOrder(luts, order)
}.collect { sortedLuts ->
availableLuts = sortedLuts
}
@@ -1440,4 +1440,5 @@
<string name="settings_video_input_yuv">應用程式處理</string>
<string name="settings_video_nr_yuv_description">應用程式處理不支援高品質降噪;原設定為高品質時,改用快速模式。</string>
<string name="settings_oppo_super_stabilization_yuv_disabled">應用程式處理下無法使用,切換至系統處理後可使用超級防震。</string>
<string name="frequent_filters">常用</string>
</resources>
+1
View File
@@ -487,4 +487,5 @@
<string name="fotufilm_value_years">%1$s J.</string>
<!-- /Fotufilm controls -->
<string name="save_as_preset">Als Preset speichern</string>
<string name="frequent_filters">Häufig</string>
</resources>
+1
View File
@@ -1471,4 +1471,5 @@
<string name="aesthetic_show_in_gallery">Afficher les scores dans la galerie</string>
<string name="aesthetic_show_in_gallery_description">Évalue les photos en arrière-plan pendant la navigation.</string>
<string name="aesthetic_note">Évalué par un modèle esthétique CLIP sur l\'appareil (LAION Aesthetic Predictor), entraîné sur un grand nombre de notes humaines. Il reflète l\'attrait visuel général plutôt que l\'intention artistique : à utiliser comme référence.</string>
<string name="frequent_filters">Fréquents</string>
</resources>
+1
View File
@@ -487,4 +487,5 @@
<string name="fotufilm_value_years">%1$s thn</string>
<!-- /Fotufilm controls -->
<string name="save_as_preset">Simpan sebagai preset</string>
<string name="frequent_filters">Sering digunakan</string>
</resources>
+1
View File
@@ -1326,4 +1326,5 @@
<string name="aesthetic_show_in_gallery">ギャラリーにスコアを表示</string>
<string name="aesthetic_show_in_gallery_description">閲覧中にバックグラウンドで写真を評価します。</string>
<string name="aesthetic_note">端末上の CLIP 美的モデル(LAION Aesthetic Predictor)による評価で、大規模な人間の評価データで学習されています。芸術的意図ではなく一般的な見た目の魅力を反映するため、参考としてご利用ください。</string>
<string name="frequent_filters">よく使う</string>
</resources>
+1
View File
@@ -488,4 +488,5 @@
<string name="fotufilm_value_years">%1$s년</string>
<!-- /Fotufilm controls -->
<string name="save_as_preset">프리셋으로 저장</string>
<string name="frequent_filters">자주 사용</string>
</resources>
@@ -488,4 +488,5 @@
<string name="fotufilm_value_years">%1$s anos</string>
<!-- /Fotufilm controls -->
<string name="save_as_preset">Salvar como predefinição</string>
<string name="frequent_filters">Frequentes</string>
</resources>
+1
View File
@@ -1108,4 +1108,5 @@
<string name="aesthetic_show_in_gallery">แสดงคะแนนในแกลเลอรี</string>
<string name="aesthetic_show_in_gallery_description">ให้คะแนนรูปภาพในพื้นหลังขณะเลื่อนดู</string>
<string name="aesthetic_note">ให้คะแนนโดยโมเดลความสวยงาม CLIP บนอุปกรณ์ (LAION Aesthetic Predictor) ที่ฝึกจากคะแนนของมนุษย์จำนวนมาก สะท้อนความน่าดึงดูดทางสายตาโดยทั่วไป ไม่ใช่เจตนาทางศิลปะ ควรใช้เป็นข้อมูลอ้างอิงเท่านั้น</string>
<string name="frequent_filters">ใช้บ่อย</string>
</resources>
@@ -1496,4 +1496,5 @@
<string name="settings_video_input_yuv">应用处理</string>
<string name="settings_video_nr_yuv_description">应用处理不支持高质量降噪;原设置为高质量时,改用快速模式。</string>
<string name="settings_oppo_super_stabilization_yuv_disabled">应用处理下不可用,切换至系统处理后可使用超级防抖。</string>
<string name="frequent_filters">常用</string>
</resources>
@@ -1434,4 +1434,5 @@
<string name="settings_video_input_yuv">應用程式處理</string>
<string name="settings_video_nr_yuv_description">應用程式處理不支援高品質降噪;原設定為高品質時,改用快速模式。</string>
<string name="settings_oppo_super_stabilization_yuv_disabled">應用程式處理下無法使用,切換至系統處理後可使用超級防震。</string>
<string name="frequent_filters">常用</string>
</resources>
@@ -1440,4 +1440,5 @@
<string name="settings_video_input_yuv">應用程式處理</string>
<string name="settings_video_nr_yuv_description">應用程式處理不支援高品質降噪;原設定為高品質時,改用快速模式。</string>
<string name="settings_oppo_super_stabilization_yuv_disabled">應用程式處理下無法使用,切換至系統處理後可使用超級防震。</string>
<string name="frequent_filters">常用</string>
</resources>
+1
View File
@@ -1521,4 +1521,5 @@
<string name="settings_video_input_yuv">App processing</string>
<string name="settings_video_nr_yuv_description">App processing does not support High quality noise reduction. Fast is used instead when High quality is selected.</string>
<string name="settings_oppo_super_stabilization_yuv_disabled">Unavailable with App processing. Switch to System processing to use Ultra Steady.</string>
<string name="frequent_filters">Frequent</string>
</resources>