Skip to content

Commit 168641c

Browse files
committed
Wear version of Jetcaster
1 parent 7fb77a5 commit 168641c

35 files changed

+1146
-2
lines changed

Jetcaster/gradle/libs.versions.toml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ gradle-versions = "0.51.0"
3434
hilt = "2.48.1"
3535
hiltExt = "1.1.0"
3636
# @pin When updating to AGP 7.4.0-alpha10 and up we can update this https://developer.android.com/studio/write/java8-support#library-desugaring-versions
37-
jdkDesugar = "1.2.2"
37+
jdkDesugar = "2.0.4"
3838
junit = "4.13.2"
3939
# @pin Update in conjuction with Compose Compiler
4040
kotlin = "1.9.20"
@@ -52,6 +52,17 @@ secrets = "2.0.1"
5252
# @keep
5353
targetSdk = "33"
5454
version-catalog-update = "0.8.4"
55+
playServicesWearable = "18.1.0"
56+
composeMaterial = "1.2.1"
57+
composeFoundation = "1.2.1"
58+
coreSplashscreen = "1.0.1"
59+
horologistComposeTools = "0.4.8"
60+
horologist = "0.5.25"
61+
roborazzi = "1.11.0"
62+
androidx-wear-compose = "1.3.0"
63+
wear-compose-ui-tooling = "1.3.0"
64+
ui-test-manifest = "1.6.3"
65+
ui-test-junit4 = "1.6.3"
5566

5667
[libraries]
5768
accompanist-adaptive = { module = "com.google.accompanist:accompanist-adaptive", version.ref = "accompanist" }
@@ -121,6 +132,7 @@ googlemaps-maps = { module = "com.google.android.gms:play-services-maps", versio
121132
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" }
122133
hilt-android-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
123134
hilt-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hilt" }
135+
dagger-hiltandroidplugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "hilt" }
124136
hilt-ext-compiler = { module = "androidx.hilt:hilt-compiler", version.ref = "hiltExt" }
125137
junit = { module = "junit:junit", version.ref = "junit" }
126138
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" }
@@ -132,6 +144,33 @@ okhttp3 = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
132144
robolectric = { module = "org.robolectric:robolectric", version.ref = "robolectric" }
133145
rometools-modules = { module = "com.rometools:rome-modules", version.ref = "rome" }
134146
rometools-rome = { module = "com.rometools:rome", version.ref = "rome" }
147+
play-services-wearable = { group = "com.google.android.gms", name = "play-services-wearable", version.ref = "playServicesWearable" }
148+
compose-material = { group = "androidx.wear.compose", name = "compose-material", version.ref = "composeMaterial" }
149+
compose-foundation = { group = "androidx.wear.compose", name = "compose-foundation", version.ref = "composeFoundation" }
150+
androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "coreSplashscreen" }
151+
horologist-compose-tools = { group = "com.google.android.horologist", name = "horologist-compose-tools", version.ref = "horologistComposeTools" }
152+
horologist-composables = { module = "com.google.android.horologist:horologist-composables", version.ref = "horologist" }
153+
horologist-compose-layout = { module = "com.google.android.horologist:horologist-compose-layout", version.ref = "horologist" }
154+
horologist-compose-material = { module = "com.google.android.horologist:horologist-compose-material", version.ref = "horologist" }
155+
horologist-media-ui = { module = "com.google.android.horologist:horologist-media-ui", version.ref = "horologist" }
156+
horologist-audio-ui = { module = "com.google.android.horologist:horologist-audio-ui", version.ref = "horologist" }
157+
horologist-media-data = { module = "com.google.android.horologist:horologist-media-data", version.ref = "horologist" }
158+
horologist-roboscreenshots = { module = "com.google.android.horologist:horologist-roboscreenshots", version.ref = "horologist" }
159+
roborazzi = { group = "io.github.takahirom.roborazzi", name = "roborazzi", version.ref = "roborazzi" }
160+
roborazzi-compose = { group = "io.github.takahirom.roborazzi", name = "roborazzi-compose", version.ref = "roborazzi" }
161+
roborazzi-rule = { group = "io.github.takahirom.roborazzi", name = "roborazzi-junit-rule", version.ref = "roborazzi" }
162+
androidx-splashscreen = "androidx.core:core-splashscreen:1.0.1"
163+
wear-compose-foundation = { module = "androidx.wear.compose:compose-foundation", version.ref = "androidx-wear-compose" }
164+
wear-compose-material = { module = "androidx.wear.compose:compose-material", version.ref = "androidx-wear-compose" }
165+
wear-compose-navigation = { module = "androidx.wear.compose:compose-navigation", version.ref = "androidx-wear-compose" }
166+
androidx-material-icons-core = { module = "androidx.compose.material:material-icons-core" }
167+
androidx-wear-compose-ui-tooling = { module = "androidx.wear.compose:compose-ui-tooling", version.ref = "wear-compose-ui-tooling" }
168+
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview" }
169+
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "ui-test-manifest" }
170+
androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "ui-test-junit4" }
171+
test-ext-junit = "androidx.test.ext:junit:1.1.5"
172+
test-espresso-core = "androidx.test.espresso:espresso-core:3.5.1"
173+
compose-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4" }
135174

136175
[plugins]
137176
android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
@@ -145,3 +184,4 @@ kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref =
145184
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
146185
secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets" }
147186
version-catalog-update = { id = "nl.littlerobots.version-catalog-update", version.ref = "version-catalog-update" }
187+
roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }

Jetcaster/settings.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ dependencyResolutionManagement {
3535
}
3636
}
3737
rootProject.name = "Jetcaster"
38-
include(":app", ":core", ":designsystem")
38+
include(":app", ":core", ":designsystem", "wear")
39+

Jetcaster/wear/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

Jetcaster/wear/build.gradle

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
/*
2+
* Copyright 2021 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
plugins {
17+
id 'com.android.application'
18+
id 'org.jetbrains.kotlin.android'
19+
alias libs.plugins.roborazzi
20+
alias(libs.plugins.ksp)
21+
// alias(libs.plugins.hilt)
22+
}
23+
24+
android {
25+
compileSdk 34
26+
27+
namespace "com.example.jetcaster"
28+
29+
defaultConfig {
30+
applicationId "com.example.jetcaster"
31+
minSdk 26
32+
targetSdk 33
33+
versionCode 1
34+
versionName "1.0"
35+
}
36+
37+
buildTypes {
38+
release {
39+
minifyEnabled true
40+
shrinkResources true
41+
signingConfig signingConfigs.debug
42+
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
43+
}
44+
}
45+
46+
compileOptions {
47+
sourceCompatibility JavaVersion.VERSION_17
48+
targetCompatibility JavaVersion.VERSION_17
49+
coreLibraryDesugaringEnabled true
50+
}
51+
testOptions {
52+
unitTests {
53+
includeAndroidResources true
54+
}
55+
}
56+
kotlinOptions {
57+
jvmTarget = JavaVersion.VERSION_17.majorVersion
58+
}
59+
buildFeatures {
60+
compose true
61+
}
62+
composeOptions {
63+
kotlinCompilerExtensionVersion libs.versions.compose.compiler.get()
64+
}
65+
packagingOptions {
66+
resources {
67+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
68+
}
69+
}
70+
}
71+
72+
dependencies {
73+
74+
75+
def composeBom = platform(libs.androidx.compose.bom)
76+
77+
// General compose dependencies
78+
implementation composeBom
79+
implementation libs.androidx.activity.compose
80+
implementation libs.androidx.splashscreen
81+
82+
// Compose for Wear OS Dependencies
83+
// NOTE: DO NOT INCLUDE a dependency on androidx.compose.material:material.
84+
// androidx.wear.compose:compose-material is designed as a replacement not an addition to
85+
// androidx.compose.material:material. If there are features from that you feel are missing from
86+
// androidx.wear.compose:compose-material please raise a bug to let us know:
87+
// https://issuetracker.google.com/issues/new?component=1077552&template=1598429&pli=1
88+
implementation libs.wear.compose.material
89+
90+
// Foundation is additive, so you can use the mobile version in your Wear OS app.
91+
implementation libs.wear.compose.foundation
92+
implementation(libs.androidx.material.icons.core)
93+
implementation(libs.androidx.compose.material.iconsExtended)
94+
95+
// Horologist for correct Compose layout
96+
implementation libs.horologist.composables
97+
implementation libs.horologist.compose.layout
98+
implementation libs.horologist.compose.material
99+
100+
//Horologist Media toolkit
101+
implementation libs.horologist.media.ui
102+
implementation libs.horologist.audio.ui
103+
implementation libs.horologist.media.data
104+
105+
// Preview Tooling
106+
implementation libs.compose.ui.tooling.preview
107+
implementation(libs.androidx.compose.ui.tooling)
108+
implementation libs.androidx.wear.compose.ui.tooling
109+
110+
// If you are using Compose Navigation, use the Wear OS version (NOT the
111+
// androidx.navigation:navigation-compose version), that is, uncomment the line below.
112+
implementation libs.wear.compose.navigation
113+
114+
implementation libs.androidx.ui.test.manifest
115+
116+
implementation(libs.coil.kt.compose)
117+
118+
coreLibraryDesugaring(libs.core.jdk.desugaring)
119+
120+
// implementation libs.hilt.android
121+
// implementation libs.androidx.hilt.navigation.compose
122+
// ksp libs.hilt.compiler
123+
124+
// Testing
125+
testImplementation libs.androidx.ui.test.junit4
126+
testImplementation libs.junit
127+
testImplementation libs.robolectric
128+
testImplementation libs.roborazzi
129+
testImplementation libs.roborazzi.compose
130+
testImplementation libs.roborazzi.rule
131+
testImplementation(libs.horologist.roboscreenshots) {
132+
exclude(group: "com.github.QuickBirdEng.kotlin-snapshot-testing")
133+
}
134+
135+
androidTestImplementation libs.test.ext.junit
136+
androidTestImplementation libs.test.espresso.core
137+
androidTestImplementation libs.compose.ui.test.junit4
138+
androidTestImplementation composeBom
139+
140+
debugImplementation(libs.androidx.compose.ui.tooling)
141+
debugImplementation libs.androidx.ui.test.manifest
142+
debugImplementation composeBom
143+
}

Jetcaster/wear/proguard-rules.pro

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (C) 2021 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+
# Add project specific ProGuard rules here.
16+
# You can control the set of applied configuration files using the
17+
# proguardFiles setting in build.gradle.
18+
#
19+
# For more details, see
20+
# http://developer.android.com/guide/developing/tools/proguard.html
21+
22+
# If your project uses WebView with JS, uncomment the following
23+
# and specify the fully qualified class name to the JavaScript interface
24+
# class:
25+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
26+
# public *;
27+
#}
28+
29+
# Uncomment this to preserve the line number information for
30+
# debugging stack traces.
31+
#-keepattributes SourceFile,LineNumberTable
32+
33+
# If you keep the line number information, uncomment this to
34+
# hide the original source file name.
35+
#-renamesourcefileattribute SourceFile
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2021 The Android Open Source Project
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
Unless required by applicable law or agreed to in writing, software
9+
distributed under the License is distributed on an "AS IS" BASIS,
10+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
See the License for the specific language governing permissions and
12+
limitations under the License.
13+
-->
14+
<manifest
15+
xmlns:android="http://schemas.android.com/apk/res/android">
16+
17+
<uses-permission android:name="android.permission.WAKE_LOCK" />
18+
19+
<uses-feature android:name="android.hardware.type.watch" />
20+
21+
<application
22+
android:name=".JetcasterApplication"
23+
android:allowBackup="true"
24+
android:icon="@mipmap/ic_launcher"
25+
android:label="@string/app_name"
26+
android:supportsRtl="true"
27+
android:theme="@android:style/Theme.DeviceDefault">
28+
<uses-library
29+
android:name="com.google.android.wearable"
30+
android:required="true" />
31+
<!--
32+
Set to true if your app is Standalone, that is, it does not require the handheld
33+
app to run.
34+
-->
35+
<meta-data
36+
android:name="com.google.android.wearable.standalone"
37+
android:value="true" />
38+
39+
<activity
40+
android:name=".MainActivity"
41+
android:exported="true"
42+
android:label="@string/app_name"
43+
android:theme="@style/Theme.App.Starting">
44+
<intent-filter>
45+
<action android:name="android.intent.action.MAIN" />
46+
47+
<category android:name="android.intent.category.LAUNCHER" />
48+
</intent-filter>
49+
</activity>
50+
</application>
51+
52+
</manifest>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2022 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.jetcaster
18+
19+
import android.app.Application
20+
import android.os.StrictMode
21+
import coil.ImageLoader
22+
import coil.ImageLoaderFactory
23+
24+
class JetcasterWearApplication : Application(), ImageLoaderFactory {
25+
26+
override fun onCreate() {
27+
super.onCreate()
28+
setStrictMode()
29+
}
30+
31+
private fun setStrictMode() {
32+
StrictMode.setThreadPolicy(
33+
StrictMode.ThreadPolicy.Builder()
34+
.detectDiskReads()
35+
.detectDiskWrites()
36+
.detectNetwork()
37+
.penaltyLog()
38+
.build(),
39+
)
40+
}
41+
42+
override fun newImageLoader(): ImageLoader {
43+
return ImageLoader.Builder(this)
44+
// Disable `Cache-Control` header support as some podcast images disable disk caching.
45+
.respectCacheHeaders(false)
46+
.build()
47+
}
48+
}

0 commit comments

Comments
 (0)