Skip to content

Commit

Permalink
Merge branch 'main' into refactoring_ui_models_module
Browse files Browse the repository at this point in the history
  • Loading branch information
yschimke authored Oct 18, 2024
2 parents 36c755f + b84e513 commit bf0dd1a
Show file tree
Hide file tree
Showing 18 changed files with 241 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
TERM: dumb

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
timeout-minutes: 40

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
timeout-minutes: 40

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
timeout-minutes: 40

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
TERM: dumb

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand All @@ -160,7 +160,7 @@ jobs:
timeout-minutes: 40

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
timeout-minutes: 40

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fixup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
timeout-minutes: 40

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macrobenchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
TERM: dumb

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
TERM: dumb

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
lfs: 'true'

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ kotlin.daemon.jvmargs=-Dfile.encoding=UTF-8 -XX:+UseG1GC -XX:SoftRefLRUPolicyMSP
systemProp.org.gradle.internal.http.socketTimeout=120000

GROUP=com.google.android.horologist
VERSION_NAME=0.7.3-alpha
VERSION_NAME=0.7.4-alpha

POM_DESCRIPTION=Utilities for Wear OS

Expand Down
32 changes: 16 additions & 16 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
accompanist = "0.36.0"
androidx-benchmark = "1.3.2"
androidx-benchmark = "1.3.3"
androidx-complications-data = "1.2.1"
androidx-concurrent = "1.2.0"
androidx-constraintlayout-compose = "1.0.1"
Expand All @@ -12,21 +12,21 @@ androidx-test-espresso = "3.6.1"
androidx-test-ext = "1.2.1"
androidx-test-runner = "1.6.2"
androidx-wear-watchface = "1.2.1"
androidxActivity = "1.9.2"
androidxActivity = "1.9.3"
androidxComposeBom = "2024.09.00-alpha"
androidxCore = "1.13.1"
androidxLifecycle = "2.8.6"
androidxNavigation = "2.8.2"
androidxNavigation = "2.8.3"
androidxPhoneInteractions = "1.1.0-alpha04"
androidxRemoteInteractions = "1.1.0-beta01"
androidxRemoteInteractions = "1.1.0-rc01"
androidxStartup = "1.2.0"
androidxTracing = "1.2.0"
androidxWear = "1.3.0"
androidxWork = "2.9.1"
androidxprotolayout = "1.2.0"
androidxtiles = "1.4.0"
androidxprotolayout = "1.2.1"
androidxtiles = "1.4.1"
annotation = "1.0.1"
app-cash-turbine = "1.1.0"
app-cash-turbine = "1.2.0"
appcompat = "1.7.0"
com-squareup-okhttp3 = "5.0.0-alpha.14"
com-squareup-retrofit2 = "2.11.0"
Expand All @@ -35,14 +35,14 @@ composesnapshot = "-"
dependencyAnalysis = "2.1.4"
dokka = "1.9.20"
googledagger = "2.52"
gradlePlugin = "8.7.0"
gradlePublishPlugin = "0.29.0"
gradlePlugin = "8.7.1"
gradlePublishPlugin = "0.30.0"
io-coil-kt = "2.7.0"
junit = "4.13.2"
kotlin = "2.0.20"
kotlin = "2.0.21"
kotlinxCoroutine = "1.9.0"
kotlinxSerialization = "1.7.3"
ksp = "2.0.20-1.0.25"
ksp = "2.0.21-1.0.25"
ktlint = "0.50.0"
material = "1.12.0"
metalava = "0.3.5"
Expand All @@ -54,22 +54,22 @@ protobuf = "4.28.2"
protobuf-gen-grpc-java = "1.68.0"
protobuf-gen-grpc-kotlin = "1.3.0:jdk8@jar"
protobuf-gen-javalite = "3.0.0"
roborazzi = "1.28.0"
roborazzi = "1.29.0"
room = "2.6.1"
runtimeTracing = "1.7.3"
runtimeTracing = "1.7.4"
spotless = "6.25.0"
tiles-tooling-preview = "1.4.0"
tiles-tooling-preview = "1.4.1"
truth = "1.4.4"
wearInput = "1.2.0-alpha02"
wearToolingPreview = "1.0.0"
wearcompose = "1.5.0-alpha03"
wearcompose = "1.5.0-alpha04"

[libraries]
accompanist-testharness = { module = "com.google.accompanist:accompanist-testharness", version.ref = "accompanist" }
android-tools-build-gradle = { module = "com.android.tools.build:gradle", version.ref = "gradlePlugin" }
androidx-activity = { module = "androidx.activity:activity", version.ref = "androidxActivity" }
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidxActivity" }
androidx-annotation = "androidx.annotation:annotation:1.8.2"
androidx-annotation = "androidx.annotation:annotation:1.9.0"
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
androidx-benchmark-junit4 = { module = "androidx.benchmark:benchmark-junit4", version.ref = "androidx-benchmark" }
androidx-benchmark-macro-junit4 = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "androidx-benchmark" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.LiveRegionMode
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.liveRegion
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
Expand Down Expand Up @@ -231,7 +233,7 @@ public object VolumeScreenDefaults {
@Composable
public fun IncreaseIcon() {
Icon(
modifier = Modifier.size(26.dp),
modifier = Modifier.size(26.dp).semantics { role = Role.Button },
paintable = Icons.AutoMirrored.Outlined.VolumeUp.asPaintable(),
contentDescription = stringResource(id = R.string.horologist_volume_screen_volume_up_content_description),
)
Expand All @@ -240,7 +242,7 @@ public object VolumeScreenDefaults {
@Composable
public fun DecreaseIcon() {
Icon(
modifier = Modifier.size(26.dp),
modifier = Modifier.size(26.dp).semantics { role = Role.Button },
paintable = Icons.AutoMirrored.Outlined.VolumeDown.asPaintable(),
contentDescription = stringResource(id = R.string.horologist_volume_screen_volume_down_content_description),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScr
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.GoogleSignInPromptScreen
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.GoogleSignInScreen
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.GoogleSignOutScreen
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.NewHotness
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.Samples
import com.google.android.horologist.mediasample.ui.newhotness.NewHotnessPlayerScreen
import com.google.android.horologist.mediasample.ui.player.UampMediaPlayerScreen
import com.google.android.horologist.mediasample.ui.playlists.UampPlaylistsScreen
import com.google.android.horologist.mediasample.ui.playlists.UampPlaylistsScreenViewModel
Expand Down Expand Up @@ -240,6 +242,10 @@ fun UampWearApp(
viewModel = hiltViewModel(),
)
}

composable<NewHotness> {
NewHotnessPlayerScreen()
}
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ object UampNavigationScreen {

@Serializable
public object DeveloperOptions : NavigationScreen

@Serializable
public data object NewHotness : NavigationScreen
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2022 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
*
* https://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.android.horologist.mediasample.ui.newhotness

import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import androidx.media3.common.Player
import androidx.wear.compose.material.Text

@Composable
fun NewHotnessPlayerScreen(
newHotnessPlayerScreenViewModel: NewHotnessPlayerScreenViewModel = hiltViewModel(),
) {
val player: Player? by newHotnessPlayerScreenViewModel.player.collectAsStateWithLifecycle()

Box(modifier = Modifier.fillMaxSize()) {
Text(player.toString(), modifier = Modifier.align(Alignment.Center))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright 2022 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
*
* https://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.android.horologist.mediasample.ui.newhotness

import androidx.lifecycle.ViewModel
import com.google.android.horologist.media.data.repository.PlayerRepositoryImpl
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class NewHotnessPlayerScreenViewModel
@Inject
constructor(
playerRepository: PlayerRepositoryImpl,
) : ViewModel() {

val player = playerRepository.player
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import com.google.android.horologist.compose.layout.ScalingLazyColumnDefaults.pa
import com.google.android.horologist.compose.layout.rememberResponsiveColumnState
import com.google.android.horologist.mediasample.R
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.AudioDebug
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.NewHotness
import com.google.android.horologist.mediasample.ui.navigation.UampNavigationScreen.Samples

@Composable
Expand Down Expand Up @@ -60,6 +61,13 @@ fun DeveloperOptionsScreen(
style = MaterialTheme.typography.title3,
)
}
item {
ActionSetting(
"New Hotness Player",
) {
navController.navigate(NewHotness)
}
}
item {
CheckedSetting(
uiState.networkRequest != null,
Expand Down
4 changes: 2 additions & 2 deletions network-awareness/core/api/current.api
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ package com.google.android.horologist.networks.request {

public interface NetworkLease extends java.lang.AutoCloseable {
method public java.time.Instant getAcquiredAt();
method public kotlinx.coroutines.flow.Flow<com.google.android.horologist.networks.request.NetworkReference> getGrantedNetwork();
method public kotlinx.coroutines.flow.StateFlow<com.google.android.horologist.networks.request.NetworkReference> getGrantedNetwork();
property public abstract java.time.Instant acquiredAt;
property public abstract kotlinx.coroutines.flow.Flow<com.google.android.horologist.networks.request.NetworkReference> grantedNetwork;
property public abstract kotlinx.coroutines.flow.StateFlow<com.google.android.horologist.networks.request.NetworkReference> grantedNetwork;
}

public final class NetworkReference {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.android.horologist.networks.request

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.StateFlow
import java.time.Instant

/**
Expand All @@ -25,5 +25,5 @@ import java.time.Instant
*/
public interface NetworkLease : AutoCloseable {
public val acquiredAt: Instant
public val grantedNetwork: Flow<NetworkReference?>
public val grantedNetwork: StateFlow<NetworkReference?>
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ public class NetworkRequesterImpl(
override fun requestHighBandwidthNetwork(request: HighBandwidthRequest): NetworkLease {
val lease = NetworkLeaseImpl()

connectivityManager.requestNetwork(request.toNetworkRequest(), lease)
try {
connectivityManager.requestNetwork(request.toNetworkRequest(), lease)
} catch (e: Exception) {
// Likely ConnectivityManager$TooManyRequestsException
lease.onUnavailable()
}

return lease
}
Expand Down
Loading

0 comments on commit bf0dd1a

Please sign in to comment.