Add barebones wearos module
This commit is contained in:
parent
62afd5e85f
commit
c9f1922e79
15 changed files with 163 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
<option value="$PROJECT_DIR$/piholeclient" />
|
<option value="$PROJECT_DIR$/piholeclient" />
|
||||||
|
<option value="$PROJECT_DIR$/wearos" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
<option name="resolveModulePerSourceSet" value="false" />
|
<option name="resolveModulePerSourceSet" value="false" />
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
include ':app', ':piholeclient'
|
include ':app', ':piholeclient', ':wearos'
|
||||||
rootProject.name='Pi-helper'
|
rootProject.name='Pi-helper'
|
||||||
|
|
1
wearos/.gitignore
vendored
Normal file
1
wearos/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/build
|
34
wearos/build.gradle
Normal file
34
wearos/build.gradle
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
apply plugin: 'com.android.application'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 29
|
||||||
|
buildToolsVersion "29.0.3"
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
applicationId "com.wbrawner.pihelper.wearos"
|
||||||
|
minSdkVersion 28
|
||||||
|
targetSdkVersion 29
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||||
|
implementation 'com.google.android.support:wearable:2.4.0'
|
||||||
|
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
|
||||||
|
implementation 'androidx.percentlayout:percentlayout:1.0.0'
|
||||||
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||||
|
implementation 'androidx.recyclerview:recyclerview:1.0.0'
|
||||||
|
implementation 'androidx.wear:wear:1.0.0'
|
||||||
|
compileOnly 'com.google.android.wearable:wearable:2.4.0'
|
||||||
|
}
|
21
wearos/proguard-rules.pro
vendored
Normal file
21
wearos/proguard-rules.pro
vendored
Normal 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
|
38
wearos/src/main/AndroidManifest.xml
Normal file
38
wearos/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.wbrawner.pihelper.wearos">
|
||||||
|
|
||||||
|
<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=".MainActivity"
|
||||||
|
android:label="@string/title_activity_main">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.wbrawner.pihelper.wearos
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.support.wearable.activity.WearableActivity
|
||||||
|
|
||||||
|
class MainActivity : WearableActivity() {
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
|
// Enables Always-on
|
||||||
|
setAmbientEnabled()
|
||||||
|
}
|
||||||
|
}
|
25
wearos/src/main/res/layout/activity_main.xml
Normal file
25
wearos/src/main/res/layout/activity_main.xml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.wear.widget.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/dark_grey"
|
||||||
|
android:padding="@dimen/box_inset_layout_padding"
|
||||||
|
tools:context=".MainActivity"
|
||||||
|
tools:deviceIds="wear">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:padding="@dimen/inner_frame_layout_padding"
|
||||||
|
app:boxedEdges="all">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/text"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/hello_world" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.wear.widget.BoxInsetLayout>
|
BIN
wearos/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
BIN
wearos/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
BIN
wearos/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
BIN
wearos/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
wearos/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
BIN
wearos/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
BIN
wearos/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
BIN
wearos/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.7 KiB |
3
wearos/src/main/res/values-round/strings.xml
Normal file
3
wearos/src/main/res/values-round/strings.xml
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<resources>
|
||||||
|
<string name="hello_world">Hello Round World!</string>
|
||||||
|
</resources>
|
15
wearos/src/main/res/values/dimens.xml
Normal file
15
wearos/src/main/res/values/dimens.xml
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<!--
|
||||||
|
Because the window insets on round devices are larger than 15dp, this padding only applies
|
||||||
|
to square screens.
|
||||||
|
-->
|
||||||
|
<dimen name="box_inset_layout_padding">0dp</dimen>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This padding applies to both square and round screens. The total padding between the buttons
|
||||||
|
and the window insets is box_inset_layout_padding (above variable) on square screens and
|
||||||
|
inner_frame_layout_padding (below variable) on round screens.
|
||||||
|
-->
|
||||||
|
<dimen name="inner_frame_layout_padding">5dp</dimen>
|
||||||
|
</resources>
|
9
wearos/src/main/res/values/strings.xml
Normal file
9
wearos/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">Pi-helper</string>
|
||||||
|
<string name="title_activity_main">MainActivity</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">Hello Square World!</string>
|
||||||
|
</resources>
|
Loading…
Reference in a new issue