initial commit

This commit is contained in:
Dhya 2024-10-02 18:22:28 -07:00
commit dd76a6a1a3
55 changed files with 989 additions and 0 deletions

1
app/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/build

67
app/build.gradle.kts Normal file
View file

@ -0,0 +1,67 @@
//@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.kotlinAndroid)
}
android {
namespace = "io.ixlo.changes_wear"
compileSdk = 35
defaultConfig {
applicationId = "io.ixlo.changes_wear"
minSdk = 31
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_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.15"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
dependencies {
implementation(libs.play.services.wearable)
implementation(platform(libs.compose.bom))
implementation(libs.ui)
implementation(libs.ui.tooling.preview)
implementation(libs.compose.material)
implementation(libs.compose.foundation)
implementation(libs.activity.compose)
implementation(libs.core.splashscreen)
implementation(libs.wear.tooling.preview)
androidTestImplementation(platform(libs.compose.bom))
androidTestImplementation(libs.ui.test.junit4)
debugImplementation(libs.ui.tooling)
debugImplementation(libs.ui.test.manifest)
}

8
app/lint.xml Normal file
View file

@ -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>

21
app/proguard-rules.pro vendored Normal file
View file

@ -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

View file

@ -0,0 +1,20 @@
{
"version": 3,
"artifactType": {
"type": "APK",
"kind": "Directory"
},
"applicationId": "io.ixlo.changes_wear",
"variantName": "release",
"elements": [
{
"type": "SINGLE",
"filters": [],
"attributes": [],
"versionCode": 1,
"versionName": "1.0",
"outputFile": "app-release.apk"
}
],
"elementType": "File"
}

View file

@ -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.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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

View file

@ -0,0 +1,22 @@
package io.ixlo.changes_wear.presentation
class Hexagram(hexList: List<Int>) {
private val hex = hexList
override fun toString(): String {
var str = ""
for (line in hex) {
str += mapOf(
6 to "---X---\n",
7 to "-------\n",
8 to "--- ---\n",
9 to "---O---\n"
)[line]
}
return str
}
}

View file

@ -0,0 +1,131 @@
/* 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 io.ixlo.changes_wear.presentation
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.wear.compose.material.Button
import androidx.wear.compose.material.ButtonDefaults
import androidx.wear.compose.material.MaterialTheme
import androidx.wear.compose.material.Text
import androidx.wear.tooling.preview.devices.WearDevices
import io.ixlo.changes_wear.R
import io.ixlo.changes_wear.presentation.theme.Changes易Theme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
installSplashScreen()
super.onCreate(savedInstanceState)
setTheme(android.R.style.Theme_DeviceDefault)
setContent {
ChangesApp()
}
}
}
private fun genHex(): Hexagram {
val lineMap = mapOf(1 to 6, 2 to 9, 3 to 9, 4 to 9, 5 to 7,
6 to 7, 7 to 7, 8 to 7, 9 to 7, 10 to 8, 11 to 8,
12 to 8, 13 to 8, 14 to 8, 15 to 8, 16 to 8
)
var hex = mutableListOf<Int>()
for (i in 1..6) {
hex.add(lineMap[(1..16).random()]!!)
}
return Hexagram(hex.toList())
}
@Composable
fun ChangesApp() {
var hex by rememberSaveable {
mutableStateOf("\n\n\n\n\n\n")
}
Changes易Theme {
Box(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colors.background),
contentAlignment = Alignment.Center
) {
//TimeText()
//Greeting(greetingName = greetingName)
Column(
modifier = Modifier
//.padding(it)
.padding(12.dp)
.fillMaxSize(),
verticalArrangement = Arrangement.Bottom,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(
text = hex.toString(),
fontSize = 18.sp,
fontFamily = FontFamily.Monospace,
//fontWeight = FontWeight.Bold
)
Button(
onClick = { hex = genHex().toString() },
colors = ButtonDefaults.buttonColors(
backgroundColor = Color.Red
)
) {
Text(
text = stringResource(R.string.divineButton),
fontSize = 24.sp,
color = Color.Black
//fontWeight = FontWeight.Bold
)
}
}
}
}
}
/*@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 = WearDevices.LARGE_ROUND, showSystemUi = true)
@Composable
fun DefaultPreview() {
ChangesApp()
}

View file

@ -0,0 +1,17 @@
package io.ixlo.changes_wear.presentation.theme
import androidx.compose.runtime.Composable
import androidx.wear.compose.material.MaterialTheme
@Composable
fun Changes易Theme(
content: @Composable () -> Unit
) {
/**
* Empty theme to customize for your app.
* See: https://developer.android.com/jetpack/compose/designsystems/custom
*/
MaterialTheme(
content = content
)
}

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="129"
android:viewportHeight="167.625">
<group android:scaleX="0.35400447"
android:scaleY="0.46"
android:translateX="41.66671"
android:translateY="45.25875">
<group android:translateY="133.66406">
<path android:pathData="M11.953125,-59.484375L117.140625,-59.484375L117.140625,-45.421875L11.953125,-45.421875L11.953125,-59.484375ZM11.953125,-82.203125L54.703125,-82.203125L54.703125,-68.140625L11.953125,-68.140625L11.953125,-82.203125ZM74.390625,-82.203125L117.140625,-82.203125L117.140625,-68.140625L74.390625,-68.140625L74.390625,-82.203125ZM11.953125,-104.984375L117.140625,-104.984375L117.140625,-90.921875L11.953125,-90.921875L11.953125,-104.984375ZM11.953125,8.71875L54.703125,8.71875L54.703125,22.78125L11.953125,22.78125L11.953125,8.71875ZM74.390625,8.71875L117.140625,8.71875L117.140625,22.78125L74.390625,22.78125L74.390625,8.71875ZM11.953125,-14L117.140625,-14L117.140625,0.0625L11.953125,0.0625L11.953125,-14ZM11.953125,-36.78125L117.140625,-36.78125L117.140625,-22.71875L11.953125,-22.71875L11.953125,-36.78125Z"
android:fillColor="#F41404"/>
</group>
</group>
</vector>

View file

@ -0,0 +1,21 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68.17dp"
android:height="15dp"
android:viewportWidth="68.17"
android:viewportHeight="15">
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M0.5,5h28.17v5h-28.17z"
android:strokeColor="#000"/>
<path
android:pathData="M29,7.5a5.5,5 0,1 0,11 0a5.5,5 0,1 0,-11 0z"
android:strokeWidth="5"
android:fillColor="#00000000"
android:strokeColor="#000"/>
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M39.5,5h28.17v5h-28.17z"
android:strokeColor="#000"/>
</vector>

View file

@ -0,0 +1,26 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="19.8dp"
android:viewportWidth="68"
android:viewportHeight="19.8">
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M0.5,7.4h27v5h-27z"
android:strokeColor="#000"/>
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M40.5,7.4h27v5h-27z"
android:strokeColor="#000"/>
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M26.925,0.709l16.263,16.263l-2.121,2.121l-16.263,-16.263z"
android:strokeColor="#000"/>
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M43.191,2.825l-16.263,16.263l-2.121,-2.121l16.263,-16.263z"
android:strokeColor="#000"/>
</vector>

View file

@ -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>

View file

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="10dp"
android:viewportWidth="68"
android:viewportHeight="10">
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M0.5,0.5h67v9h-67z"
android:strokeColor="#000"/>
</vector>

View file

@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="6dp"
android:viewportWidth="68"
android:viewportHeight="6">
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M0.5,0.5h67v5h-67z"
android:strokeColor="#000"/>
</vector>

View file

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="819dp"
android:height="119dp"
android:viewportWidth="819"
android:viewportHeight="119">
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M0.5,0.5h348v118h-348z"
android:strokeColor="#000"/>
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M470.5,0.5h348v118h-348z"
android:strokeColor="#000"/>
</vector>

View file

@ -0,0 +1,16 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="6dp"
android:viewportWidth="68"
android:viewportHeight="6">
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M0.5,0.5h27v5h-27z"
android:strokeColor="#000"/>
<path
android:fillColor="#FF000000"
android:strokeWidth="1"
android:pathData="M40.5,0.5h27v5h-27z"
android:strokeColor="#000"/>
</vector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View file

@ -0,0 +1,3 @@
<resources>
<string name="hello_world">From the Round world,\nHello, %1$s!</string>
</resources>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#0A0A14</color>
</resources>

View file

@ -0,0 +1,9 @@
<resources>
<string name="app_name">Changes 易</string>
<string name="divineButton"></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>

View file

@ -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>