Skip to content

Commit a321f4d

Browse files
authored
Merge pull request #65 from android/garan-spotless
Applies Spotless
2 parents 1df7a12 + a5dc628 commit a321f4d

File tree

11 files changed

+36
-40
lines changed

11 files changed

+36
-40
lines changed

app/src/main/java/com/android/developers/androidify/navigation/MainNavigation.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,12 @@ import androidx.compose.runtime.getValue
2929
import androidx.compose.runtime.mutableStateOf
3030
import androidx.compose.runtime.remember
3131
import androidx.compose.runtime.setValue
32-
import androidx.compose.ui.graphics.TransformOrigin
3332
import androidx.compose.ui.unit.IntOffset
34-
import androidx.lifecycle.viewmodel.navigation3.ViewModelStoreNavEntryDecorator
3533
import androidx.lifecycle.viewmodel.navigation3.rememberViewModelStoreNavEntryDecorator
36-
import androidx.navigation3.runtime.SavedStateNavEntryDecorator
3734
import androidx.navigation3.runtime.entry
3835
import androidx.navigation3.runtime.entryProvider
3936
import androidx.navigation3.runtime.rememberSavedStateNavEntryDecorator
4037
import androidx.navigation3.ui.NavDisplay
41-
import androidx.navigation3.ui.SceneSetupNavEntryDecorator
4238
import com.android.developers.androidify.camera.CameraPreviewScreen
4339
import com.android.developers.androidify.creation.CreationScreen
4440
import com.android.developers.androidify.home.AboutScreen

core/network/src/main/java/com/android/developers/androidify/vertexai/FirebaseAiDataSource.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import com.android.developers.androidify.model.ValidatedImage
2424
import com.google.firebase.Firebase
2525
import com.google.firebase.ai.GenerativeModel
2626
import com.google.firebase.ai.ImagenModel
27+
import com.google.firebase.ai.ai
28+
import com.google.firebase.ai.type.GenerativeBackend
2729
import com.google.firebase.ai.type.HarmBlockThreshold
2830
import com.google.firebase.ai.type.HarmCategory
2931
import com.google.firebase.ai.type.ImagenPersonFilterLevel
@@ -34,8 +36,6 @@ import com.google.firebase.ai.type.SafetySetting
3436
import com.google.firebase.ai.type.Schema
3537
import com.google.firebase.ai.type.content
3638
import com.google.firebase.ai.type.generationConfig
37-
import com.google.firebase.ai.ai
38-
import com.google.firebase.ai.type.GenerativeBackend
3939
import kotlinx.serialization.json.Json
4040
import kotlinx.serialization.json.booleanOrNull
4141
import kotlinx.serialization.json.decodeFromJsonElement

core/util/src/main/java/com/android/developers/androidify/util/LocalFileProvider.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ import android.provider.MediaStore
2525
import androidx.annotation.WorkerThread
2626
import androidx.core.content.FileProvider
2727
import kotlinx.coroutines.CoroutineDispatcher
28-
import kotlinx.coroutines.Dispatchers
2928
import kotlinx.coroutines.withContext
3029
import java.io.File
3130
import java.io.FileOutputStream
3231
import java.io.IOException
33-
import java.nio.file.Files
3432
import java.util.UUID
3533
import javax.inject.Inject
3634
import javax.inject.Named
@@ -39,15 +37,20 @@ import javax.inject.Singleton
3937
interface LocalFileProvider {
4038
@WorkerThread
4139
suspend fun saveBitmapToFile(bitmap: Bitmap, file: File)
40+
4241
@WorkerThread
4342
suspend fun getFileFromCache(fileName: String): File
43+
4444
@WorkerThread
4545
suspend fun createCacheFile(fileName: String): File
46+
4647
@WorkerThread
4748
suspend fun saveToSharedStorage(file: File, fileName: String, mimeType: String): Uri
4849
fun sharingUriForFile(file: File): Uri
50+
4951
@WorkerThread
5052
suspend fun copyToInternalStorage(uri: Uri): File
53+
5154
@WorkerThread
5255
suspend fun saveUriToSharedStorage(inputUri: Uri, fileName: String, mimeType: String): Uri
5356
}
@@ -104,7 +107,7 @@ open class LocalFileProviderImpl @Inject constructor(
104107
inputUri: Uri,
105108
fileName: String,
106109
mimeType: String,
107-
): Uri = withContext(ioDispatcher) {
110+
): Uri = withContext(ioDispatcher) {
108111
val (newUri, contentValues) = createSharedStorageEntry(fileName, mimeType)
109112
application.contentResolver.openOutputStream(newUri)?.use { outputStream ->
110113
application.contentResolver.openInputStream(inputUri)?.use { inputStream ->

feature/camera/src/main/java/com/android/developers/androidify/camera/CameraControls.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ internal fun CameraControls(
4545
ZoomToolbar(
4646
defaultZoomOptions = defaultZoomOptions,
4747
zoomLevel = zoomLevel,
48-
onZoomLevelSelected = onZoomLevelSelected
48+
onZoomLevelSelected = onZoomLevelSelected,
4949
)
5050
Spacer(Modifier.height(12.dp))
5151
Row(verticalAlignment = Alignment.CenterVertically) {
@@ -74,7 +74,7 @@ private fun CameraControlsPreview() {
7474
canFlipCamera = true,
7575
flipCameraDirectionClicked = { },
7676
detectedPose = true,
77-
zoomLevel = {0.4f},
77+
zoomLevel = { 0.4f },
7878
onZoomLevelSelected = {},
7979
defaultZoomOptions = listOf(.6f, 1f),
8080
)

feature/camera/src/main/java/com/android/developers/androidify/camera/CameraLayout.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ internal fun CameraLayout(
7373
) {
7474
val mContext = LocalContext.current
7575
var isCameraLeft by remember { mutableStateOf(false) }
76-
LifecycleStartEffect(Unit){
76+
LifecycleStartEffect(Unit) {
7777
val displayManager = mContext.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
7878
val displayListener = object : DisplayManager.DisplayListener {
7979
override fun onDisplayChanged(displayId: Int) {
@@ -115,7 +115,7 @@ internal fun CameraLayout(
115115
zoomButton,
116116
guideText,
117117
guide,
118-
isCameraLeft
118+
isCameraLeft,
119119
)
120120

121121
this.maxWidth > maxHeight && allowsFullContent() -> CompactHorizontalCameraLayout(
@@ -472,9 +472,9 @@ private fun VerticalControlsLayout(
472472
Row(
473473
modifier = modifier,
474474
verticalAlignment = Alignment.CenterVertically,
475-
horizontalArrangement = if(isCameraLeft) Arrangement.End else Arrangement.Start,
475+
horizontalArrangement = if (isCameraLeft) Arrangement.End else Arrangement.Start,
476476
) {
477-
if(isCameraLeft){
477+
if (isCameraLeft) {
478478
if (zoomButton != null) zoomButton(Modifier)
479479
Spacer(Modifier.width(12.dp))
480480
Column(horizontalAlignment = Alignment.CenterHorizontally) {
@@ -484,7 +484,7 @@ private fun VerticalControlsLayout(
484484
captureButton(Modifier)
485485
Spacer(modifier = Modifier.weight(1f))
486486
}
487-
}else{
487+
} else {
488488
Column(horizontalAlignment = Alignment.CenterHorizontally) {
489489
Box(Modifier.weight(1f), contentAlignment = Alignment.Center) {
490490
if (flipCameraButton != null) flipCameraButton(Modifier)

feature/camera/src/main/java/com/android/developers/androidify/camera/CameraScreen.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ fun CameraPreviewScreen(
146146
shouldShowRearCameraFeature = viewModel::shouldShowRearDisplayFeature,
147147
toggleRearCameraFeature = { viewModel.toggleRearDisplayFeature(activity) },
148148
isRearCameraEnabled = uiState.isRearCameraActive,
149-
cameraSessionId = uiState.cameraSessionId
149+
cameraSessionId = uiState.cameraSessionId,
150150
)
151151
}
152152
} else {
@@ -304,13 +304,13 @@ private fun CameraPreviewContent(
304304
toggleRearCameraFeature: () -> Unit = {},
305305
isRearCameraEnabled: Boolean = false,
306306
) {
307-
val scope = rememberCoroutineScope()
307+
val scope = rememberCoroutineScope()
308308
val zoomState = remember(cameraSessionId) {
309-
ZoomState(
310-
initialZoomLevel = zoomLevel(),
311-
onChangeZoomLevel = onChangeZoomLevel,
312-
zoomRange = zoomRange,
313-
)
309+
ZoomState(
310+
initialZoomLevel = zoomLevel(),
311+
onChangeZoomLevel = onChangeZoomLevel,
312+
zoomRange = zoomRange,
313+
)
314314
}
315315
// Delegate the layout to the stateless version
316316
StatelessCameraPreviewContent(
@@ -321,7 +321,7 @@ private fun CameraPreviewContent(
321321
surfaceRequest = surfaceRequest,
322322
autofocusUiState = autofocusUiState,
323323
tapToFocus = tapToFocus,
324-
onScaleZoom = { scope.launch { zoomState.scaleZoom(it) }},
324+
onScaleZoom = { scope.launch { zoomState.scaleZoom(it) } },
325325
modifier = viewfinderModifier.onSizeChanged { size -> // Apply modifier from slot
326326
if (size.height > 0) {
327327
aspectRatio = calculateCorrectAspectRatio(size.height, size.width, aspectRatio)

feature/camera/src/main/java/com/android/developers/androidify/camera/CameraViewfinder.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ private val TAP_TO_FOCUS_INDICATOR_SIZE = 48.dp
4747

4848
@Composable
4949
internal fun CameraViewfinder(
50-
surfaceRequest: SurfaceRequest,
51-
autofocusUiState: AutofocusUiState,
52-
tapToFocus: (tapCoords: Offset) -> Unit,
53-
onScaleZoom: (zoomScaleFactor: Float) -> Unit,
54-
modifier: Modifier = Modifier,
50+
surfaceRequest: SurfaceRequest,
51+
autofocusUiState: AutofocusUiState,
52+
tapToFocus: (tapCoords: Offset) -> Unit,
53+
onScaleZoom: (zoomScaleFactor: Float) -> Unit,
54+
modifier: Modifier = Modifier,
5555
) {
5656
val onScaleCurrentZoom by rememberUpdatedState(onScaleZoom)
5757
val currentTapToFocus by rememberUpdatedState(tapToFocus)

feature/camera/src/main/java/com/android/developers/androidify/camera/ZoomState.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
1716
package com.android.developers.androidify.camera
1817

1918
import androidx.compose.animation.core.Animatable
@@ -69,4 +68,4 @@ class ZoomState(
6968
}
7069
}
7170
}
72-
}
71+
}

feature/creation/src/androidTest/java/com/android/developers/androidify/creation/CreationScreenTest.kt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import android.net.Uri
1919
import androidx.activity.ComponentActivity
2020
import androidx.compose.material3.SnackbarHostState
2121
import androidx.compose.ui.test.assertIsDisplayed
22-
import androidx.compose.ui.test.assertIsEnabled
23-
import androidx.compose.ui.test.assertIsNotEnabled
2422
import androidx.compose.ui.test.assertIsOff
2523
import androidx.compose.ui.test.assertIsOn
2624
import androidx.compose.ui.test.junit4.createAndroidComposeRule
@@ -223,7 +221,6 @@ class CreationScreenTest {
223221
}
224222
}
225223

226-
227224
composeTestRule.onNodeWithText(headlineText).assertIsDisplayed()
228225
// TODO: Fails in pixel 5
229226
// composeTestRule.onNodeWithText(writingChipText).assertIsDisplayed().assertIsNotEnabled()

feature/creation/src/main/java/com/android/developers/androidify/creation/CreationScreen.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,11 @@ fun CreationScreen(
167167
creationViewModel.onBackPress()
168168
}
169169
LaunchedEffect(Unit) {
170-
if (fileName != null) creationViewModel.onImageSelected(fileName.toUri())
171-
else creationViewModel.onImageSelected(null)
170+
if (fileName != null) {
171+
creationViewModel.onImageSelected(fileName.toUri())
172+
} else {
173+
creationViewModel.onImageSelected(null)
174+
}
172175
}
173176
val pickMedia = rememberLauncherForActivityResult(PickVisualMedia()) { uri ->
174177
if (uri != null) {

0 commit comments

Comments
 (0)