From 1ea11ab176371efefaea77201f3a19772078c6cb Mon Sep 17 00:00:00 2001 From: zhoubinjia Date: Tue, 20 Jan 2026 15:52:17 +0800 Subject: [PATCH] feat: donate --- TODO.md | 2 +- .../mycamera/ui/gallery/PhotoEditScreen.kt | 12 +++++++ .../mycamera/ui/settings/SettingsScreen.kt | 35 +++++++++++++++++++ app/src/main/res/values-zh/strings.xml | 5 +++ app/src/main/res/values/strings.xml | 5 +++ 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 97269f5b..b1609ae3 100644 --- a/TODO.md +++ b/TODO.md @@ -22,7 +22,7 @@ - [x] 摄像头方向修正 - [x] 水印 LOGO 缺少 - [x] 焦段多余 -- [ ] 捐赠入口 +- [x] 捐赠入口 - [ ] 双指缩放调整焦段 - [ ] AI构图 - [ ] 视频拍摄 diff --git a/app/src/main/java/com/hinnka/mycamera/ui/gallery/PhotoEditScreen.kt b/app/src/main/java/com/hinnka/mycamera/ui/gallery/PhotoEditScreen.kt index 8c6017f5..b52d2406 100644 --- a/app/src/main/java/com/hinnka/mycamera/ui/gallery/PhotoEditScreen.kt +++ b/app/src/main/java/com/hinnka/mycamera/ui/gallery/PhotoEditScreen.kt @@ -71,6 +71,7 @@ fun PhotoEditScreen( val editLutConfig = viewModel.editLutConfig val availableLuts = viewModel.availableLuts val showPaymentDialog = viewModel.showPaymentDialog + val isPurchased by viewModel.isPurchased.collectAsState() var isSaving by remember { mutableStateOf(false) } var showExportDialog by remember { mutableStateOf(false) } @@ -174,6 +175,11 @@ fun PhotoEditScreen( // 保存元数据按钮 IconButton( onClick = { + val currentLut = availableLuts.find { it.id == editLutId } + if (currentLut?.isVip == true && !isPurchased) { + viewModel.showPaymentDialog = true + return@IconButton + } isSaving = true viewModel.saveEditMetadata(currentPhoto) { success -> isSaving = false @@ -456,6 +462,12 @@ fun PhotoEditScreen( confirmButton = { TextButton( onClick = { + val currentLut = availableLuts.find { it.id == editLutId } + if (currentLut?.isVip == true && !isPurchased) { + showExportDialog = false + viewModel.showPaymentDialog = true + return@TextButton + } showExportDialog = false isSaving = true viewModel.saveEdit(currentPhoto) { success -> diff --git a/app/src/main/java/com/hinnka/mycamera/ui/settings/SettingsScreen.kt b/app/src/main/java/com/hinnka/mycamera/ui/settings/SettingsScreen.kt index a5a187ec..1690fa89 100644 --- a/app/src/main/java/com/hinnka/mycamera/ui/settings/SettingsScreen.kt +++ b/app/src/main/java/com/hinnka/mycamera/ui/settings/SettingsScreen.kt @@ -33,6 +33,8 @@ 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 android.content.Intent +import android.net.Uri import com.hinnka.mycamera.R import com.hinnka.mycamera.camera.AspectRatio import com.hinnka.mycamera.frame.FrameInfo @@ -361,6 +363,39 @@ fun SettingsScreen( } } + Spacer(modifier = Modifier.height(24.dp)) + + // 关于 + SettingsSection(title = stringResource(R.string.settings_section_about)) { + NavigationSettingItem( + title = stringResource(R.string.settings_donation), + description = stringResource(R.string.settings_donation_description), + onClick = { + val qrCodeUrl = "https://qr.alipay.com/fkx103287mz2sqvs1esdh30" + val alipayUrl = "alipays://platformapi/startapp?saId=10000007&clientVersion=3.7.0.0718&qrcode=${ + java.net.URLEncoder.encode( + qrCodeUrl, + "UTF-8" + ) + }" + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(alipayUrl)) + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + try { + context.startActivity(intent) + } catch (e: Exception) { + // 如果没安装支付宝,则尝试用浏览器打开 + val webIntent = Intent(Intent.ACTION_VIEW, Uri.parse(qrCodeUrl)) + webIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + try { + context.startActivity(webIntent) + } catch (e2: Exception) { + // 处理浏览器也没有的情况(极少见) + } + } + } + ) + } + Spacer(modifier = Modifier.height(32.dp)) } } diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 18f4feac..014c75ab 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -254,4 +254,9 @@ 前置摄像头 摄像头 当前摄像头 + + + 关于 + 捐赠 + 支持 Photon Camera 的持续开发 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e95bbab1..38777123 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -255,4 +255,9 @@ Front Camera Camera Current Camera + + + About + Donation + Support the development of Photon Camera \ No newline at end of file