-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
17 changed files
with
265 additions
and
0 deletions.
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
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 |
---|---|---|
|
@@ -23,3 +23,4 @@ include(":core") | |
include(":domain") | ||
include(":data") | ||
include(":presentation") | ||
include(":stempo") |
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,61 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("org.jetbrains.kotlin.android") | ||
} | ||
|
||
android { | ||
namespace = Constants.packageName | ||
compileSdk = Constants.compileSdk | ||
|
||
defaultConfig { | ||
applicationId = Constants.packageName | ||
minSdk = Constants.minSdk | ||
targetSdk = Constants.targetSdk | ||
versionCode = Constants.versionCode | ||
versionName = Constants.versionName | ||
vectorDrawables { | ||
useSupportLibrary = true | ||
} | ||
|
||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = Versions.javaVersion | ||
targetCompatibility = Versions.javaVersion | ||
} | ||
kotlinOptions { | ||
jvmTarget = Versions.jvmVersion | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion = "1.5.1" | ||
} | ||
packaging { | ||
resources { | ||
excludes += "/META-INF/{AL2.0,LGPL2.1}" | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
|
||
implementation(libs.play.services.wearable) | ||
implementation(platform(libs.androidx.compose.bom)) | ||
implementation(libs.androidx.ui) | ||
implementation(libs.androidx.ui.tooling.preview) | ||
implementation(libs.androidx.compose.material) | ||
implementation(libs.androidx.compose.foundation) | ||
implementation(libs.androidx.activity.compose) | ||
implementation(libs.androidx.core.splashscreen) | ||
androidTestImplementation(platform(libs.androidx.compose.bom)) | ||
androidTestImplementation(libs.androidx.ui.test.junit4) | ||
debugImplementation(libs.androidx.ui.tooling) | ||
debugImplementation(libs.androidx.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,39 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<uses-permission android:name="android.permission.WAKE_LOCK" /> | ||
|
||
<uses-feature android:name="android.hardware.type.watch" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@android:style/Theme.DeviceDefault"> | ||
<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.WatchActivity" | ||
android:exported="true" | ||
android:taskAffinity="" | ||
android:theme="@style/WatchActivityTheme.Starting"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
73 changes: 73 additions & 0 deletions
73
stempo/src/main/java/com/kkkk/stempo/presentation/WatchActivity.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,73 @@ | ||
/* While this template provides a good starting point for using Wear Compose, you can always | ||
* take a look at https://github.com/android/wear-os-samples/tree/main/ComposeStarter and | ||
* https://github.com/android/wear-os-samples/tree/main/ComposeAdvanced to find the most up to date | ||
* changes to the libraries and their usages. | ||
*/ | ||
|
||
package com.kkkk.stempo.presentation | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.stringResource | ||
import androidx.compose.ui.text.style.TextAlign | ||
import androidx.compose.ui.tooling.preview.Devices | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import androidx.wear.compose.material.MaterialTheme | ||
import androidx.wear.compose.material.Text | ||
import androidx.wear.compose.material.TimeText | ||
import com.kkkk.stempo.R | ||
import com.kkkk.stempo.presentation.theme.StempoandroidTheme | ||
|
||
class WatchActivity : ComponentActivity() { | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
installSplashScreen() | ||
|
||
super.onCreate(savedInstanceState) | ||
|
||
setTheme(android.R.style.Theme_DeviceDefault) | ||
|
||
setContent { | ||
WearApp("Android") | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun WearApp(greetingName: String) { | ||
StempoandroidTheme { | ||
Box( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.background(MaterialTheme.colors.background), | ||
contentAlignment = Alignment.Center | ||
) { | ||
TimeText() | ||
Greeting(greetingName = greetingName) | ||
} | ||
} | ||
} | ||
|
||
@Composable | ||
fun Greeting(greetingName: String) { | ||
Text( | ||
modifier = Modifier.fillMaxWidth(), | ||
textAlign = TextAlign.Center, | ||
color = MaterialTheme.colors.primary, | ||
text = stringResource(R.string.hello_world, greetingName) | ||
) | ||
} | ||
|
||
@Preview(device = Devices.WEAR_OS_SMALL_ROUND, showSystemUi = true) | ||
@Composable | ||
fun DefaultPreview() { | ||
WearApp("Preview Android") | ||
} |
17 changes: 17 additions & 0 deletions
17
stempo/src/main/java/com/kkkk/stempo/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.kkkk.stempo.presentation.theme | ||
|
||
import androidx.compose.runtime.Composable | ||
import androidx.wear.compose.material.MaterialTheme | ||
|
||
@Composable | ||
fun StempoandroidTheme( | ||
content: @Composable () -> Unit | ||
) { | ||
/** | ||
* Empty theme to customize for your app. | ||
* See: https://developer.android.com/jetpack/compose/designsystems/custom | ||
*/ | ||
MaterialTheme( | ||
content = content | ||
) | ||
} |
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> |
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,8 @@ | ||
<resources> | ||
<string name="app_name">stempo</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> | ||
</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="WatchActivityTheme.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> |