feat: implement splash screen and coordinate initialization state

This commit is contained in:
zhoubinjia committed 2026-05-08 19:41:11 +08:00
1 parent 146b89d9f4
commit f7abc4055d
31 files changed
+481 -313

No files matched your search

+1
View File
@@ -201,6 +201,7 @@ dependencies {
implementation("androidx.datastore:datastore-preferences:1.0.0")
implementation(libs.androidx.animation.core)
implementation(libs.androidx.lifecycle.process)
implementation(libs.androidx.core.splashscreen)
implementation(libs.okhttp)
implementation(libs.gson)
+1 -1
View File
@@ -40,7 +40,7 @@
android:screenOrientation="portrait"
android:configChanges="orientation|screenSize|screenLayout|keyboardHidden"
android:launchMode="singleTask"
android:theme="@style/Theme.MyCamera">
android:theme="@style/Theme.MyCamera.Splash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 14 KiB

@@ -2,16 +2,16 @@ package com.hinnka.mycamera
import android.Manifest
import android.content.Intent
import android.net.Uri
import android.content.pm.ActivityInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
import android.view.KeyEvent
import androidx.activity.ComponentActivity
import androidx.activity.SystemBarStyle
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.SystemBarStyle
import androidx.activity.result.contract.ActivityResultContracts
import androidx.activity.viewModels
import androidx.compose.animation.fadeIn
@@ -48,6 +48,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.core.content.ContextCompat
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
@@ -60,30 +61,30 @@ import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import com.hinnka.mycamera.camera.AspectRatio
import com.hinnka.mycamera.gallery.GalleryManager
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.settings.PhantomPipCropScreen
import com.hinnka.mycamera.ui.camera.CameraScreen
import com.hinnka.mycamera.ui.gallery.BurstDetailScreen
import com.hinnka.mycamera.ui.gallery.GalleryScreen
import com.hinnka.mycamera.ui.gallery.GalleryDetailScreen
import com.hinnka.mycamera.ui.gallery.GalleryScreen
import com.hinnka.mycamera.ui.gallery.PhotoEditScreen
import com.hinnka.mycamera.ui.settings.FilterManagementScreen
import com.hinnka.mycamera.ui.settings.FrameEditorScreen
import com.hinnka.mycamera.ui.settings.FrameManagementScreen
import com.hinnka.mycamera.ui.settings.PhantomPipCropScreen
import com.hinnka.mycamera.ui.settings.SettingsScreen
import com.hinnka.mycamera.ui.theme.PhotonCameraTheme
import com.hinnka.mycamera.update.AppUpdateManager
import com.hinnka.mycamera.utils.BuglyHelper
import com.hinnka.mycamera.utils.DeviceUtil
import com.hinnka.mycamera.utils.OrientationObserver
import com.hinnka.mycamera.utils.PLog
import com.hinnka.mycamera.utils.StartupTrace
import com.hinnka.mycamera.viewmodel.CameraViewModel
import com.hinnka.mycamera.viewmodel.GalleryTab
import com.hinnka.mycamera.viewmodel.GalleryViewModel
import com.hinnka.mycamera.lut.creator.LutCreatorScreen
import com.hinnka.mycamera.lut.creator.LutCreatorViewModel
import com.hinnka.mycamera.utils.DeviceUtil
import com.hinnka.mycamera.gallery.GalleryManager
import com.hinnka.mycamera.utils.PLog
import com.hinnka.mycamera.utils.StartupTrace
/**
* 路由常量
@@ -150,6 +151,7 @@ class MainActivity : ComponentActivity() {
}
override fun onCreate(savedInstanceState: Bundle?) {
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
StartupTrace.mark("MainActivity.onCreate start")
@@ -181,6 +183,12 @@ class MainActivity : ComponentActivity() {
handleIntent(intent)
StartupTrace.mark("MainActivity.intent handled", "pendingRoute=$pendingRoute")
splashScreen.setKeepOnScreenCondition {
val cameraInitialized = cameraViewModel.isInitialized.value
val galleryInitialized = galleryViewModel.isInitialized.value
!(cameraInitialized && galleryInitialized)
}
StartupTrace.mark("MainActivity.setContent start")
setContent {
@@ -201,6 +209,15 @@ class MainActivity : ComponentActivity() {
color = Color.Black
) {
Box(modifier = Modifier.fillMaxSize()) {
val cameraInitialized by cameraViewModel.isInitialized.collectAsState()
val galleryInitialized by galleryViewModel.isInitialized.collectAsState()
LaunchedEffect(cameraInitialized, galleryInitialized) {
if (cameraInitialized && galleryInitialized) {
cameraViewModel.onShutterAnimationTriggered()
}
}
if (hasPermissions) {
NavigationHost(
cameraViewModel = cameraViewModel,
@@ -217,6 +234,7 @@ class MainActivity : ComponentActivity() {
}
)
}
AppUpdateInstallPrompt()
}
}
@@ -2371,31 +2371,31 @@ object GalleryManager {
}
if (metadata.mediaType == MediaType.VIDEO) {
val sourceUri = metadata.sourceUri?.let(Uri::parse) ?: return@withContext null
val info = readVideoRecordInfo(context, sourceUri)
// val info = readVideoRecordInfo(context, sourceUri)
val id = photoId
val resolvedWidth = info?.width ?: metadata.videoWidth ?: metadata.width
val resolvedHeight = info?.height ?: metadata.videoHeight ?: metadata.height
val resolvedDurationMs = info?.durationMs ?: metadata.durationMs
val resolvedMimeType = info?.mimeType ?: metadata.mimeType
val resolvedWidth = metadata.videoWidth ?: metadata.width
val resolvedHeight = metadata.videoHeight ?: metadata.height
val resolvedDurationMs = metadata.durationMs
val resolvedMimeType = metadata.mimeType
val resolvedMetadata = metadata.copy(
width = resolvedWidth,
height = resolvedHeight,
mimeType = resolvedMimeType,
durationMs = resolvedDurationMs,
frameRate = info?.frameRate ?: metadata.frameRate,
bitrate = info?.bitrate ?: metadata.bitrate,
rotationDegrees = info?.rotationDegrees ?: metadata.rotationDegrees,
hasAudio = info?.hasAudio ?: metadata.hasAudio,
frameRate = metadata.frameRate,
bitrate = metadata.bitrate,
rotationDegrees = metadata.rotationDegrees,
hasAudio = metadata.hasAudio,
videoWidth = resolvedWidth,
videoHeight = resolvedHeight
)
return@withContext MediaData(
val result = MediaData(
id = id,
uri = sourceUri,
thumbnailUri = thumbnailUri,
displayName = info?.displayName ?: (sourceUri.lastPathSegment ?: "video_$id"),
dateAdded = info?.dateTaken ?: metadata.dateTaken ?: getPhotoDir(context, id).lastModified(),
size = info?.size ?: 0L,
displayName = (sourceUri.lastPathSegment ?: "video_$id"),
dateAdded = metadata.dateTaken ?: getPhotoDir(context, id).lastModified(),
size = 0L,
width = resolvedWidth,
height = resolvedHeight,
mediaType = MediaType.VIDEO,
@@ -2404,14 +2404,17 @@ object GalleryManager {
sourceUri = sourceUri,
metadata = resolvedMetadata
)
return@withContext result
}
val photoFile = getPhotoFile(context, photoId)
val originalFile = getDngFile(context, photoId).takeIf { it.exists() } ?: getYuvFile(context, photoId).takeIf { it.exists() } ?: photoFile
if (!photoFile.exists()) return@withContext null
val videoFile = getVideoFile(context, photoId)
val isBurstPhoto = hasBurstPhotos(context, photoId)
MediaData(
val result = MediaData(
id = photoId,
uri = Uri.fromFile(photoFile),
thumbnailUri = thumbnailUri,
@@ -2427,6 +2430,7 @@ object GalleryManager {
isBurstPhoto = isBurstPhoto,
metadata = metadata
)
return@withContext result
}
fun loadYuvData(context: Context, photoId: String): ByteBuffer? {
@@ -10,6 +10,8 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Mutex
import kotlinx.coroutines.sync.withLock
import kotlinx.coroutines.withContext
/**
@@ -18,6 +20,10 @@ import kotlinx.coroutines.withContext
*/
class GalleryRepository(private val context: Context) {
private val queryPhotosMutex = Mutex()
private val querySystemPhotosMutex = Mutex()
private val querySystemVideosMutex = Mutex()
companion object {
private const val TAG = "GalleryRepository"
}
@@ -108,13 +114,13 @@ class GalleryRepository(private val context: Context) {
fallbackItems
}
private fun queryAllSystemPhotosByPages(pageSize: Int = 200): List<MediaData> {
private suspend fun queryAllSystemPhotosByPages(pageSize: Int = 200): List<MediaData> {
val imageItems = querySystemImagesByPages(pageSize)
val videoItems = querySystemVideosByPages(pageSize)
return (imageItems + videoItems).sortedByDescending { it.dateAdded }
}
private fun querySystemImagesByPages(pageSize: Int): List<MediaData> {
private suspend fun querySystemImagesByPages(pageSize: Int): List<MediaData> {
val items = mutableListOf<MediaData>()
var offset = 0
while (true) {
@@ -128,7 +134,7 @@ class GalleryRepository(private val context: Context) {
return items
}
private fun querySystemVideosByPages(pageSize: Int): List<MediaData> {
private suspend fun querySystemVideosByPages(pageSize: Int): List<MediaData> {
val items = mutableListOf<MediaData>()
var offset = 0
while (true) {
@@ -146,192 +152,199 @@ class GalleryRepository(private val context: Context) {
* 查询私有存储中的照片
*/
private suspend fun queryPhotos(offset: Int = 0, limit: Int = Int.MAX_VALUE): List<MediaData> {
return GalleryManager.getPhotoIds(context)
.mapNotNull { GalleryManager.buildPhotoData(context, it) }
.sortedByDescending { it.dateAdded }
.drop(offset)
.take(limit)
StartupTrace.mark("queryPhotos limit=$limit")
return queryPhotosMutex.withLock {
val ids = GalleryManager.getPhotoIds(context)
val photos = ids.mapNotNull { GalleryManager.buildPhotoData(context, it) }
val sorted = photos.sortedByDescending { it.dateAdded }
val result = sorted.drop(offset).take(limit)
result
}
}
private fun querySystemImages(offset: Int = 0, limit: Int? = null): List<MediaData> {
val items = mutableListOf<MediaData>()
val projection = arrayOf(
MediaStore.Images.Media._ID,
MediaStore.Images.Media.DISPLAY_NAME,
MediaStore.Images.Media.DATE_TAKEN,
MediaStore.Images.Media.DATE_ADDED,
MediaStore.Images.Media.SIZE,
MediaStore.Images.Media.WIDTH,
MediaStore.Images.Media.HEIGHT,
MediaStore.Images.Media.MIME_TYPE
)
val cursor = if (limit != null || offset > 0) {
val queryArgs = android.os.Bundle().apply {
putInt(android.content.ContentResolver.QUERY_ARG_OFFSET, offset)
limit?.let { putInt(android.content.ContentResolver.QUERY_ARG_LIMIT, it) }
putString(
android.content.ContentResolver.QUERY_ARG_SQL_SORT_ORDER,
private suspend fun querySystemImages(offset: Int = 0, limit: Int? = null): List<MediaData> {
return querySystemPhotosMutex.withLock {
val items = mutableListOf<MediaData>()
val projection = arrayOf(
MediaStore.Images.Media._ID,
MediaStore.Images.Media.DISPLAY_NAME,
MediaStore.Images.Media.DATE_TAKEN,
MediaStore.Images.Media.DATE_ADDED,
MediaStore.Images.Media.SIZE,
MediaStore.Images.Media.WIDTH,
MediaStore.Images.Media.HEIGHT,
MediaStore.Images.Media.MIME_TYPE
)
val cursor = if (limit != null || offset > 0) {
val queryArgs = android.os.Bundle().apply {
putInt(android.content.ContentResolver.QUERY_ARG_OFFSET, offset)
limit?.let { putInt(android.content.ContentResolver.QUERY_ARG_LIMIT, it) }
putString(
android.content.ContentResolver.QUERY_ARG_SQL_SORT_ORDER,
"${MediaStore.Images.Media.DATE_ADDED} DESC"
)
}
context.contentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, queryArgs, null)
} else {
context.contentResolver.query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
projection,
null,
null,
"${MediaStore.Images.Media.DATE_ADDED} DESC"
)
}
context.contentResolver.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, projection, queryArgs, null)
} else {
context.contentResolver.query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
projection,
null,
null,
"${MediaStore.Images.Media.DATE_ADDED} DESC"
)
}
cursor
?.use { cursor ->
PLog.d(TAG, "querySystemImages offset=$offset limit=$limit cursorCount=${cursor.count}")
val idColumn = cursor.getColumnIndex(MediaStore.Images.Media._ID)
if (idColumn < 0) {
PLog.e(TAG, "querySystemImages missing required _ID column")
return@use
}
val nameColumn = cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME)
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN)
val dateColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_ADDED)
val sizeColumn = cursor.getColumnIndex(MediaStore.Images.Media.SIZE)
val widthColumn = cursor.getColumnIndex(MediaStore.Images.Media.WIDTH)
val heightColumn = cursor.getColumnIndex(MediaStore.Images.Media.HEIGHT)
val mimeColumn = cursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE)
cursor
?.use { cursor ->
PLog.d(TAG, "querySystemImages offset=$offset limit=$limit cursorCount=${cursor.count}")
val idColumn = cursor.getColumnIndex(MediaStore.Images.Media._ID)
if (idColumn < 0) {
PLog.e(TAG, "querySystemImages missing required _ID column")
return@use
}
val nameColumn = cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME)
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN)
val dateColumn = cursor.getColumnIndex(MediaStore.Images.Media.DATE_ADDED)
val sizeColumn = cursor.getColumnIndex(MediaStore.Images.Media.SIZE)
val widthColumn = cursor.getColumnIndex(MediaStore.Images.Media.WIDTH)
val heightColumn = cursor.getColumnIndex(MediaStore.Images.Media.HEIGHT)
val mimeColumn = cursor.getColumnIndex(MediaStore.Images.Media.MIME_TYPE)
while (cursor.moveToNext()) {
try {
val id = cursor.getLong(idColumn)
val contentUri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id)
val displayDate = resolveSystemMediaDate(
dateTakenMillis = cursor.getOptionalLong(dateTakenColumn),
dateAddedSeconds = cursor.getOptionalLong(dateColumn),
mediaId = "image_$id"
)
items.add(
MediaData(
id = "image_$id",
uri = contentUri,
thumbnailUri = contentUri,
displayName = cursor.getOptionalString(nameColumn) ?: "image_$id",
dateAdded = displayDate,
size = cursor.getOptionalLong(sizeColumn),
width = cursor.getOptionalInt(widthColumn),
height = cursor.getOptionalInt(heightColumn),
mediaType = MediaType.IMAGE,
mimeType = cursor.getOptionalString(mimeColumn),
sourceUri = contentUri
while (cursor.moveToNext()) {
try {
val id = cursor.getLong(idColumn)
val contentUri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id)
val displayDate = resolveSystemMediaDate(
dateTakenMillis = cursor.getOptionalLong(dateTakenColumn),
dateAddedSeconds = cursor.getOptionalLong(dateColumn),
mediaId = "image_$id"
)
)
} catch (e: Exception) {
PLog.e(TAG, "Failed to build system image item, skipping", e)
items.add(
MediaData(
id = "image_$id",
uri = contentUri,
thumbnailUri = contentUri,
displayName = cursor.getOptionalString(nameColumn) ?: "image_$id",
dateAdded = displayDate,
size = cursor.getOptionalLong(sizeColumn),
width = cursor.getOptionalInt(widthColumn),
height = cursor.getOptionalInt(heightColumn),
mediaType = MediaType.IMAGE,
mimeType = cursor.getOptionalString(mimeColumn),
sourceUri = contentUri
)
)
} catch (e: Exception) {
PLog.e(TAG, "Failed to build system image item, skipping", e)
}
}
}
}
return items
items
}
}
private fun querySystemVideos(offset: Int = 0, limit: Int? = null): List<MediaData> {
val items = mutableListOf<MediaData>()
val projection = arrayOf(
MediaStore.Video.Media._ID,
MediaStore.Video.Media.DISPLAY_NAME,
MediaStore.Video.Media.DATE_TAKEN,
MediaStore.Video.Media.DATE_ADDED,
MediaStore.Video.Media.SIZE,
MediaStore.Video.Media.WIDTH,
MediaStore.Video.Media.HEIGHT,
MediaStore.Video.Media.ORIENTATION,
MediaStore.Video.Media.MIME_TYPE,
MediaStore.Video.Media.DURATION
)
val cursor = if (limit != null || offset > 0) {
val queryArgs = android.os.Bundle().apply {
putInt(android.content.ContentResolver.QUERY_ARG_OFFSET, offset)
limit?.let { putInt(android.content.ContentResolver.QUERY_ARG_LIMIT, it) }
putString(
android.content.ContentResolver.QUERY_ARG_SQL_SORT_ORDER,
private suspend fun querySystemVideos(offset: Int = 0, limit: Int? = null): List<MediaData> {
return querySystemVideosMutex.withLock {
val items = mutableListOf<MediaData>()
val projection = arrayOf(
MediaStore.Video.Media._ID,
MediaStore.Video.Media.DISPLAY_NAME,
MediaStore.Video.Media.DATE_TAKEN,
MediaStore.Video.Media.DATE_ADDED,
MediaStore.Video.Media.SIZE,
MediaStore.Video.Media.WIDTH,
MediaStore.Video.Media.HEIGHT,
MediaStore.Video.Media.ORIENTATION,
MediaStore.Video.Media.MIME_TYPE,
MediaStore.Video.Media.DURATION
)
val cursor = if (limit != null || offset > 0) {
val queryArgs = android.os.Bundle().apply {
putInt(android.content.ContentResolver.QUERY_ARG_OFFSET, offset)
limit?.let { putInt(android.content.ContentResolver.QUERY_ARG_LIMIT, it) }
putString(
android.content.ContentResolver.QUERY_ARG_SQL_SORT_ORDER,
"${MediaStore.Video.Media.DATE_ADDED} DESC"
)
}
context.contentResolver.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, queryArgs, null)
} else {
context.contentResolver.query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
projection,
null,
null,
"${MediaStore.Video.Media.DATE_ADDED} DESC"
)
}
context.contentResolver.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, projection, queryArgs, null)
} else {
context.contentResolver.query(
MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
projection,
null,
null,
"${MediaStore.Video.Media.DATE_ADDED} DESC"
)
}
cursor
?.use { cursor ->
PLog.d(TAG, "querySystemVideos offset=$offset limit=$limit cursorCount=${cursor.count}")
val idColumn = cursor.getColumnIndex(MediaStore.Video.Media._ID)
if (idColumn < 0) {
PLog.e(TAG, "querySystemVideos missing required _ID column")
return@use
}
val nameColumn = cursor.getColumnIndex(MediaStore.Video.Media.DISPLAY_NAME)
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Video.Media.DATE_TAKEN)
val dateColumn = cursor.getColumnIndex(MediaStore.Video.Media.DATE_ADDED)
val sizeColumn = cursor.getColumnIndex(MediaStore.Video.Media.SIZE)
val widthColumn = cursor.getColumnIndex(MediaStore.Video.Media.WIDTH)
val heightColumn = cursor.getColumnIndex(MediaStore.Video.Media.HEIGHT)
val orientationColumn = cursor.getColumnIndex(MediaStore.Video.Media.ORIENTATION)
val mimeColumn = cursor.getColumnIndex(MediaStore.Video.Media.MIME_TYPE)
val durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION)
cursor
?.use { cursor ->
PLog.d(TAG, "querySystemVideos offset=$offset limit=$limit cursorCount=${cursor.count}")
val idColumn = cursor.getColumnIndex(MediaStore.Video.Media._ID)
if (idColumn < 0) {
PLog.e(TAG, "querySystemVideos missing required _ID column")
return@use
}
val nameColumn = cursor.getColumnIndex(MediaStore.Video.Media.DISPLAY_NAME)
val dateTakenColumn = cursor.getColumnIndex(MediaStore.Video.Media.DATE_TAKEN)
val dateColumn = cursor.getColumnIndex(MediaStore.Video.Media.DATE_ADDED)
val sizeColumn = cursor.getColumnIndex(MediaStore.Video.Media.SIZE)
val widthColumn = cursor.getColumnIndex(MediaStore.Video.Media.WIDTH)
val heightColumn = cursor.getColumnIndex(MediaStore.Video.Media.HEIGHT)
val orientationColumn = cursor.getColumnIndex(MediaStore.Video.Media.ORIENTATION)
val mimeColumn = cursor.getColumnIndex(MediaStore.Video.Media.MIME_TYPE)
val durationColumn = cursor.getColumnIndex(MediaStore.Video.Media.DURATION)
while (cursor.moveToNext()) {
try {
val id = cursor.getLong(idColumn)
val contentUri = ContentUris.withAppendedId(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, id)
val mimeType = cursor.getOptionalString(mimeColumn)
val durationMs = cursor.getOptionalLong(durationColumn)
val displayDate = resolveSystemMediaDate(
dateTakenMillis = cursor.getOptionalLong(dateTakenColumn),
dateAddedSeconds = cursor.getOptionalLong(dateColumn),
mediaId = "video_$id"
)
val width = cursor.getOptionalInt(widthColumn)
val height = cursor.getOptionalInt(heightColumn)
val orientation = cursor.getOptionalInt(orientationColumn)
while (cursor.moveToNext()) {
try {
val id = cursor.getLong(idColumn)
val contentUri = ContentUris.withAppendedId(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, id)
val mimeType = cursor.getOptionalString(mimeColumn)
val durationMs = cursor.getOptionalLong(durationColumn)
val displayDate = resolveSystemMediaDate(
dateTakenMillis = cursor.getOptionalLong(dateTakenColumn),
dateAddedSeconds = cursor.getOptionalLong(dateColumn),
mediaId = "video_$id"
)
val width = cursor.getOptionalInt(widthColumn)
val height = cursor.getOptionalInt(heightColumn)
val orientation = cursor.getOptionalInt(orientationColumn)
items.add(
MediaData(
id = "video_$id",
uri = contentUri,
thumbnailUri = contentUri,
displayName = cursor.getOptionalString(nameColumn) ?: "video_$id",
dateAdded = displayDate,
size = cursor.getOptionalLong(sizeColumn),
width = width,
height = height,
mediaType = MediaType.VIDEO,
mimeType = mimeType,
durationMs = durationMs,
sourceUri = contentUri,
metadata = MediaMetadata(
mediaType = MediaType.VIDEO,
dateTaken = displayDate,
items.add(
MediaData(
id = "video_$id",
uri = contentUri,
thumbnailUri = contentUri,
displayName = cursor.getOptionalString(nameColumn) ?: "video_$id",
dateAdded = displayDate,
size = cursor.getOptionalLong(sizeColumn),
width = width,
height = height,
sourceUri = contentUri.toString(),
mediaType = MediaType.VIDEO,
mimeType = mimeType,
durationMs = durationMs,
rotationDegrees = orientation,
videoWidth = width,
videoHeight = height
sourceUri = contentUri,
metadata = MediaMetadata(
mediaType = MediaType.VIDEO,
dateTaken = displayDate,
width = width,
height = height,
sourceUri = contentUri.toString(),
mimeType = mimeType,
durationMs = durationMs,
rotationDegrees = orientation,
videoWidth = width,
videoHeight = height
)
)
)
)
} catch (e: Exception) {
PLog.e(TAG, "Failed to build system video item, skipping", e)
} catch (e: Exception) {
PLog.e(TAG, "Failed to build system video item, skipping", e)
}
}
}
}
return items
items
}
}
private fun resolveSystemMediaDate(
@@ -94,7 +94,7 @@ enum class ActivePanel {
LUT_EDIT
}
private const val InitialPreviewTransitionDelayMillis = 500L
private const val InitialPreviewTransitionDelayMillis = 0L
private const val PreviewTransitionRevealDurationMillis = 800
@Composable
@@ -136,6 +136,7 @@ fun CameraScreen(
val rawBlackPointCorrection by viewModel.rawBlackPointCorrection.collectAsState()
val rawWhitePointCorrection by viewModel.rawWhitePointCorrection.collectAsState()
val multipleExposureState = viewModel.multipleExposureState
val canStartShutterAnimation by viewModel.canStartShutterAnimation.collectAsState()
var previewRecipeParamsOverride by remember(currentLutId) { mutableStateOf<ColorRecipeParams?>(null) }
var pendingCaptureAnimationBitmap by remember { mutableStateOf<Bitmap?>(null) }
var previewBounds by remember { mutableStateOf<Rect?>(null) }
@@ -346,8 +347,8 @@ fun CameraScreen(
}
}
LaunchedEffect(state.isPreviewActive, hasPlayedInitialPreviewTransition) {
if (hasPlayedInitialPreviewTransition || !state.isPreviewActive) return@LaunchedEffect
LaunchedEffect(state.isPreviewActive, hasPlayedInitialPreviewTransition, canStartShutterAnimation) {
if (hasPlayedInitialPreviewTransition || !state.isPreviewActive || !canStartShutterAnimation) return@LaunchedEffect
previewTransitionActive = true
delay(InitialPreviewTransitionDelayMillis)
previewTransitionRevealing = true
@@ -118,6 +118,12 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
private val _imageSavedEvent = MutableSharedFlow<Unit>()
val imageSavedEvent: SharedFlow<Unit> = _imageSavedEvent.asSharedFlow()
private val _isInitialized = MutableStateFlow(false)
val isInitialized = _isInitialized.asStateFlow()
private val _canStartShutterAnimation = MutableStateFlow(false)
val canStartShutterAnimation = _canStartShutterAnimation.asStateFlow()
// LUT 相关状态
var currentLutConfig: LutConfig? by mutableStateOf(null)
private set
@@ -701,6 +707,16 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
glSurfaceView?.setDepthMap(depth)
}
}
// 标记初始化完成
viewModelScope.launch {
// 等待首选配置加载完成
userPreferencesRepository.userPreferences.firstOrNull()
// 确保 LUT 列表已加载(虽然 ContentRepository 是同步初始化的,但在 ViewModel 中可能需要一点时间同步)
_isInitialized.value = true
StartupTrace.mark("CameraViewModel.isInitialized set to true")
}
StartupTrace.mark("CameraViewModel.init end")
}
@@ -3201,6 +3217,10 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
}
fun onShutterAnimationTriggered() {
_canStartShutterAnimation.value = true
}
override fun onCleared() {
super.onCleared()
cameraController.release()
@@ -146,8 +146,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
private var systemOffset = 0
private var photonOffset = 0
private val systemLoadMutex = Mutex()
private val photonLoadMutex = Mutex()
var hasMoreSystemPhotos by mutableStateOf(true)
private set
var hasMorePhotonPhotos by mutableStateOf(true)
@@ -156,6 +154,9 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
private val _isLoading = MutableStateFlow(false)
val isLoading = _isLoading.asStateFlow()
private val _isInitialized = MutableStateFlow(false)
val isInitialized = _isInitialized.asStateFlow()
private val _isSystemLoadingMore = MutableStateFlow(false)
val isSystemLoadingMore: StateFlow<Boolean> = _isSystemLoadingMore.asStateFlow()
private val _isPhotonLoadingMore = MutableStateFlow(false)
@@ -600,10 +601,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
checkGalleryPermission()
}
viewModelScope.launch {
loadPhotos()
}
viewModelScope.launch {
GalleryManager.detailHdrReadyEvents.collect { photoId ->
invalidatePreviewCache(photoId)
@@ -655,6 +652,16 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
availableDcps = dcps.sortedBy { it.getName() }
}
}
viewModelScope.launch {
// 等待初始照片加载完成
StartupTrace.measure("GalleryViewModel.loadPhotos") {
loadPhotos()
}
_isInitialized.value = true
StartupTrace.mark("GalleryViewModel.isInitialized set to true")
}
StartupTrace.mark("GalleryViewModel.init end")
}
@@ -707,9 +714,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
*/
suspend fun loadSystemPhotos(reset: Boolean = false) {
if (!hasGalleryPermission || !reset) return
systemLoadMutex.withLock {
loadSystemPhotosInternal()
}
loadSystemPhotosInternal()
}
private suspend fun loadSystemPhotosInternal() {
@@ -738,9 +743,7 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
*/
suspend fun loadPhotos(reset: Boolean = true) {
if (!reset) return
photonLoadMutex.withLock {
loadPhotosInternal()
}
loadPhotosInternal()
}
private suspend fun loadPhotosInternal() {
@@ -1224,22 +1227,20 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
*/
private fun deletePhotoOnlyInternal(photo: MediaData) {
viewModelScope.launch {
photonLoadMutex.withLock {
val context = getApplication<Application>()
val success = withContext(Dispatchers.IO) {
GalleryManager.deletePhotoOnly(context, photo.id)
}
if (success) {
removePhotonPhotosFromState(setOf(photo.id))
loadPhotosInternal()
// 如果删除的是当前照片,调整索引
if (photo == getCurrentPhoto() && currentPhotoIndex >= _photos.value.size) {
currentPhotoIndex = (_photos.value.size - 1).coerceAtLeast(0)
}
PLog.d(TAG, "Photo deleted (app only): ${photo.id}")
} else {
PLog.e(TAG, "Failed to delete photo: ${photo.id}")
val context = getApplication<Application>()
val success = withContext(Dispatchers.IO) {
GalleryManager.deletePhotoOnly(context, photo.id)
}
if (success) {
removePhotonPhotosFromState(setOf(photo.id))
loadPhotosInternal()
// 如果删除的是当前照片,调整索引
if (photo == getCurrentPhoto() && currentPhotoIndex >= _photos.value.size) {
currentPhotoIndex = (_photos.value.size - 1).coerceAtLeast(0)
}
PLog.d(TAG, "Photo deleted (app only): ${photo.id}")
} else {
PLog.e(TAG, "Failed to delete photo: ${photo.id}")
}
}
}
@@ -1268,25 +1269,23 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
fun deletePhotoAfterConfirmation(onComplete: (Boolean) -> Unit = {}) {
val photo = pendingDeletePhoto ?: return
viewModelScope.launch {
photonLoadMutex.withLock {
val context = getApplication<Application>()
val success = withContext(Dispatchers.IO) {
GalleryManager.deletePhotoOnly(context, photo.id)
}
if (success) {
removePhotonPhotosFromState(setOf(photo.id))
loadPhotosInternal()
// 如果删除的是当前照片,调整索引
if (photo == getCurrentPhoto() && currentPhotoIndex >= _photos.value.size) {
currentPhotoIndex = (_photos.value.size - 1).coerceAtLeast(0)
}
PLog.d(TAG, "Photo deleted after confirmation: ${photo.id}")
}
clearDeleteRequest()
onComplete(success)
val context = getApplication<Application>()
val success = withContext(Dispatchers.IO) {
GalleryManager.deletePhotoOnly(context, photo.id)
}
if (success) {
removePhotonPhotosFromState(setOf(photo.id))
loadPhotosInternal()
// 如果删除的是当前照片,调整索引
if (photo == getCurrentPhoto() && currentPhotoIndex >= _photos.value.size) {
currentPhotoIndex = (_photos.value.size - 1).coerceAtLeast(0)
}
PLog.d(TAG, "Photo deleted after confirmation: ${photo.id}")
}
clearDeleteRequest()
onComplete(success)
}
}
@@ -1295,28 +1294,24 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
*/
fun deleteSystemPhotoAfterConfirmation(onComplete: (Boolean) -> Unit = {}) {
viewModelScope.launch {
systemLoadMutex.withLock {
pendingDeleteSystemPhoto?.relatedPhoto?.takeIf { it.isVideo }?.let { relatedVideo ->
photonLoadMutex.withLock {
withContext(Dispatchers.IO) {
GalleryManager.deletePhotoOnly(getApplication(), relatedVideo.id)
}
removePhotonPhotosFromState(setOf(relatedVideo.id))
loadPhotosInternal()
}
pendingDeleteSystemPhoto?.relatedPhoto?.takeIf { it.isVideo }?.let { relatedVideo ->
withContext(Dispatchers.IO) {
GalleryManager.deletePhotoOnly(getApplication(), relatedVideo.id)
}
pendingDeleteSystemPhoto?.let { removeSystemPhotosFromState(setOf(it.id)) }
// 系统照片已经被 MediaStore 删除,我们只需要刷新列表
loadSystemPhotosInternal()
// 调整索引
if (currentPhotoIndex >= currentPhotos.value.size) {
currentPhotoIndex = (currentPhotos.value.size - 1).coerceAtLeast(0)
}
clearDeleteRequest()
onComplete(true)
removePhotonPhotosFromState(setOf(relatedVideo.id))
loadPhotosInternal()
}
pendingDeleteSystemPhoto?.let { removeSystemPhotosFromState(setOf(it.id)) }
// 系统照片已经被 MediaStore 删除,我们只需要刷新列表
loadSystemPhotosInternal()
// 调整索引
if (currentPhotoIndex >= currentPhotos.value.size) {
currentPhotoIndex = (currentPhotos.value.size - 1).coerceAtLeast(0)
}
clearDeleteRequest()
onComplete(true)
}
}
@@ -1436,7 +1431,50 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
*/
private fun deleteBatchPhotosOnlyInternal(photos: List<MediaData>) {
viewModelScope.launch {
photonLoadMutex.withLock {
val context = getApplication<Application>()
var deletedCount = 0
val deletedIds = mutableSetOf<String>()
withContext(Dispatchers.IO) {
photos.forEach { photo ->
val success = GalleryManager.deletePhotoOnly(context, photo.id)
if (success) {
deletedCount++
deletedIds.add(photo.id)
}
}
}
exitSelectionMode()
removePhotonPhotosFromState(deletedIds)
loadPhotosInternal()
PLog.d(TAG, "Batch deleted $deletedCount photos (app only)")
}
}
/**
* 批量删除确认后的回调(在用户确认删除系统相册照片后调用)
*/
fun deleteBatchPhotosAfterConfirmation(onComplete: (Int) -> Unit = {}) {
val photos = pendingDeletePhotos
if (photos.isEmpty()) return
viewModelScope.launch {
if (selectedTab == GalleryTab.SYSTEM) {
val relatedPhotonVideos = photos.mapNotNull { it.relatedPhoto }.filter { it.isVideo }
if (relatedPhotonVideos.isNotEmpty()) {
val context = getApplication<Application>()
withContext(Dispatchers.IO) {
relatedPhotonVideos.forEach { GalleryManager.deletePhotoOnly(context, it.id) }
}
removePhotonPhotosFromState(relatedPhotonVideos.map { it.id }.toSet())
loadPhotosInternal()
}
removeSystemPhotosFromState(photos.map { it.id }.toSet())
// 系统相册刷新
loadSystemPhotosInternal()
} else {
// 原有的内部照片删除逻辑
val context = getApplication<Application>()
var deletedCount = 0
val deletedIds = mutableSetOf<String>()
@@ -1450,60 +1488,9 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
}
}
}
exitSelectionMode()
removePhotonPhotosFromState(deletedIds)
loadPhotosInternal()
PLog.d(TAG, "Batch deleted $deletedCount photos (app only)")
}
}
}
/**
* 批量删除确认后的回调(在用户确认删除系统相册照片后调用)
*/
fun deleteBatchPhotosAfterConfirmation(onComplete: (Int) -> Unit = {}) {
val photos = pendingDeletePhotos
if (photos.isEmpty()) return
viewModelScope.launch {
if (selectedTab == GalleryTab.SYSTEM) {
systemLoadMutex.withLock {
val relatedPhotonVideos = photos.mapNotNull { it.relatedPhoto }.filter { it.isVideo }
if (relatedPhotonVideos.isNotEmpty()) {
photonLoadMutex.withLock {
val context = getApplication<Application>()
withContext(Dispatchers.IO) {
relatedPhotonVideos.forEach { GalleryManager.deletePhotoOnly(context, it.id) }
}
removePhotonPhotosFromState(relatedPhotonVideos.map { it.id }.toSet())
loadPhotosInternal()
}
}
removeSystemPhotosFromState(photos.map { it.id }.toSet())
// 系统相册刷新
loadSystemPhotosInternal()
}
} else {
// 原有的内部照片删除逻辑
photonLoadMutex.withLock {
val context = getApplication<Application>()
var deletedCount = 0
val deletedIds = mutableSetOf<String>()
withContext(Dispatchers.IO) {
photos.forEach { photo ->
val success = GalleryManager.deletePhotoOnly(context, photo.id)
if (success) {
deletedCount++
deletedIds.add(photo.id)
}
}
}
removePhotonPhotosFromState(deletedIds)
loadPhotosInternal()
PLog.d(TAG, "Batch deleted $deletedCount internal photos after confirmation")
}
PLog.d(TAG, "Batch deleted $deletedCount internal photos after confirmation")
}
exitSelectionMode()
@@ -0,0 +1,107 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="80"
android:viewportHeight="48">
<group android:scaleX="0.46444446"
android:scaleY="0.27866668"
android:translateX="21.422222"
android:translateY="17.312">
<path
android:pathData="M52,0l13,0l0,8l-13,0z"
android:strokeWidth="1"
android:fillColor="#BDC3C7"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M53,1l11,0l0,6l-11,0z"
android:strokeWidth="1"
android:fillColor="#E0E4E8"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M55,2L56,2L56,6L55,6L55,2ZM58,2L59,2L59,6L58,6L58,2ZM61,2L62,2L62,6L61,6L61,2Z"
android:strokeWidth="1"
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M12,5L30,5C31,5 32,5.5 32,6L32,8L10,8L10,6C10,5.5 11,5 12,5Z"
android:strokeWidth="1"
android:fillColor="#FF6B35"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M0,34L80,34L80,44C80,46.2 78.2,48 76,48L4,48C1.8,48 0,46.2 0,44L0,34Z"
android:strokeWidth="1"
android:fillColor="#D1D5D8"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M0,22l80,0l0,12l-80,0z"
android:strokeWidth="1"
android:fillColor="#E0E4E8"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M0,12C0,9.8 1.8,8 4,8L76,8C78.2,8 80,9.8 80,12L80,22L0,22L0,12Z"
android:strokeWidth="1"
android:fillColor="#363636"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M61.75,10L72.25,10C73.125,10 74,10.909 74,11.818L74,18.182C74,19.091 73.125,20 72.25,20L61.75,20C60.875,20 60,19.091 60,18.182L60,11.818C60,10.909 60.875,10 61.75,10Z"
android:strokeWidth="1"
android:fillColor="#BDC3C7"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M62.714,11L71.286,11C72.143,11 73,11.444 73,12.333L73,17.667C73,18.556 72.143,19 71.286,19L62.714,19C61.857,19 61,18.556 61,17.667L61,12.333C61,11.444 61.857,11 62.714,11Z"
android:strokeWidth="1"
android:fillColor="#E0E4E8"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M25,28C25,22.641 27.859,17.689 32.5,15.01C37.141,12.33 42.859,12.33 47.5,15.01C52.141,17.689 55,22.641 55,28C55,33.359 52.141,38.311 47.5,40.99C42.859,43.67 37.141,43.67 32.5,40.99C27.859,38.311 25,33.359 25,28"
android:strokeWidth="1"
android:fillColor="#252525"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M29,28C29,21.925 33.925,17 40,17C46.075,17 51,21.925 51,28C51,34.075 46.075,39 40,39C33.925,39 29,34.075 29,28"
android:strokeWidth="1"
android:fillColor="#141414"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M33,28C33,24.134 36.134,21 40,21C43.866,21 47,24.134 47,28C47,31.866 43.866,35 40,35C36.134,35 33,31.866 33,28"
android:strokeWidth="1"
android:fillColor="#030303"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M34,24C34,22.895 34.895,22 36,22C37.105,22 38,22.895 38,24C38,25.105 37.105,26 36,26C34.895,26 34,25.105 34,24"
android:strokeWidth="1"
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M43,32C43,31.448 43.448,31 44,31C44.552,31 45,31.448 45,32C45,32.552 44.552,33 44,33C43.448,33 43,32.552 43,32"
android:strokeWidth="1"
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M8.5,41C8.5,39.392 9.358,37.907 10.75,37.103C12.142,36.299 13.858,36.299 15.25,37.103C16.642,37.907 17.5,39.392 17.5,41C17.5,42.608 16.642,44.093 15.25,44.897C13.858,45.701 12.142,45.701 10.75,44.897C9.358,44.093 8.5,42.608 8.5,41"
android:strokeWidth="1"
android:fillColor="#FF6B35"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
<path
android:pathData="M61.5,41C61.5,39.392 62.358,37.907 63.75,37.103C65.142,36.299 66.858,36.299 68.25,37.103C69.642,37.907 70.5,39.392 70.5,41C70.5,42.608 69.642,44.093 68.25,44.897C66.858,45.701 65.142,45.701 63.75,44.897C62.358,44.093 61.5,42.608 61.5,41"
android:strokeWidth="1"
android:fillColor="#252525"
android:fillType="nonZero"
android:strokeColor="#00000000"/>
</group>
</vector>
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
<monochrome android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1018 B

After

Width:  |  Height:  |  Size: 880 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

+1
View File
@@ -28,4 +28,5 @@
<color name="widget_button_secondary_dark">#1C242E</color>
<color name="widget_text_primary_dark">#FFFFFF</color>
<color name="widget_text_secondary_dark">#80FFFFFF</color>
<color name="splash_background">#252525</color>
</resources>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#434A5D</color>
<color name="ic_launcher_background">#252525</color>
</resources>
+7
View File
@@ -3,6 +3,13 @@
<style name="Theme.MyCamera" parent="android:Theme.Material.Light.NoActionBar" />
<style name="Theme.MyCamera.Splash" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/splash_background</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher_foreground</item>
<item name="splashScreenIconSize">240dp</item>
<item name="postSplashScreenTheme">@style/Theme.MyCamera</item>
</style>
<style name="Theme.MyCamera.Transparent" parent="android:Theme.Material.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>