Skip to content

Commit f677078

Browse files
committed
Merge branch 'main' into feature/xr/customize-screen
2 parents 88cbc37 + f412115 commit f677078

File tree

24 files changed

+127
-32
lines changed

24 files changed

+127
-32
lines changed

.google/packaging.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright (C) 2025 The Android Open Source Project
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# GOOGLE SAMPLE PACKAGING DATA
16+
#
17+
# This file is used by Google as part of our samples packaging process.
18+
# End users may safely ignore this file. It has no relevance to other systems.
19+
---
20+
status: PUBLISHED
21+
technologies: [Android, AI, XR, JetpackCompose]
22+
categories:
23+
- Jetpack
24+
- Artificial Intelligence
25+
- Machine Learning
26+
- Jetpack Compose Layouts
27+
- Wear OS
28+
- Android XR
29+
languages: [Kotlin]
30+
solutions:
31+
- Mobile
32+
- XR
33+
- Wear
34+
github: android/androidify
35+
level: INTERMEDIATE
36+
apiRefs:
37+
- android:androidx.compose.Composable
38+
license: apache2

core/testing/src/main/java/com/android/developers/testing/repository/FakeWatchFaceInstallationRepository.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ class FakeWatchFaceInstallationRepository : WatchFaceInstallationRepository {
7575
_watchFaceInstallationStatus.value = WatchFaceInstallationStatus.NotStarted
7676
}
7777

78+
override suspend fun prepareForTransfer() {
79+
transferId = generateTransferId()
80+
_watchFaceInstallationStatus.value = WatchFaceInstallationStatus.Preparing
81+
}
82+
7883
private fun generateTransferId() = UUID.randomUUID().toString().take(8)
7984

8085
public fun setWatchAsConnected() {

feature/results/src/androidTest/java/com/android/developers/androidify/results/ResultsScreenTest.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ class ResultsScreenTest {
190190
val configProvider = ConfigProvider(TestRemoteConfigDataSource(false))
191191
val viewModel = ResultsViewModel(testUri, originalImageUrl = testUri, null, configProvider)
192192

193-
194193
composeTestRule.setContent {
195194
// Disable animation
196195
SharedElementContextPreview {

feature/results/src/main/java/com/android/developers/androidify/customize/CustomizeExportScreen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ import androidx.compose.ui.tooling.preview.Preview
7171
import androidx.compose.ui.unit.dp
7272
import androidx.lifecycle.compose.collectAsStateWithLifecycle
7373
import androidx.navigation3.ui.LocalNavAnimatedContentScope
74+
import com.android.developers.androidify.customize.watchface.WatchFaceModalSheet
7475
import com.android.developers.androidify.customize.xr.CustomizeExportLayoutSpatial
7576
import com.android.developers.androidify.results.PermissionRationaleDialog
7677
import com.android.developers.androidify.results.R

feature/results/src/main/java/com/android/developers/androidify/customize/CustomizeExportViewModel.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import androidx.compose.ui.Modifier
2424
import androidx.lifecycle.AndroidViewModel
2525
import androidx.lifecycle.viewModelScope
2626
import com.android.developers.androidify.RemoteConfigDataSource
27+
import com.android.developers.androidify.customize.watchface.WatchFaceSelectionState
2728
import com.android.developers.androidify.data.ImageGenerationRepository
2829
import com.android.developers.androidify.util.LocalFileProvider
2930
import com.android.developers.androidify.watchface.WatchFaceAsset
@@ -34,6 +35,7 @@ import dagger.assisted.Assisted
3435
import dagger.assisted.AssistedFactory
3536
import dagger.assisted.AssistedInject
3637
import dagger.hilt.android.lifecycle.HiltViewModel
38+
import kotlinx.coroutines.Dispatchers
3739
import kotlinx.coroutines.Job
3840
import kotlinx.coroutines.flow.MutableStateFlow
3941
import kotlinx.coroutines.flow.SharingStarted.Companion.WhileSubscribed
@@ -367,10 +369,11 @@ class CustomizeExportViewModel @AssistedInject constructor(
367369

368370
fun installWatchFace() {
369371
val watchFaceToInstall = _state.value.watchFaceSelectionState.selectedWatchFace ?: return
370-
transferJob = viewModelScope.launch {
371-
val bitmap = state.value.exportImageCanvas.imageBitmap
372-
val watch = state.value.connectedWatch
373-
if (watch != null && bitmap != null) {
372+
val bitmap = state.value.exportImageCanvas.imageBitmap
373+
val watch = state.value.connectedWatch
374+
if (watch != null && bitmap != null) {
375+
transferJob = viewModelScope.launch(Dispatchers.Default) {
376+
watchfaceInstallationRepository.prepareForTransfer()
374377
val wfBitmap = imageGenerationRepository.removeBackground(bitmap)
375378
val response = watchfaceInstallationRepository
376379
.createAndTransferWatchFace(watch, watchFaceToInstall, wfBitmap)

feature/results/src/main/java/com/android/developers/androidify/customize/CustomizeState.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import androidx.annotation.DrawableRes
2121
import androidx.compose.ui.geometry.Offset
2222
import androidx.compose.ui.geometry.Size
2323
import androidx.compose.ui.graphics.Color
24+
import com.android.developers.androidify.customize.watchface.WatchFaceSelectionState
2425
import com.android.developers.androidify.wear.common.ConnectedWatch
2526
import com.android.developers.androidify.wear.common.WatchFaceInstallationStatus
2627

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

1818
import androidx.compose.foundation.layout.Arrangement
1919
import androidx.compose.foundation.layout.Column

feature/results/src/main/java/com/android/developers/androidify/customize/ErrorWatchFacePanel.kt renamed to feature/results/src/main/java/com/android/developers/androidify/customize/watchface/ErrorWatchFacePanel.kt

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

1818
import androidx.compose.foundation.layout.Arrangement
1919
import androidx.compose.foundation.layout.Column
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.android.developers.androidify.customize
16+
package com.android.developers.androidify.customize.watchface
1717

1818
import androidx.compose.foundation.layout.Arrangement
1919
import androidx.compose.foundation.layout.Column
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
package com.android.developers.androidify.customize
16+
package com.android.developers.androidify.customize.watchface
1717

1818
import android.content.Intent
1919
import androidx.compose.foundation.layout.Arrangement

0 commit comments

Comments
 (0)