Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 4 additions & 26 deletions app/src/main/java/com/google/jetpackcamera/ui/JcaApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package com.google.jetpackcamera.ui

import android.Manifest
import android.net.Uri
import androidx.compose.animation.AnimatedContentTransitionScope
import androidx.compose.animation.core.EaseIn
import androidx.compose.animation.core.EaseOut
Expand All @@ -27,11 +26,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import com.google.accompanist.permissions.ExperimentalPermissionsApi
import com.google.accompanist.permissions.isGranted
import com.google.accompanist.permissions.rememberMultiplePermissionsState
Expand Down Expand Up @@ -118,11 +115,7 @@ private fun JetpackCameraNavHost(
}
PreviewScreen(
onNavigateToSettings = { navController.navigate(SETTINGS_ROUTE) },
onNavigateToPostCapture = { imageUri ->
navController.navigate(
"$POST_CAPTURE_ROUTE?imageUri=${Uri.encode(imageUri.toString())}"
)
},
onNavigateToPostCapture = { navController.navigate(POST_CAPTURE_ROUTE) },
onRequestWindowColorMode = onRequestWindowColorMode,
onFirstFrameCaptureCompleted = onFirstFrameCaptureCompleted,
previewMode = previewMode,
Expand Down Expand Up @@ -156,25 +149,10 @@ private fun JetpackCameraNavHost(
}

composable(
"$POST_CAPTURE_ROUTE?imageUri={imageUri}",
arguments = listOf(
navArgument("imageUri") {
type = NavType.StringType
defaultValue = ""
}
)
) { backStackEntry ->
val imageUriString = backStackEntry.arguments?.getString("imageUri")

val imageUri = if (!imageUriString.isNullOrEmpty()) {
Uri.parse(
imageUriString
)
} else {
null
}
POST_CAPTURE_ROUTE
) {
PostCaptureScreen(
imageUri = imageUri
onRequestWindowColorMode = onRequestWindowColorMode
)
}
}
Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions data/media/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
93 changes: 93 additions & 0 deletions data/media/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.kapt)
alias(libs.plugins.dagger.hilt.android)
}

android {
namespace = "com.google.jetpackcamera.data.media"
compileSdk = libs.versions.compileSdk.get().toInt()

defaultConfig {
minSdk = libs.versions.minSdk.get().toInt()
testOptions.targetSdk = libs.versions.targetSdk.get().toInt()
lint.targetSdk = libs.versions.targetSdk.get().toInt()

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}

flavorDimensions += "flavor"
productFlavors {
create("stable") {
dimension = "flavor"
isDefault = true
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlin {
jvmToolchain(17)
}

@Suppress("UnstableApiUsage")
testOptions {
managedDevices {
localDevices {
create("pixel2Api28") {
device = "Pixel 2"
apiLevel = 28
}
create("pixel8Api34") {
device = "Pixel 8"
apiLevel = 34
systemImageSource = "aosp_atd"
}
}
}
}
}

dependencies {
implementation(libs.kotlinx.coroutines.core)

// Hilt
implementation(libs.dagger.hilt.android)
kapt(libs.dagger.hilt.compiler)

// Testing
testImplementation(libs.junit)
testImplementation(libs.truth)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.truth)
androidTestImplementation(libs.kotlinx.coroutines.test)


// Project dependencies
implementation(project(":core:common"))
}

// Allow references to generated code
kapt {
correctErrorTypes = true
}
Empty file added data/media/consumer-rules.pro
Empty file.
21 changes: 21 additions & 0 deletions data/media/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
19 changes: 19 additions & 0 deletions data/media/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2023 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (C) 2025 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.jetpackcamera.data.media

object FakeMediaRepository : MediaRepository {
override suspend fun getLastCapturedMedia(): MediaDescriptor {
return MediaDescriptor.None
}

override suspend fun load(mediaDescriptor: MediaDescriptor): Media {
return Media.None
}
}
Loading