yayacal/app/src/main/kotlin/plus/rua/project/CameraActivity.kt
xfy 8963b6162b feat(date-recorder): photo journal tool with camera, editor, and album grid
新增"日期记录器"工具:相册式记录管理,支持拍照→编辑→记录信息的完整流程。

数据层:
- Room 2.8.4 首个数据库(KSP 2.3.10),DateRecord 实体含标题/备注/拍摄日期/关联日期
- DateRecordConverters 处理 kotlinx-datetime ↔ ISO 字符串
- DateRecorderRepository 封装 DAO + filesDir 照片文件管理

UI 层:
- CameraScreen: CameraX 1.5.3 应用内预览,运行时权限请求,前后摄切换
- PhotoEditorScreen: 纯 Compose 自实现旋转/裁剪/手写三 Tab 编辑器
- DateRecorderScreen: LazyVerticalGrid 相册网格 + 多选 + 6 种排序 + 批量删除
- RecordEditScreen / RecordDetailScreen: 记录信息编辑与详情查看

基础设施:
- CAMERA 权限 + FileProvider(filesDir 存储,免存储权限)
- 5 个 Activity 延续项目 Activity+Intent 滑动转场模式
- 2 个单测:排序逻辑 6 种组合 + 降采样计算
2026-07-17 13:21:45 +08:00

37 lines
1.2 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package plus.rua.project
import android.content.Intent
import android.os.Bundle
import androidx.activity.compose.setContent
import plus.rua.project.ui.CameraScreen
import plus.rua.project.ui.DateRecorderNav
import plus.rua.project.ui.theme.YaYaTheme
/**
* 相机拍摄页 Activity。
*
* 拍照成功后把临时照片路径透传给记录编辑页M3 之后会先经过编辑器页)。
*/
class CameraActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
YaYaTheme {
CameraScreen(
onBack = { finishWithSlideBack() },
onPhotoCaptured = { tempPath ->
// 拍照后先进入编辑器,编辑完成后再进入记录编辑页
startActivityWithSlide(
Intent(this, PhotoEditorActivity::class.java).apply {
putExtra(DateRecorderNav.EXTRA_TEMP_PHOTO_PATH, tempPath)
}
)
finishWithSlideBack()
}
)
}
}
}
}