-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
354 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,3 +56,4 @@ ios/fastlane/report.xml | |
|
||
ios/Runner.app.dSYM.zip | ||
/symbols/ | ||
/pub_cache/ |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("org.jetbrains.kotlin.android") | ||
id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" // this version matches your Kotlin version | ||
|
||
} | ||
|
||
android { | ||
namespace = "com.codel1417.tailApp" | ||
compileSdk = 34 | ||
|
||
defaultConfig { | ||
applicationId = "com.codel1417.tailApp" | ||
minSdk = 30 | ||
targetSdk = 34 | ||
versionCode = 1 | ||
versionName = "1.0" | ||
vectorDrawables { | ||
useSupportLibrary = true | ||
} | ||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro" | ||
) | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_1_8 | ||
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
jvmTarget = "1.8" | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.5.1" | ||
} | ||
packaging { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
} | ||
composeCompiler { | ||
enableStrongSkippingMode = true | ||
|
||
reportsDestination = layout.buildDirectory.dir("compose_compiler") | ||
//stabilityConfigurationFile = rootProject.layout.projectDirectory.file("stability_config.conf") | ||
} | ||
dependencies { | ||
|
||
implementation("com.google.android.gms:play-services-wearable:18.0.0") | ||
implementation(platform("androidx.compose:compose-bom:2023.08.00")) | ||
implementation("androidx.compose.ui:ui") | ||
implementation("androidx.compose.ui:ui-tooling-preview") | ||
implementation("androidx.wear.compose:compose-material:1.2.1") | ||
implementation("androidx.wear.compose:compose-foundation:1.2.1") | ||
implementation("androidx.activity:activity-compose:1.7.2") | ||
implementation("androidx.core:core-splashscreen:1.0.1") | ||
implementation("androidx.wear.tiles:tiles:1.1.0") | ||
implementation("androidx.wear.tiles:tiles-material:1.1.0") | ||
implementation("com.google.android.horologist:horologist-compose-tools:0.4.8") | ||
implementation("com.google.android.horologist:horologist-tiles:0.4.8") | ||
implementation("androidx.wear.watchface:watchface-complications-data-source-ktx:1.1.1") | ||
androidTestImplementation(platform("androidx.compose:compose-bom:2023.08.00")) | ||
androidTestImplementation("androidx.compose.ui:ui-test-junit4") | ||
debugImplementation("androidx.compose.ui:ui-tooling") | ||
debugImplementation("androidx.compose.ui:ui-test-manifest") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<lint> | ||
<!-- Ignore the IconLocation for the Tile preview images --> | ||
<issue id="IconLocation"> | ||
<ignore path="res/drawable/tile_preview.png" /> | ||
<ignore path="res/drawable-round/tile_preview.png" /> | ||
</issue> | ||
</lint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-feature android:name="android.hardware.type.watch" /> | ||
|
||
<uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@android:style/Theme.DeviceDefault"> | ||
<service | ||
android:name=".complication.MainComplicationService" | ||
android:exported="true" | ||
android:label="@string/complication_label" | ||
android:permission="com.google.android.wearable.permission.BIND_COMPLICATION_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="android.support.wearable.complications.ACTION_COMPLICATION_UPDATE_REQUEST" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="android.support.wearable.complications.SUPPORTED_TYPES" | ||
android:value="SHORT_TEXT" /> | ||
<meta-data | ||
android:name="android.support.wearable.complications.UPDATE_PERIOD_SECONDS" | ||
android:value="0" /> | ||
</service> | ||
<service | ||
android:name=".tile.MainTileService" | ||
android:exported="true" | ||
android:label="@string/tile_label" | ||
android:permission="com.google.android.wearable.permission.BIND_TILE_PROVIDER"> | ||
<intent-filter> | ||
<action android:name="androidx.wear.tiles.action.BIND_TILE_PROVIDER" /> | ||
</intent-filter> | ||
|
||
<meta-data | ||
android:name="androidx.wear.tiles.PREVIEW" | ||
android:resource="@drawable/tile_preview" /> | ||
</service> | ||
|
||
<uses-library | ||
android:name="com.google.android.wearable" | ||
android:required="true" /> | ||
<!-- | ||
Set to true if your app is Standalone, that is, it does not require the handheld | ||
app to run. | ||
--> | ||
<meta-data | ||
android:name="com.google.android.wearable.standalone" | ||
android:value="true" /> | ||
|
||
<activity | ||
android:name=".presentation.MainActivity" | ||
android:exported="true" | ||
android:taskAffinity="" | ||
android:theme="@style/MainActivityTheme.Starting"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
41 changes: 41 additions & 0 deletions
41
android/wear/src/main/java/com/codel1417/tailApp/complication/MainComplicationService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.codel1417.tailApp.complication | ||
|
||
import androidx.wear.watchface.complications.data.ComplicationData | ||
import androidx.wear.watchface.complications.data.ComplicationType | ||
import androidx.wear.watchface.complications.data.PlainComplicationText | ||
import androidx.wear.watchface.complications.data.ShortTextComplicationData | ||
import androidx.wear.watchface.complications.datasource.ComplicationRequest | ||
import androidx.wear.watchface.complications.datasource.SuspendingComplicationDataSourceService | ||
import java.util.Calendar | ||
|
||
/** | ||
* Skeleton for complication data source that returns short text. | ||
*/ | ||
class MainComplicationService : SuspendingComplicationDataSourceService() { | ||
|
||
override fun getPreviewData(type: ComplicationType): ComplicationData? { | ||
if (type != ComplicationType.SHORT_TEXT) { | ||
return null | ||
} | ||
return createComplicationData("Mon", "Monday") | ||
} | ||
|
||
override suspend fun onComplicationRequest(request: ComplicationRequest): ComplicationData { | ||
return when (Calendar.getInstance().get(Calendar.DAY_OF_WEEK)) { | ||
Calendar.SUNDAY -> createComplicationData("Sun", "Sunday") | ||
Calendar.MONDAY -> createComplicationData("Mon", "Monday") | ||
Calendar.TUESDAY -> createComplicationData("Tue", "Tuesday") | ||
Calendar.WEDNESDAY -> createComplicationData("Wed", "Wednesday") | ||
Calendar.THURSDAY -> createComplicationData("Thu", "Thursday") | ||
Calendar.FRIDAY -> createComplicationData("Fri!", "Friday!") | ||
Calendar.SATURDAY -> createComplicationData("Sat", "Saturday") | ||
else -> throw IllegalArgumentException("too many days") | ||
} | ||
} | ||
|
||
private fun createComplicationData(text: String, contentDescription: String) = | ||
ShortTextComplicationData.Builder( | ||
text = PlainComplicationText.Builder(text).build(), | ||
contentDescription = PlainComplicationText.Builder(contentDescription).build() | ||
).build() | ||
} |
17 changes: 17 additions & 0 deletions
17
android/wear/src/main/java/com/codel1417/tailApp/presentation/theme/Theme.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package com.codel1417.tailApp.presentation.theme | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.wear.compose.material.MaterialTheme | ||
|
||
@Composable | ||
fun _androidTheme( | ||
content: @Composable () -> Unit | ||
) { | ||
/** | ||
* Empty theme to customize for your app. | ||
* See: https://developer.android.com/jetpack/compose/designsystems/custom | ||
*/ | ||
MaterialTheme( | ||
content = content | ||
) | ||
} |
70 changes: 70 additions & 0 deletions
70
android/wear/src/main/java/com/codel1417/tailApp/tile/MainTileService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package com.codel1417.tailApp.tile | ||
|
||
import android.content.Context | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.platform.LocalContext | ||
import androidx.compose.ui.tooling.preview.Devices | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.wear.protolayout.ColorBuilders.argb | ||
import androidx.wear.protolayout.LayoutElementBuilders | ||
import androidx.wear.protolayout.ResourceBuilders | ||
import androidx.wear.protolayout.TimelineBuilders | ||
import androidx.wear.protolayout.material.Colors | ||
import androidx.wear.protolayout.material.Text | ||
import androidx.wear.protolayout.material.Typography | ||
import androidx.wear.protolayout.material.layouts.PrimaryLayout | ||
import androidx.wear.tiles.RequestBuilders | ||
import androidx.wear.tiles.TileBuilders | ||
import com.google.android.horologist.annotations.ExperimentalHorologistApi | ||
import com.google.android.horologist.compose.tools.LayoutRootPreview | ||
import com.google.android.horologist.compose.tools.buildDeviceParameters | ||
import com.google.android.horologist.tiles.SuspendingTileService | ||
|
||
private const val RESOURCES_VERSION = "0" | ||
|
||
/** | ||
* Skeleton for a tile with no images. | ||
*/ | ||
@OptIn(ExperimentalHorologistApi::class) | ||
class MainTileService : SuspendingTileService() { | ||
|
||
override suspend fun resourcesRequest( | ||
requestParams: RequestBuilders.ResourcesRequest | ||
): ResourceBuilders.Resources { | ||
return ResourceBuilders.Resources.Builder().setVersion(RESOURCES_VERSION).build() | ||
} | ||
|
||
override suspend fun tileRequest( | ||
requestParams: RequestBuilders.TileRequest | ||
): TileBuilders.Tile { | ||
val singleTileTimeline = TimelineBuilders.Timeline.Builder().addTimelineEntry( | ||
TimelineBuilders.TimelineEntry.Builder().setLayout( | ||
LayoutElementBuilders.Layout.Builder().setRoot(tileLayout(this)).build() | ||
).build() | ||
).build() | ||
|
||
return TileBuilders.Tile.Builder().setResourcesVersion(RESOURCES_VERSION) | ||
.setTileTimeline(singleTileTimeline).build() | ||
} | ||
} | ||
|
||
private fun tileLayout(context: Context): LayoutElementBuilders.LayoutElement { | ||
return PrimaryLayout.Builder(buildDeviceParameters(context.resources)) | ||
.setContent( | ||
Text.Builder(context, "Hello World!") | ||
.setColor(argb(Colors.DEFAULT.onSurface)) | ||
.setTypography(Typography.TYPOGRAPHY_CAPTION1) | ||
.build() | ||
).build() | ||
} | ||
|
||
@Preview( | ||
device = Devices.WEAR_OS_SMALL_ROUND, | ||
showSystemUi = true, | ||
backgroundColor = 0xff000000, | ||
showBackground = true | ||
) | ||
@Composable | ||
fun TilePreview() { | ||
LayoutRootPreview(root = tileLayout(LocalContext.current)) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
|
||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<item | ||
android:width="48dp" | ||
android:height="48dp" | ||
android:gravity="center"> | ||
<shape android:shape="oval"> | ||
<solid android:color="#FFFFFF" /> | ||
</shape> | ||
</item> | ||
<item | ||
android:width="40dp" | ||
android:height="40dp" | ||
android:gravity="center"> | ||
<vector | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:tint="#000000" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M17.6,11.48 L19.44,8.3a0.63,0.63 0,0 0,-1.09 -0.63l-1.88,3.24a11.43,11.43 0,0 0,-8.94 0L5.65,7.67a0.63,0.63 0,0 0,-1.09 0.63L6.4,11.48A10.81,10.81 0,0 0,1 20L23,20A10.81,10.81 0,0 0,17.6 11.48ZM7,17.25A1.25,1.25 0,1 1,8.25 16,1.25 1.25,0 0,1 7,17.25ZM17,17.25A1.25,1.25 0,1 1,18.25 16,1.25 1.25,0 0,1 17,17.25Z" /> | ||
</vector> | ||
</item> | ||
</layer-list> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<resources> | ||
<string name="hello_world">From the Round world,\nHello, %1$s!</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<resources> | ||
<string name="app_name">The Tail Co</string> | ||
<!-- | ||
This string is used for square devices and overridden by hello_world in | ||
values-round/strings.xml for round devices. | ||
--> | ||
<string name="hello_world">From the Square world,\nHello, %1$s!</string> | ||
<string name="tile_label">Example tile</string> | ||
<string name="complication_label">Example complication</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<resources> | ||
|
||
<style name="MainActivityTheme.Starting" parent="Theme.SplashScreen"> | ||
<item name="windowSplashScreenBackground">@android:color/black</item> | ||
<item name="windowSplashScreenAnimatedIcon">@drawable/splash_icon</item> | ||
<item name="postSplashScreenTheme">@android:style/Theme.DeviceDefault</item> | ||
</style> | ||
</resources> |