release-request-ec9eca95-f98a-4c11-b172-5fd30c89effc-for-git_oc-dr1-release-4270360 snap-temp-L78100000092584425
Change-Id: Ib0ef7d55c0d61efe27e513d426aad30f109fc49a
diff --git a/prebuilts/gradle/AgendaData/Application/build.gradle b/prebuilts/gradle/AgendaData/Application/build.gradle
index d053b96..ea34a82 100644
--- a/prebuilts/gradle/AgendaData/Application/build.gradle
+++ b/prebuilts/gradle/AgendaData/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.android.support:design:24.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
@@ -35,7 +38,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/AgendaData/Wearable/build.gradle b/prebuilts/gradle/AgendaData/Wearable/build.gradle
index 780ff9b..fc4aaa4 100644
--- a/prebuilts/gradle/AgendaData/Wearable/build.gradle
+++ b/prebuilts/gradle/AgendaData/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -43,9 +51,11 @@
versionCode 1
versionName "1.0"
- minSdkVersion 18
+ minSdkVersion 23
targetSdkVersion 25
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/AgendaData/Wearable/src/main/AndroidManifest.xml b/prebuilts/gradle/AgendaData/Wearable/src/main/AndroidManifest.xml
index f8bbdd8..0d48310 100644
--- a/prebuilts/gradle/AgendaData/Wearable/src/main/AndroidManifest.xml
+++ b/prebuilts/gradle/AgendaData/Wearable/src/main/AndroidManifest.xml
@@ -17,7 +17,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.wearable.agendadata" >
- <uses-sdk android:minSdkVersion="20"
+ <uses-sdk android:minSdkVersion="23"
android:targetSdkVersion="25" />
<uses-feature android:name="android.hardware.type.watch" />
diff --git a/prebuilts/gradle/AlwaysOn/Wearable/build.gradle b/prebuilts/gradle/AlwaysOn/Wearable/build.gradle
index 9b5c934..332123f 100644
--- a/prebuilts/gradle/AlwaysOn/Wearable/build.gradle
+++ b/prebuilts/gradle/AlwaysOn/Wearable/build.gradle
@@ -5,24 +5,32 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
+ compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +43,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -43,9 +52,12 @@
versionCode 1
versionName "1.0"
- minSdkVersion 24
+ minSdkVersion 23
- targetSdkVersion 25
+ targetSdkVersion 26
+
+ multiDexEnabled true
+
}
compileOptions {
diff --git a/prebuilts/gradle/AlwaysOn/Wearable/src/main/java/com/example/android/wearable/wear/alwayson/MainActivity.java b/prebuilts/gradle/AlwaysOn/Wearable/src/main/java/com/example/android/wearable/wear/alwayson/MainActivity.java
index 3673545..6afd814 100644
--- a/prebuilts/gradle/AlwaysOn/Wearable/src/main/java/com/example/android/wearable/wear/alwayson/MainActivity.java
+++ b/prebuilts/gradle/AlwaysOn/Wearable/src/main/java/com/example/android/wearable/wear/alwayson/MainActivity.java
@@ -24,7 +24,6 @@
import android.os.Handler;
import android.os.Message;
import android.support.wearable.activity.WearableActivity;
-import android.support.wearable.view.WatchViewStub;
import android.util.Log;
import android.widget.TextView;
@@ -124,22 +123,14 @@
ambientStateIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
+ mTimeTextView = (TextView) findViewById(R.id.time);
+ mTimeStampTextView = (TextView) findViewById(R.id.time_stamp);
+ mStateTextView = (TextView) findViewById(R.id.state);
+ mUpdateRateTextView = (TextView) findViewById(R.id.update_rate);
+ mDrawCountTextView = (TextView) findViewById(R.id.draw_count);
- /** Determines whether watch is round or square and applies proper view. **/
- final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
- stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
- @Override
- public void onLayoutInflated(WatchViewStub stub) {
+ refreshDisplayAndSetNextUpdate();
- mTimeTextView = (TextView) stub.findViewById(R.id.time);
- mTimeStampTextView = (TextView) stub.findViewById(R.id.time_stamp);
- mStateTextView = (TextView) stub.findViewById(R.id.state);
- mUpdateRateTextView = (TextView) stub.findViewById(R.id.update_rate);
- mDrawCountTextView = (TextView) stub.findViewById(R.id.draw_count);
-
- refreshDisplayAndSetNextUpdate();
- }
- });
}
/**
diff --git a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/activity_main.xml b/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/activity_main.xml
index d808e6b..90570c3 100644
--- a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/activity_main.xml
+++ b/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/activity_main.xml
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
-
<!-- Copyright (C) 2015 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,15 +13,54 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.WatchViewStub
+<android.support.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:id="@+id/watch_view_stub"
+ android:background="@color/dark_grey"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:rectLayout="@layout/rect_activity_main"
- app:roundLayout="@layout/round_activity_main"
- tools:context=".MainActivity"
- tools:deviceIds="wear">
-</android.support.wearable.view.WatchViewStub>
+ tools:context=".MainActivity">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ app:boxedEdges="all">
+
+ <TextView
+ android:id="@+id/time"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textSize="24sp"
+ android:text="Hello, time!"/>
+
+ <TextView
+ android:id="@+id/time_stamp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Hello, timestamp!"/>
+
+ <TextView
+ android:id="@+id/state"
+ android:textColor="@color/green"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Hello, state!"/>
+
+ <TextView
+ android:id="@+id/update_rate"
+ android:textColor="@color/green"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Hello, update rate!"/>
+
+ <TextView
+ android:id="@+id/draw_count"
+ android:textColor="@color/green"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Hello, draw count!"/>
+
+ </LinearLayout>
+</android.support.wear.widget.BoxInsetLayout>
diff --git a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/rect_activity_main.xml b/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/rect_activity_main.xml
deleted file mode 100644
index bfb8147..0000000
--- a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/rect_activity_main.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:paddingTop="@dimen/square_top_margin"
- android:paddingLeft="@dimen/square_left_margin"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- tools:context=".MainActivity"
- tools:deviceIds="wear_square">
-
- <TextView
- android:id="@+id/time"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="24sp"
- android:text="Hello, time!"/>
-
- <TextView
- android:id="@+id/time_stamp"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, timestamp!"/>
-
- <TextView
- android:id="@+id/state"
- android:textColor="@color/green"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, state!"/>
-
- <TextView
- android:id="@+id/update_rate"
- android:textColor="@color/green"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, update rate!"/>
-
- <TextView
- android:id="@+id/draw_count"
- android:textColor="@color/green"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, draw count!"/>
-</LinearLayout>
diff --git a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/round_activity_main.xml b/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/round_activity_main.xml
deleted file mode 100644
index 8fa7a2d..0000000
--- a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/layout/round_activity_main.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:paddingTop="@dimen/round_top_margin"
- android:paddingLeft="@dimen/round_left_margin"
- android:layout_width="match_parent"
- android:orientation="vertical"
- android:layout_height="match_parent"
- tools:context=".MainActivity"
- tools:deviceIds="wear_round">
-
- <TextView
- android:id="@+id/time"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="24sp"
- android:text="Hello, time!"/>
-
- <TextView
- android:id="@+id/time_stamp"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, timestamp!"/>
-
- <TextView
- android:id="@+id/state"
- android:textColor="@color/green"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, state!"/>
-
- <TextView
- android:id="@+id/update_rate"
- android:textColor="@color/green"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, update rate!"/>
-
- <TextView
- android:id="@+id/draw_count"
- android:textColor="@color/green"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="Hello, draw count!"/>
-</LinearLayout>
diff --git a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/values/dimens.xml b/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/values/dimens.xml
deleted file mode 100644
index d44096a..0000000
--- a/prebuilts/gradle/AlwaysOn/Wearable/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2015 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<resources>
- <!-- Default screen margins, per the Android Design guidelines. -->
- <dimen name="square_top_margin">24dp</dimen>
- <dimen name="square_left_margin">16dp</dimen>
-
- <dimen name="round_top_margin">34dp</dimen>
- <dimen name="round_left_margin">34dp</dimen>
-</resources>
diff --git a/prebuilts/gradle/DataLayer/Application/build.gradle b/prebuilts/gradle/DataLayer/Application/build.gradle
index 418d1ea..2ab2620 100644
--- a/prebuilts/gradle/DataLayer/Application/build.gradle
+++ b/prebuilts/gradle/DataLayer/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
wearApp project(':Wearable')
@@ -34,7 +37,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/DataLayer/Wearable/build.gradle b/prebuilts/gradle/DataLayer/Wearable/build.gradle
index 780ff9b..c393601 100644
--- a/prebuilts/gradle/DataLayer/Wearable/build.gradle
+++ b/prebuilts/gradle/DataLayer/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 18
targetSdkVersion 25
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/DelayedConfirmation/Application/build.gradle b/prebuilts/gradle/DelayedConfirmation/Application/build.gradle
index e51a1bc..49b1770 100644
--- a/prebuilts/gradle/DelayedConfirmation/Application/build.gradle
+++ b/prebuilts/gradle/DelayedConfirmation/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
wearApp project(':Wearable')
@@ -34,7 +37,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/DelayedConfirmation/Wearable/build.gradle b/prebuilts/gradle/DelayedConfirmation/Wearable/build.gradle
index d364fdc..e00b0d4 100644
--- a/prebuilts/gradle/DelayedConfirmation/Wearable/build.gradle
+++ b/prebuilts/gradle/DelayedConfirmation/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 18
targetSdkVersion 22
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/ElizaChat/Application/build.gradle b/prebuilts/gradle/ElizaChat/Application/build.gradle
index d833639..312518e 100644
--- a/prebuilts/gradle/ElizaChat/Application/build.gradle
+++ b/prebuilts/gradle/ElizaChat/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
}
// The sample build uses multiple directories to
@@ -31,7 +34,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/FindMyPhone/Application/build.gradle b/prebuilts/gradle/FindMyPhone/Application/build.gradle
index e51a1bc..49b1770 100644
--- a/prebuilts/gradle/FindMyPhone/Application/build.gradle
+++ b/prebuilts/gradle/FindMyPhone/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
wearApp project(':Wearable')
@@ -34,7 +37,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/FindMyPhone/Wearable/build.gradle b/prebuilts/gradle/FindMyPhone/Wearable/build.gradle
index d364fdc..e00b0d4 100644
--- a/prebuilts/gradle/FindMyPhone/Wearable/build.gradle
+++ b/prebuilts/gradle/FindMyPhone/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 18
targetSdkVersion 22
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/Flashlight/Wearable/build.gradle b/prebuilts/gradle/Flashlight/Wearable/build.gradle
index d364fdc..e00b0d4 100644
--- a/prebuilts/gradle/Flashlight/Wearable/build.gradle
+++ b/prebuilts/gradle/Flashlight/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 18
targetSdkVersion 22
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/Geofencing/Application/build.gradle b/prebuilts/gradle/Geofencing/Application/build.gradle
index 3ba1096..7cd3bdc 100644
--- a/prebuilts/gradle/Geofencing/Application/build.gradle
+++ b/prebuilts/gradle/Geofencing/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.google.android.gms:play-services-location:10.2.4'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
@@ -35,7 +38,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/Geofencing/Wearable/build.gradle b/prebuilts/gradle/Geofencing/Wearable/build.gradle
index d364fdc..e00b0d4 100644
--- a/prebuilts/gradle/Geofencing/Wearable/build.gradle
+++ b/prebuilts/gradle/Geofencing/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 18
targetSdkVersion 22
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/GridViewPager/Wearable/build.gradle b/prebuilts/gradle/GridViewPager/Wearable/build.gradle
index 9b5c934..d1db5d1 100644
--- a/prebuilts/gradle/GridViewPager/Wearable/build.gradle
+++ b/prebuilts/gradle/GridViewPager/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 24
targetSdkVersion 25
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/JumpingJack/Wearable/build.gradle b/prebuilts/gradle/JumpingJack/Wearable/build.gradle
index 9b5c934..d1db5d1 100644
--- a/prebuilts/gradle/JumpingJack/Wearable/build.gradle
+++ b/prebuilts/gradle/JumpingJack/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 24
targetSdkVersion 25
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/Notifications/Application/build.gradle b/prebuilts/gradle/Notifications/Application/build.gradle
index 418d1ea..2ab2620 100644
--- a/prebuilts/gradle/Notifications/Application/build.gradle
+++ b/prebuilts/gradle/Notifications/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
wearApp project(':Wearable')
@@ -34,7 +37,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/Notifications/Wearable/build.gradle b/prebuilts/gradle/Notifications/Wearable/build.gradle
index 780ff9b..c393601 100644
--- a/prebuilts/gradle/Notifications/Wearable/build.gradle
+++ b/prebuilts/gradle/Notifications/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 18
targetSdkVersion 25
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/Quiz/Application/build.gradle b/prebuilts/gradle/Quiz/Application/build.gradle
index e51a1bc..49b1770 100644
--- a/prebuilts/gradle/Quiz/Application/build.gradle
+++ b/prebuilts/gradle/Quiz/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
wearApp project(':Wearable')
@@ -34,7 +37,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/Quiz/Wearable/build.gradle b/prebuilts/gradle/Quiz/Wearable/build.gradle
index d364fdc..e00b0d4 100644
--- a/prebuilts/gradle/Quiz/Wearable/build.gradle
+++ b/prebuilts/gradle/Quiz/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 18
targetSdkVersion 22
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/RecipeAssistant/Application/build.gradle b/prebuilts/gradle/RecipeAssistant/Application/build.gradle
index d833639..312518e 100644
--- a/prebuilts/gradle/RecipeAssistant/Application/build.gradle
+++ b/prebuilts/gradle/RecipeAssistant/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,13 +13,16 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
}
// The sample build uses multiple directories to
@@ -31,7 +34,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/.build.gradle.ftl.swp b/prebuilts/gradle/RuntimePermissionsWear/Application/.build.gradle.ftl.swp
new file mode 100644
index 0000000..30e2d05
--- /dev/null
+++ b/prebuilts/gradle/RuntimePermissionsWear/Application/.build.gradle.ftl.swp
Binary files differ
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Application/build.gradle b/prebuilts/gradle/RuntimePermissionsWear/Application/build.gradle
index 268fbf5..b27d2b5 100644
--- a/prebuilts/gradle/RuntimePermissionsWear/Application/build.gradle
+++ b/prebuilts/gradle/RuntimePermissionsWear/Application/build.gradle
@@ -5,20 +5,22 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile 'com.android.support:appcompat-v7:24.0.0'
- compile 'com.android.support:design:24.0.0'
+ compile 'com.android.support:appcompat-v7:25.3.1'
+ compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
compile project(':Shared')
@@ -34,7 +36,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Shared/build.gradle b/prebuilts/gradle/RuntimePermissionsWear/Shared/build.gradle
index 48fc325..52e76e2 100644
--- a/prebuilts/gradle/RuntimePermissionsWear/Shared/build.gradle
+++ b/prebuilts/gradle/RuntimePermissionsWear/Shared/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,6 +13,9 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
@@ -26,7 +29,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/build.gradle b/prebuilts/gradle/RuntimePermissionsWear/Wearable/build.gradle
index accb6fc..bbec133 100644
--- a/prebuilts/gradle/RuntimePermissionsWear/Wearable/build.gradle
+++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/build.gradle
@@ -5,25 +5,27 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
+ compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
compile project(':Shared')
}
@@ -37,7 +39,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -45,7 +48,11 @@
versionCode 1
versionName "1.0"
- targetSdkVersion 25
+ minSdkVersion 23
+
+ targetSdkVersion 26
+
+ multiDexEnabled true
}
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/MainWearActivity.java b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/MainWearActivity.java
index b2a2595..774715f 100644
--- a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/MainWearActivity.java
+++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/java/com/example/android/wearable/runtimepermissions/MainWearActivity.java
@@ -26,7 +26,6 @@
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.wearable.activity.WearableActivity;
-import android.support.wearable.view.WatchViewStub;
import android.util.Log;
import android.view.View;
import android.widget.Button;
@@ -108,30 +107,22 @@
mPhoneRequestingWearSensorPermission =
getIntent().getBooleanExtra(EXTRA_PROMPT_PERMISSION_FROM_PHONE, false);
- final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
- stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
- @Override
- public void onLayoutInflated(WatchViewStub stub) {
+ mWearBodySensorsPermissionButton =
+ (Button) findViewById(R.id.wear_body_sensors_permission_button);
- mWearBodySensorsPermissionButton =
- (Button) stub.findViewById(R.id.wearBodySensorsPermissionButton);
+ if (mWearBodySensorsPermissionApproved) {
+ mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds(
+ R.drawable.ic_permission_approved, 0, 0, 0);
+ }
- if (mWearBodySensorsPermissionApproved) {
- mWearBodySensorsPermissionButton.setCompoundDrawablesWithIntrinsicBounds(
- R.drawable.ic_permission_approved, 0, 0, 0);
- }
+ mPhoneStoragePermissionButton = (Button) findViewById(R.id.phone_storage_permission_button);
- mPhoneStoragePermissionButton =
- (Button) stub.findViewById(R.id.phoneStoragePermissionButton);
+ mOutputTextView = (TextView) findViewById(R.id.output);
- mOutputTextView = (TextView) stub.findViewById(R.id.output);
+ if (mPhoneRequestingWearSensorPermission) {
+ launchPermissionDialogForPhone();
+ }
- if (mPhoneRequestingWearSensorPermission) {
- launchPermissionDialogForPhone();
- }
-
- }
- });
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_main.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_main.xml
index 588ff9a..b0e9034 100644
--- a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_main.xml
+++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_main.xml
@@ -12,15 +12,54 @@
limitations under the License.
-->
-<android.support.wearable.view.WatchViewStub
+<android.support.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:id="@+id/watch_view_stub"
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:rectLayout="@layout/rect_activity_main"
- app:roundLayout="@layout/round_activity_main"
- tools:context=".MainActivity"
+ tools:context=".MainWearActivity"
tools:deviceIds="wear">
-</android.support.wearable.view.WatchViewStub>
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ app:boxedEdges="all">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <Button
+ android:id="@+id/wear_body_sensors_permission_button"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:drawableLeft="@drawable/ic_permission_denied"
+ android:textSize="8sp"
+ android:text="@string/button_wear_label_activity_main"
+ android:onClick="onClickWearBodySensors" />
+
+ <Button
+ android:id="@+id/phone_storage_permission_button"
+ android:layout_width="0dp"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:drawableLeft="@drawable/ic_permission_denied"
+ android:textSize="8sp"
+ android:text="@string/button_phone_label_activity_main"
+ android:onClick="onClickPhoneStorage" />
+ </LinearLayout>
+
+ <TextView
+ android:id="@+id/output"
+ android:layout_width="match_parent"
+ android:layout_height="0dp"
+ android:layout_weight="2"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:text="@string/hello_wear_activity_main" />
+ </LinearLayout>
+
+</android.support.wear.widget.BoxInsetLayout>
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_request_permission_on_phone.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_request_permission_on_phone.xml
index c8a5d05..f96d80b 100644
--- a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_request_permission_on_phone.xml
+++ b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/activity_request_permission_on_phone.xml
@@ -12,7 +12,7 @@
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout
+<android.support.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"
@@ -30,7 +30,7 @@
android:layout_height="wrap_content"
android:onClick="onClickPermissionPhoneStorage"
android:orientation="vertical"
- app:layout_box="all">
+ app:boxedEdges="all">
<TextView
android:layout_width="wrap_content"
@@ -71,4 +71,4 @@
android:textColor="#0086D4"/>
</LinearLayout>
</LinearLayout>
-</android.support.wearable.view.BoxInsetLayout>
\ No newline at end of file
+</android.support.wear.widget.BoxInsetLayout>
\ No newline at end of file
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/rect_activity_main.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/rect_activity_main.xml
deleted file mode 100644
index 5a44894..0000000
--- a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/rect_activity_main.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2015 Google Inc. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- tools:context=".MainActivity"
- tools:deviceIds="wear_square">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- android:id="@+id/wearBodySensorsPermissionButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:drawableLeft="@drawable/ic_permission_denied"
- android:textSize="8sp"
- android:text="@string/button_wear_label_activity_main"
- android:onClick="onClickWearBodySensors" />
-
- <Button
- android:id="@+id/phoneStoragePermissionButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:drawableLeft="@drawable/ic_permission_denied"
- android:textSize="8sp"
- android:text="@string/button_phone_label_activity_main"
- android:onClick="onClickPhoneStorage" />
- </LinearLayout>
-
- <TextView
- android:id="@+id/output"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="2"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
- android:text="@string/hello_wear_activity_main" />
-</LinearLayout>
diff --git a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/round_activity_main.xml b/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/round_activity_main.xml
deleted file mode 100644
index d35012d..0000000
--- a/prebuilts/gradle/RuntimePermissionsWear/Wearable/src/main/res/layout/round_activity_main.xml
+++ /dev/null
@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright 2015 Google Inc. All rights reserved.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
- http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- tools:context=".MainActivity"
- tools:deviceIds="wear_round"
- android:paddingTop="24dp"
- android:paddingLeft="10dp"
- android:paddingRight="10dp">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Button
- android:id="@+id/wearBodySensorsPermissionButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:drawableLeft="@drawable/ic_permission_denied"
- android:textSize="8sp"
- android:text="@string/button_wear_label_activity_main"
- android:onClick="onClickWearBodySensors" />
-
- <Button
- android:id="@+id/phoneStoragePermissionButton"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:drawableLeft="@drawable/ic_permission_denied"
- android:textSize="8sp"
- android:text="@string/button_phone_label_activity_main"
- android:onClick="onClickPhoneStorage" />
- </LinearLayout>
-
- <TextView
- android:id="@+id/output"
- android:layout_width="match_parent"
- android:layout_height="0dp"
- android:layout_weight="2"
- android:paddingLeft="8dp"
- android:paddingRight="8dp"
- android:text="@string/hello_wear_activity_main" />
-
-</LinearLayout>
diff --git a/prebuilts/gradle/SkeletonWearableApp/Wearable/build.gradle b/prebuilts/gradle/SkeletonWearableApp/Wearable/build.gradle
index 4c9b52e..1b4353f 100644
--- a/prebuilts/gradle/SkeletonWearableApp/Wearable/build.gradle
+++ b/prebuilts/gradle/SkeletonWearableApp/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 24
targetSdkVersion 22
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/SpeedTracker/Application/build.gradle b/prebuilts/gradle/SpeedTracker/Application/build.gradle
index 22086b6..161b0f3 100644
--- a/prebuilts/gradle/SpeedTracker/Application/build.gradle
+++ b/prebuilts/gradle/SpeedTracker/Application/build.gradle
@@ -5,19 +5,21 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile 'com.android.support:design:24.0.0'
+ compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-maps:10.2.4'
compile 'com.google.android.gms:play-services-location:10.2.4'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
@@ -35,7 +37,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/SpeedTracker/Shared/build.gradle b/prebuilts/gradle/SpeedTracker/Shared/build.gradle
index 48fc325..52e76e2 100644
--- a/prebuilts/gradle/SpeedTracker/Shared/build.gradle
+++ b/prebuilts/gradle/SpeedTracker/Shared/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,6 +13,9 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
@@ -26,7 +29,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/SpeedTracker/Wearable/build.gradle b/prebuilts/gradle/SpeedTracker/Wearable/build.gradle
index b24523f..472738b 100644
--- a/prebuilts/gradle/SpeedTracker/Wearable/build.gradle
+++ b/prebuilts/gradle/SpeedTracker/Wearable/build.gradle
@@ -5,26 +5,28 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
+ compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.gms:play-services-location:10.2.4'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
compile project(':Shared')
}
@@ -38,7 +40,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -46,7 +49,11 @@
versionCode 1
versionName "1.0"
- targetSdkVersion 25
+ minSdkVersion 23
+
+ targetSdkVersion 26
+
+ multiDexEnabled true
}
diff --git a/prebuilts/gradle/SpeedTracker/Wearable/src/main/res/layout/speed_picker_activity.xml b/prebuilts/gradle/SpeedTracker/Wearable/src/main/res/layout/speed_picker_activity.xml
index 663988f..2706211 100644
--- a/prebuilts/gradle/SpeedTracker/Wearable/src/main/res/layout/speed_picker_activity.xml
+++ b/prebuilts/gradle/SpeedTracker/Wearable/src/main/res/layout/speed_picker_activity.xml
@@ -14,19 +14,18 @@
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout
+<android.support.wear.widget.BoxInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@android:color/black"
android:layout_height="match_parent"
- android:layout_width="match_parent"
- >
+ android:layout_width="match_parent" >
<RelativeLayout
android:id="@+id/frame_layout"
android:layout_height="match_parent"
android:layout_width="match_parent"
- app:layout_box="left|bottom|right">
+ app:boxedEdges="left|bottom|right">
<android.support.wearable.view.WearableListView
@@ -45,4 +44,4 @@
android:layout_alignParentTop="true"
android:text="@string/speed_limit_header"/>
</RelativeLayout>
-</android.support.wearable.view.BoxInsetLayout>
\ No newline at end of file
+</android.support.wear.widget.BoxInsetLayout>
\ No newline at end of file
diff --git a/prebuilts/gradle/SynchronizedNotifications/Application/build.gradle b/prebuilts/gradle/SynchronizedNotifications/Application/build.gradle
index 915cf6f..eec5f81 100644
--- a/prebuilts/gradle/SynchronizedNotifications/Application/build.gradle
+++ b/prebuilts/gradle/SynchronizedNotifications/Application/build.gradle
@@ -5,15 +5,17 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
@@ -32,7 +34,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/SynchronizedNotifications/Shared/build.gradle b/prebuilts/gradle/SynchronizedNotifications/Shared/build.gradle
index 48fc325..52e76e2 100644
--- a/prebuilts/gradle/SynchronizedNotifications/Shared/build.gradle
+++ b/prebuilts/gradle/SynchronizedNotifications/Shared/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,6 +13,9 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
@@ -26,7 +29,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/SynchronizedNotifications/Wearable/build.gradle b/prebuilts/gradle/SynchronizedNotifications/Wearable/build.gradle
index accb6fc..3b27306 100644
--- a/prebuilts/gradle/SynchronizedNotifications/Wearable/build.gradle
+++ b/prebuilts/gradle/SynchronizedNotifications/Wearable/build.gradle
@@ -5,25 +5,26 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
compile project(':Shared')
}
@@ -37,7 +38,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -45,8 +47,11 @@
versionCode 1
versionName "1.0"
+ minSdkVersion 18
+
targetSdkVersion 25
+
}
compileOptions {
diff --git a/prebuilts/gradle/Timer/Wearable/build.gradle b/prebuilts/gradle/Timer/Wearable/build.gradle
index 4c9b52e..1b4353f 100644
--- a/prebuilts/gradle/Timer/Wearable/build.gradle
+++ b/prebuilts/gradle/Timer/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 24
targetSdkVersion 22
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/WatchFace/Application/build.gradle b/prebuilts/gradle/WatchFace/Application/build.gradle
index 406c677..5a9dcbe 100644
--- a/prebuilts/gradle/WatchFace/Application/build.gradle
+++ b/prebuilts/gradle/WatchFace/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,14 +13,17 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
- compile 'com.google.android.support:wearable:2.0.2'
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
+ compile 'com.google.android.support:wearable:2.0.3'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
wearApp project(':Wearable')
@@ -35,7 +38,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/WatchFace/Application/src/main/AndroidManifest.xml b/prebuilts/gradle/WatchFace/Application/src/main/AndroidManifest.xml
index 4092097..9d06364 100644
--- a/prebuilts/gradle/WatchFace/Application/src/main/AndroidManifest.xml
+++ b/prebuilts/gradle/WatchFace/Application/src/main/AndroidManifest.xml
@@ -23,12 +23,6 @@
<!-- Permissions required by the wearable app -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
- <!-- Requests to calendar are only made on the wear side (CalendarWatchFaceService.java), so
- no runtime permissions are needed on the phone side. -->
- <uses-permission android:name="android.permission.READ_CALENDAR" />
-
- <!-- Location permission used by FitDistanceWatchFaceService -->
- <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- All intent-filters for config actions must include the categories
com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION and
@@ -40,17 +34,6 @@
android:theme="@style/AppTheme" >
<activity
- android:name=".AnalogAndCardBoundsWatchFaceConfigActivity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="com.example.android.wearable.watchface.CONFIG_ANALOG" />
- <action android:name="com.example.android.wearable.watchface.CONFIG_CARD_BOUNDS" />
- <category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
-
- <activity
android:name=".DigitalWatchFaceCompanionConfigActivity"
android:label="@string/app_name">
<intent-filter>
@@ -60,18 +43,6 @@
</intent-filter>
</activity>
- <!-- This activity is needed to allow the user to authorize Google Fit for the Fit Distance
- WatchFace (required to view distance). -->
- <activity
- android:name=".FitDistanceWatchFaceConfigActivity"
- android:label="@string/app_name">
- <intent-filter>
- <action android:name="com.example.android.wearable.watchface.CONFIG_FIT_DISTANCE" />
- <category android:name="com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
- </activity>
-
<activity
android:name=".OpenGLWatchFaceConfigActivity"
android:label="@string/app_name">
@@ -87,5 +58,4 @@
android:value="@integer/google_play_services_version" />
</application>
-
-</manifest>
+</manifest>
\ No newline at end of file
diff --git a/prebuilts/gradle/WatchFace/Application/src/main/java/com/example/android/wearable/watchface/AnalogAndCardBoundsWatchFaceConfigActivity.java b/prebuilts/gradle/WatchFace/Application/src/main/java/com/example/android/wearable/watchface/AnalogAndCardBoundsWatchFaceConfigActivity.java
deleted file mode 100644
index 5943e6b..0000000
--- a/prebuilts/gradle/WatchFace/Application/src/main/java/com/example/android/wearable/watchface/AnalogAndCardBoundsWatchFaceConfigActivity.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.example.android.wearable.watchface;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.os.Bundle;
-import android.support.wearable.companion.WatchFaceCompanion;
-import android.widget.TextView;
-
-public class AnalogAndCardBoundsWatchFaceConfigActivity extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_analog_watch_face_config);
-
- ComponentName name =
- getIntent().getParcelableExtra(WatchFaceCompanion.EXTRA_WATCH_FACE_COMPONENT);
- TextView label = (TextView) findViewById(R.id.label);
- label.setText(label.getText() + " (" + name.getClassName() + ")");
- }
-}
diff --git a/prebuilts/gradle/WatchFace/Application/src/main/java/com/example/android/wearable/watchface/FitDistanceWatchFaceConfigActivity.java b/prebuilts/gradle/WatchFace/Application/src/main/java/com/example/android/wearable/watchface/FitDistanceWatchFaceConfigActivity.java
deleted file mode 100644
index 1d8e4c9..0000000
--- a/prebuilts/gradle/WatchFace/Application/src/main/java/com/example/android/wearable/watchface/FitDistanceWatchFaceConfigActivity.java
+++ /dev/null
@@ -1,255 +0,0 @@
-package com.example.android.wearable.watchface;
-
-import com.google.android.gms.common.ConnectionResult;
-import com.google.android.gms.common.GooglePlayServicesUtil;
-import com.google.android.gms.common.Scopes;
-import com.google.android.gms.common.api.GoogleApiClient;
-import com.google.android.gms.common.api.PendingResult;
-import com.google.android.gms.common.api.ResultCallback;
-import com.google.android.gms.common.api.Scope;
-import com.google.android.gms.common.api.Status;
-import com.google.android.gms.fitness.Fitness;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentSender;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.View;
-import android.widget.Switch;
-import android.widget.Toast;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * Allows users of the Fit WatchFace to tie their Google Fit account to the WatchFace.
- */
-public class FitDistanceWatchFaceConfigActivity extends Activity implements
- GoogleApiClient.ConnectionCallbacks,
- GoogleApiClient.OnConnectionFailedListener {
-
- private static final String TAG = "FitDistanceConfig";
-
- // Request code for launching the Intent to resolve authorization.
- private static final int REQUEST_OAUTH = 1;
-
- // Shared Preference used to record if the user has enabled Google Fit previously.
- private static final String PREFS_FIT_ENABLED_BY_USER =
- "com.example.android.wearable.watchface.preferences.FIT_ENABLED_BY_USER";
-
- /* Tracks whether an authorization activity is stacking over the current activity, i.e., when
- * a known auth error is being resolved, such as showing the account chooser or presenting a
- * consent dialog. This avoids common duplications as might happen on screen rotations, etc.
- */
- private static final String EXTRA_AUTH_STATE_PENDING =
- "com.example.android.wearable.watchface.extra.AUTH_STATE_PENDING";
-
- private static final long FIT_DISABLE_TIMEOUT_SECS = TimeUnit.SECONDS.toMillis(5);;
-
- private boolean mResolvingAuthorization;
-
- private boolean mFitEnabled;
-
- private GoogleApiClient mGoogleApiClient;
-
- private Switch mFitAuthSwitch;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_fit_watch_face_config);
-
- mFitAuthSwitch = (Switch) findViewById(R.id.fit_auth_switch);
-
- if (savedInstanceState != null) {
- mResolvingAuthorization =
- savedInstanceState.getBoolean(EXTRA_AUTH_STATE_PENDING, false);
- } else {
- mResolvingAuthorization = false;
- }
-
- // Checks if user previously enabled/approved Google Fit.
- SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
- mFitEnabled =
- sharedPreferences.getBoolean(PREFS_FIT_ENABLED_BY_USER, false);
-
- mGoogleApiClient = new GoogleApiClient.Builder(this)
- .addApi(Fitness.HISTORY_API)
- .addApi(Fitness.RECORDING_API)
- .addApi(Fitness.CONFIG_API)
- .addScope(new Scope(Scopes.FITNESS_LOCATION_READ_WRITE))
- .addConnectionCallbacks(this)
- .addOnConnectionFailedListener(this)
- .build();
- }
-
- @Override
- protected void onStart() {
- super.onStart();
-
- if ((mFitEnabled) && (mGoogleApiClient != null)) {
-
- mFitAuthSwitch.setChecked(true);
- mFitAuthSwitch.setEnabled(true);
-
- mGoogleApiClient.connect();
-
- } else {
-
- mFitAuthSwitch.setChecked(false);
- mFitAuthSwitch.setEnabled(true);
- }
- }
-
- @Override
- protected void onStop() {
- super.onStop();
-
- if ((mGoogleApiClient != null) && (mGoogleApiClient.isConnected())) {
- mGoogleApiClient.disconnect();
- }
- }
-
- @Override
- protected void onSaveInstanceState(Bundle bundle) {
- super.onSaveInstanceState(bundle);
- bundle.putBoolean(EXTRA_AUTH_STATE_PENDING, mResolvingAuthorization);
- }
-
- @Override
- protected void onRestoreInstanceState(Bundle savedInstanceState) {
- super.onRestoreInstanceState(savedInstanceState);
-
- if (savedInstanceState != null) {
- mResolvingAuthorization =
- savedInstanceState.getBoolean(EXTRA_AUTH_STATE_PENDING, false);
- }
- }
-
- @Override
- protected void onActivityResult(int requestCode, int resultCode, Intent data) {
- Log.d(TAG, "onActivityResult()");
-
- if (requestCode == REQUEST_OAUTH) {
- mResolvingAuthorization = false;
-
- if (resultCode == RESULT_OK) {
- setUserFitPreferences(true);
-
- if (!mGoogleApiClient.isConnecting() && !mGoogleApiClient.isConnected()) {
- mGoogleApiClient.connect();
- }
- } else {
- // User cancelled authorization, reset the switch.
- setUserFitPreferences(false);
- }
- }
- }
-
- @Override
- public void onConnected(Bundle connectionHint) {
- Log.d(TAG, "onConnected: " + connectionHint);
- }
-
- @Override
- public void onConnectionSuspended(int cause) {
-
- if (cause == GoogleApiClient.ConnectionCallbacks.CAUSE_NETWORK_LOST) {
- Log.i(TAG, "Connection lost. Cause: Network Lost.");
- } else if (cause == GoogleApiClient.ConnectionCallbacks.CAUSE_SERVICE_DISCONNECTED) {
- Log.i(TAG, "Connection lost. Reason: Service Disconnected");
- } else {
- Log.i(TAG, "onConnectionSuspended: " + cause);
- }
-
- mFitAuthSwitch.setChecked(false);
- mFitAuthSwitch.setEnabled(true);
- }
-
- @Override
- public void onConnectionFailed(ConnectionResult result) {
- Log.d(TAG, "Connection to Google Fit failed. Cause: " + result.toString());
-
- if (!result.hasResolution()) {
- // User cancelled authorization, reset the switch.
- mFitAuthSwitch.setChecked(false);
- mFitAuthSwitch.setEnabled(true);
- // Show the localized error dialog
- GooglePlayServicesUtil.getErrorDialog(result.getErrorCode(), this, 0).show();
- return;
- }
-
- // Resolve failure if not already trying/authorizing.
- if (!mResolvingAuthorization) {
- try {
- Log.i(TAG, "Attempting to resolve failed GoogleApiClient connection");
- mResolvingAuthorization = true;
- result.startResolutionForResult(this, REQUEST_OAUTH);
- } catch (IntentSender.SendIntentException e) {
- Log.e(TAG, "Exception while starting resolution activity", e);
- }
- }
- }
-
- public void onSwitchClicked(View view) {
-
- boolean userWantsToEnableFit = mFitAuthSwitch.isChecked();
-
- if (userWantsToEnableFit) {
-
- Log.d(TAG, "User wants to enable Fit.");
- if ((mGoogleApiClient != null) && (!mGoogleApiClient.isConnected())) {
- mGoogleApiClient.connect();
- }
-
- } else {
- Log.d(TAG, "User wants to disable Fit.");
-
- // Disable switch until disconnect request is finished.
- mFitAuthSwitch.setEnabled(false);
-
- PendingResult<Status> pendingResult = Fitness.ConfigApi.disableFit(mGoogleApiClient);
-
- pendingResult.setResultCallback(new ResultCallback<Status>() {
- @Override
- public void onResult(Status status) {
-
- if (status.isSuccess()) {
- Toast.makeText(
- FitDistanceWatchFaceConfigActivity.this,
- "Disconnected from Google Fit.",
- Toast.LENGTH_LONG).show();
-
- setUserFitPreferences(false);
-
- mGoogleApiClient.disconnect();
-
-
- } else {
- Toast.makeText(
- FitDistanceWatchFaceConfigActivity.this,
- "Unable to disconnect from Google Fit. See logcat for details.",
- Toast.LENGTH_LONG).show();
-
- // Re-set the switch since auth failed.
- setUserFitPreferences(true);
- }
- }
- }, FIT_DISABLE_TIMEOUT_SECS, TimeUnit.SECONDS);
- }
- }
-
- private void setUserFitPreferences(boolean userFitPreferences) {
-
- mFitEnabled = userFitPreferences;
- SharedPreferences sharedPreferences = getPreferences(Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = sharedPreferences.edit();
- editor.putBoolean(PREFS_FIT_ENABLED_BY_USER, userFitPreferences);
- editor.commit();
-
- mFitAuthSwitch.setChecked(userFitPreferences);
- mFitAuthSwitch.setEnabled(true);
- }
-}
diff --git a/prebuilts/gradle/WatchFace/Application/src/main/res/layout/activity_analog_watch_face_config.xml b/prebuilts/gradle/WatchFace/Application/src/main/res/layout/activity_analog_watch_face_config.xml
deleted file mode 100644
index ec816c2..0000000
--- a/prebuilts/gradle/WatchFace/Application/src/main/res/layout/activity_analog_watch_face_config.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <TextView
- android:id="@+id/label"
- android:text="@string/analog_config_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
-</FrameLayout>
diff --git a/prebuilts/gradle/WatchFace/Application/src/main/res/layout/activity_fit_watch_face_config.xml b/prebuilts/gradle/WatchFace/Application/src/main/res/layout/activity_fit_watch_face_config.xml
deleted file mode 100644
index 73d1489..0000000
--- a/prebuilts/gradle/WatchFace/Application/src/main/res/layout/activity_fit_watch_face_config.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- tools:context="com.example.android.wearable.watchface.FitDistanceWatchFaceConfigActivity">
-
- <Switch
- android:id="@+id/fit_auth_switch"
- android:text="@string/fit_config_switch_text"
- android:enabled="false"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:onClick="onSwitchClicked"/>
-
-</RelativeLayout>
\ No newline at end of file
diff --git a/prebuilts/gradle/WatchFace/Application/src/main/res/values/strings.xml b/prebuilts/gradle/WatchFace/Application/src/main/res/values/strings.xml
index 275dcd3..06f380f 100644
--- a/prebuilts/gradle/WatchFace/Application/src/main/res/values/strings.xml
+++ b/prebuilts/gradle/WatchFace/Application/src/main/res/values/strings.xml
@@ -14,15 +14,13 @@
limitations under the License.
-->
<resources>
- <string name="analog_config_text">This is the config activity for the Analog and Card Bounds watch faces</string>
<string name="digital_config_text">Digital watch face configuration</string>
- <string name="opengl_config_text">OpenGL watch face configuration</string>
<string name="digital_config_background">Background</string>
<string name="digital_config_hours">Hours</string>
<string name="digital_config_minutes">Minutes</string>
<string name="digital_config_seconds">Seconds</string>
- <string name="fit_config_switch_text">Google Fit</string>
+ <string name="opengl_config_text">OpenGL watch face configuration</string>
<string name="title_no_device_connected">No wearable device is currently connected.</string>
<string name="ok_no_device_connected">OK</string>
diff --git a/prebuilts/gradle/WatchFace/README.md b/prebuilts/gradle/WatchFace/README.md
index d0697f7..c83ff14 100644
--- a/prebuilts/gradle/WatchFace/README.md
+++ b/prebuilts/gradle/WatchFace/README.md
@@ -7,14 +7,34 @@
Introduction
------------
-This sample demonstrates how to create watch faces for android wear and includes a phone app
-and a wearable app. The wearable app has a variety of watch faces including analog, digital,
-opengl, interactive, etc. It also includes a watch-side configuration example.
-The phone app includes a phone-side configuration example.
+This sample demonstrates how to create watch faces for Android Wear.
-The analog watch face demonstrates best practices for using complications in Wear 2.0. It also
-includes a configuration Activity for configuring the watch face styles and complications. We
-recommend you follow this UX pattern for your own watch faces.
+The analog watch face covers best practices for Wear 2.0 including complications and a new
+configuration Activity for configuring both the watch face styles and the complications themselves.
+We recommend you reuse the configuration code and follow the UX patterns in your watch face's
+configuration activity. You can see a preview in the screenshots section of the README.
+
+The analog watch face has three main classes:
+
+- AnalogComplicationWatchFaceService.java (watchface folder) - Renders the watch face and active
+complications.
+
+- AnalogComplicationConfigActivity.java (config folder) - Allows user to adjust watch face settings
+(arm and background colors) and watch face complications.
+
+- AnalogComplicationConfigData.java (models folder) - Populates the configuration screen in the
+previous step by returning a list of items. Each item represents something you can customize on the
+watch face. Items include a preview of the watch face (where you can pick your complications),
+marker color, background color, unread notifications, and background image complication. You can
+extend this and add your own.
+
+
+We include several older watch faces to show best practices for Wear 1.0. If you are targeting
+older devices, you may want to review those watch faces (digital, opengl, and interactive).
+
+The digital watch face includes a watch-side and phone-side configuration example.
+
+This sample includes both a phone app and a wearable app.
Because watch face apps do not have a default Activity in their project, you will need to set your
Configurations to "Do not launch Activity" for both the Wear and Application modules. If you are
@@ -33,7 +53,7 @@
Screenshots
-------------
-<img src="screenshots/analog-face.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-1.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-2.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-face.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-phone-side-config.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-watch-side-config.png" height="400" alt="Screenshot"/> <img src="screenshots/interactive-face.png" height="400" alt="Screenshot"/> <img src="screenshots/tilt-face.png" height="400" alt="Screenshot"/>
+<img src="screenshots/analog-face.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-all.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-1.png" height="400" alt="Screenshot"/> <img src="screenshots/analog-watch-side-config-2.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-face.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-phone-side-config.png" height="400" alt="Screenshot"/> <img src="screenshots/digital-watch-side-config.png" height="400" alt="Screenshot"/> <img src="screenshots/interactive-face.png" height="400" alt="Screenshot"/> <img src="screenshots/tilt-face.png" height="400" alt="Screenshot"/>
Getting Started
---------------
diff --git a/prebuilts/gradle/WatchFace/Wearable/build.gradle b/prebuilts/gradle/WatchFace/Wearable/build.gradle
index 3e51cdd..ec25dfc 100644
--- a/prebuilts/gradle/WatchFace/Wearable/build.gradle
+++ b/prebuilts/gradle/WatchFace/Wearable/build.gradle
@@ -5,25 +5,33 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
- compile 'com.android.support:palette-v7:25.2.0'
+ compile 'com.android.support:palette-v7:26.0.0'
+ compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.2'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.2'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -36,7 +44,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -46,7 +55,9 @@
minSdkVersion 24
- targetSdkVersion 25
+ targetSdkVersion 26
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigActivity.java b/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigActivity.java
index f2e4a16..19e469a 100644
--- a/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigActivity.java
+++ b/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/AnalogComplicationConfigActivity.java
@@ -18,9 +18,10 @@
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.wear.widget.WearableRecyclerView;
import android.support.wearable.complications.ComplicationProviderInfo;
import android.support.wearable.complications.ProviderChooserIntent;
-import android.support.wearable.view.WearableRecyclerView;
import android.util.Log;
import com.example.android.wearable.watchface.R;
@@ -57,7 +58,9 @@
(WearableRecyclerView) findViewById(R.id.wearable_recycler_view);
// Aligns the first and last items on the list vertically centered on the screen.
- mWearableRecyclerView.setCenterEdgeItems(true);
+ mWearableRecyclerView.setEdgeItemsCenteringEnabled(true);
+
+ mWearableRecyclerView.setLayoutManager(new LinearLayoutManager(this));
// Improves performance because we know changes in content do not change the layout size of
// the RecyclerView.
diff --git a/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/ColorSelectionActivity.java b/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/ColorSelectionActivity.java
index cfe713f..3bbfeec 100644
--- a/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/ColorSelectionActivity.java
+++ b/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/ColorSelectionActivity.java
@@ -17,7 +17,8 @@
import android.app.Activity;
import android.os.Bundle;
-import android.support.wearable.view.WearableRecyclerView;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.wear.widget.WearableRecyclerView;
import com.example.android.wearable.watchface.R;
import com.example.android.wearable.watchface.model.AnalogComplicationConfigData;
@@ -54,7 +55,9 @@
(WearableRecyclerView) findViewById(R.id.wearable_recycler_view);
// Aligns the first and last items on the list vertically centered on the screen.
- mConfigAppearanceWearableRecyclerView.setCenterEdgeItems(true);
+ mConfigAppearanceWearableRecyclerView.setEdgeItemsCenteringEnabled(true);
+
+ mConfigAppearanceWearableRecyclerView.setLayoutManager(new LinearLayoutManager(this));
// Improves performance because we know changes in content do not change the layout size of
// the RecyclerView.
diff --git a/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/DigitalWatchFaceWearableConfigActivity.java b/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/DigitalWatchFaceWearableConfigActivity.java
index fd3a373..274a826 100644
--- a/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/DigitalWatchFaceWearableConfigActivity.java
+++ b/prebuilts/gradle/WatchFace/Wearable/src/main/java/com/example/android/wearable/watchface/config/DigitalWatchFaceWearableConfigActivity.java
@@ -23,7 +23,7 @@
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.widget.RecyclerView;
-import android.support.wearable.view.BoxInsetLayout;
+import android.support.wear.widget.BoxInsetLayout;
import android.support.wearable.view.CircledImageView;
import android.support.wearable.view.WearableListView;
import android.util.Log;
diff --git a/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_analog_complication_config.xml b/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_analog_complication_config.xml
index 61beb90..dea517e 100644
--- a/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_analog_complication_config.xml
+++ b/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_analog_complication_config.xml
@@ -21,9 +21,8 @@
android:background="@color/dark_grey"
android:paddingStart="@dimen/activity_config_padding"
android:paddingEnd="@dimen/activity_config_padding">
- <android.support.wearable.view.WearableRecyclerView
+ <android.support.wear.widget.WearableRecyclerView
android:id="@+id/wearable_recycler_view"
android:layout_height="wrap_content"
- android:layout_width="match_parent">
- </android.support.wearable.view.WearableRecyclerView>
+ android:layout_width="match_parent" />
</FrameLayout>
\ No newline at end of file
diff --git a/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_color_selection_config.xml b/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_color_selection_config.xml
index fb7465f..8780ca3 100644
--- a/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_color_selection_config.xml
+++ b/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_color_selection_config.xml
@@ -23,9 +23,8 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
tools:context="com.example.android.wearable.watchface.config.ColorSelectionActivity">
- <android.support.wearable.view.WearableRecyclerView
+ <android.support.wear.widget.WearableRecyclerView
android:id="@+id/wearable_recycler_view"
android:layout_height="wrap_content"
- android:layout_width="match_parent">
- </android.support.wearable.view.WearableRecyclerView>
+ android:layout_width="match_parent" />
</FrameLayout>
\ No newline at end of file
diff --git a/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_digital_config.xml b/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_digital_config.xml
index 1672404..9ec9949 100644
--- a/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_digital_config.xml
+++ b/prebuilts/gradle/WatchFace/Wearable/src/main/res/layout/activity_digital_config.xml
@@ -13,7 +13,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<android.support.wear.widget.BoxInsetLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/content"
android:layout_width="match_parent"
@@ -29,11 +30,11 @@
android:textColor="@color/config_activity_header_text_color"
android:text="@string/digital_background_color"
android:fontFamily="sans-serif-condensed-light"
- app:layout_box="left|top"/>
+ app:boxedEdges="left|top"/>
<android.support.wearable.view.WearableListView
android:id="@+id/color_picker"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
- app:layout_box="left|right"/>
-</android.support.wearable.view.BoxInsetLayout>
+ app:boxedEdges="left|right"/>
+</android.support.wear.widget.BoxInsetLayout>
diff --git a/prebuilts/gradle/WatchFace/screenshots/analog-watch-side-config-all.png b/prebuilts/gradle/WatchFace/screenshots/analog-watch-side-config-all.png
new file mode 100644
index 0000000..a8df49b
--- /dev/null
+++ b/prebuilts/gradle/WatchFace/screenshots/analog-watch-side-config-all.png
Binary files differ
diff --git a/prebuilts/gradle/WatchViewStub/Wearable/build.gradle b/prebuilts/gradle/WatchViewStub/Wearable/build.gradle
index 9b5c934..d1db5d1 100644
--- a/prebuilts/gradle/WatchViewStub/Wearable/build.gradle
+++ b/prebuilts/gradle/WatchViewStub/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 24
targetSdkVersion 25
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/build.gradle b/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/build.gradle
index 6a88e96..748a936 100644
--- a/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/build.gradle
+++ b/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/build.gradle
@@ -5,25 +5,32 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
- compile 'com.android.support:appcompat-v7:25.1.1'
+ compile 'com.android.support:appcompat-v7:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -36,7 +43,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -44,9 +52,11 @@
versionCode 1
versionName "1.0"
- minSdkVersion 25
+ minSdkVersion 23
- targetSdkVersion 25
+ targetSdkVersion 26
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/src/main/res/values/styles.xml b/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/src/main/res/values/styles.xml
index 18b7f83..a8a19de 100644
--- a/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/src/main/res/values/styles.xml
+++ b/prebuilts/gradle/WearComplicationProvidersTestSuite/Wearable/src/main/res/values/styles.xml
@@ -15,6 +15,6 @@
limitations under the License.
-->
<resources>
- <style name="Theme.Base" parent="android:Theme.Holo.Light" />
+ <style name="Theme.Base" parent="android:style/Theme.Material" />
<style name="AppTheme" parent="Theme.Base" />
</resources>
diff --git a/prebuilts/gradle/WearDrawers/Wearable/build.gradle b/prebuilts/gradle/WearDrawers/Wearable/build.gradle
index 9b5c934..332123f 100644
--- a/prebuilts/gradle/WearDrawers/Wearable/build.gradle
+++ b/prebuilts/gradle/WearDrawers/Wearable/build.gradle
@@ -5,24 +5,32 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
+ compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +43,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -43,9 +52,12 @@
versionCode 1
versionName "1.0"
- minSdkVersion 24
+ minSdkVersion 23
- targetSdkVersion 25
+ targetSdkVersion 26
+
+ multiDexEnabled true
+
}
compileOptions {
diff --git a/prebuilts/gradle/WearDrawers/Wearable/src/main/java/com/example/android/wearable/wear/weardrawers/MainActivity.java b/prebuilts/gradle/WearDrawers/Wearable/src/main/java/com/example/android/wearable/wear/weardrawers/MainActivity.java
index 4fc2f2f..da46dc3 100644
--- a/prebuilts/gradle/WearDrawers/Wearable/src/main/java/com/example/android/wearable/wear/weardrawers/MainActivity.java
+++ b/prebuilts/gradle/WearDrawers/Wearable/src/main/java/com/example/android/wearable/wear/weardrawers/MainActivity.java
@@ -20,17 +20,14 @@
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
+import android.support.wear.widget.drawer.WearableActionDrawerView;
+import android.support.wear.widget.drawer.WearableNavigationDrawerView;
import android.support.wearable.activity.WearableActivity;
-import android.support.wearable.view.drawer.WearableActionDrawer;
-import android.support.wearable.view.drawer.WearableDrawerLayout;
-import android.support.wearable.view.drawer.WearableNavigationDrawer;
import android.util.Log;
-import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.Toast;
@@ -40,13 +37,12 @@
* Demonstrates use of Navigation and Action Drawers on Android Wear.
*/
public class MainActivity extends WearableActivity implements
- WearableActionDrawer.OnMenuItemClickListener {
+ MenuItem.OnMenuItemClickListener, WearableNavigationDrawerView.OnItemSelectedListener {
private static final String TAG = "MainActivity";
- private WearableDrawerLayout mWearableDrawerLayout;
- private WearableNavigationDrawer mWearableNavigationDrawer;
- private WearableActionDrawer mWearableActionDrawer;
+ private WearableNavigationDrawerView mWearableNavigationDrawer;
+ private WearableActionDrawerView mWearableActionDrawer;
private ArrayList<Planet> mSolarSystem;
private int mSelectedPlanet;
@@ -77,31 +73,22 @@
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, mPlanetFragment).commit();
- // Main Wearable Drawer Layout that wraps all content
- mWearableDrawerLayout = (WearableDrawerLayout) findViewById(R.id.drawer_layout);
// Top Navigation Drawer
mWearableNavigationDrawer =
- (WearableNavigationDrawer) findViewById(R.id.top_navigation_drawer);
+ (WearableNavigationDrawerView) findViewById(R.id.top_navigation_drawer);
mWearableNavigationDrawer.setAdapter(new NavigationAdapter(this));
+ // Peeks navigation drawer on the top.
+ mWearableNavigationDrawer.getController().peekDrawer();
+ mWearableNavigationDrawer.addOnItemSelectedListener(this);
// Bottom Action Drawer
mWearableActionDrawer =
- (WearableActionDrawer) findViewById(R.id.bottom_action_drawer);
-
+ (WearableActionDrawerView) findViewById(R.id.bottom_action_drawer);
+ // Peeks action drawer on the bottom.
+ mWearableActionDrawer.getController().peekDrawer();
mWearableActionDrawer.setOnMenuItemClickListener(this);
- // Temporarily peeks the navigation and action drawers to ensure the user is aware of them.
- ViewTreeObserver observer = mWearableDrawerLayout.getViewTreeObserver();
- observer.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
- @Override
- public void onGlobalLayout() {
- mWearableDrawerLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this);
- mWearableDrawerLayout.peekDrawer(Gravity.TOP);
- mWearableDrawerLayout.peekDrawer(Gravity.BOTTOM);
- }
- });
-
/* Action Drawer Tip: If you only have a single action for your Action Drawer, you can use a
* (custom) View to peek on top of the content by calling
* mWearableActionDrawer.setPeekContent(View). Make sure you set a click listener to handle
@@ -154,7 +141,7 @@
break;
}
- mWearableDrawerLayout.closeDrawer(mWearableActionDrawer);
+ mWearableActionDrawer.getController().closeDrawer();
if (toastMessage.length() > 0) {
Toast toast = Toast.makeText(
@@ -168,8 +155,20 @@
}
}
+ // Updates content when user changes between items in the navigation drawer.
+ @Override
+ public void onItemSelected(int position) {
+ Log.d(TAG, "WearableNavigationDrawerView triggered onItemSelected(): " + position);
+ mSelectedPlanet = position;
+
+ String selectedPlanetImage = mSolarSystem.get(mSelectedPlanet).getImage();
+ int drawableId =
+ getResources().getIdentifier(selectedPlanetImage, "drawable", getPackageName());
+ mPlanetFragment.updatePlanet(drawableId);
+ }
+
private final class NavigationAdapter
- extends WearableNavigationDrawer.WearableNavigationDrawerAdapter {
+ extends WearableNavigationDrawerView.WearableNavigationDrawerAdapter {
private final Context mContext;
@@ -183,17 +182,6 @@
}
@Override
- public void onItemSelected(int position) {
- Log.d(TAG, "WearableNavigationDrawerAdapter.onItemSelected(): " + position);
- mSelectedPlanet = position;
-
- String selectedPlanetImage = mSolarSystem.get(mSelectedPlanet).getImage();
- int drawableId =
- getResources().getIdentifier(selectedPlanetImage, "drawable", getPackageName());
- mPlanetFragment.updatePlanet(drawableId);
- }
-
- @Override
public String getItemText(int pos) {
return mSolarSystem.get(pos).getName();
}
@@ -222,8 +210,8 @@
}
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public View onCreateView(
+ LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_planet, container, false);
mImageView = ((ImageView) rootView.findViewById(R.id.image));
diff --git a/prebuilts/gradle/WearDrawers/Wearable/src/main/res/layout/activity_main.xml b/prebuilts/gradle/WearDrawers/Wearable/src/main/res/layout/activity_main.xml
index cd23b74..02b1397 100644
--- a/prebuilts/gradle/WearDrawers/Wearable/src/main/res/layout/activity_main.xml
+++ b/prebuilts/gradle/WearDrawers/Wearable/src/main/res/layout/activity_main.xml
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<android.support.wearable.view.drawer.WearableDrawerLayout
+<android.support.wear.widget.drawer.WearableDrawerLayout
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"
@@ -22,8 +22,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
- tools:context="com.example.android.wearable.wear.weardrawers.MainActivity"
- tools:deviceIds="wear">
+ tools:context="com.example.android.wearable.wear.weardrawers.MainActivity">
<android.support.v4.widget.NestedScrollView
android:id="@+id/content"
@@ -38,17 +37,18 @@
</android.support.v4.widget.NestedScrollView>
- <android.support.wearable.view.drawer.WearableNavigationDrawer
+ <android.support.wear.widget.drawer.WearableNavigationDrawerView
android:id="@+id/top_navigation_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/grey" />
+ android:background="@color/grey"
+ app:navigationStyle="multiPage" />
- <android.support.wearable.view.drawer.WearableActionDrawer
+ <android.support.wear.widget.drawer.WearableActionDrawerView
android:id="@+id/bottom_action_drawer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey"
- app:action_menu="@menu/action_drawer_menu" />
+ app:actionMenu="@menu/action_drawer_menu" />
-</android.support.wearable.view.drawer.WearableDrawerLayout>
\ No newline at end of file
+</android.support.wear.widget.drawer.WearableDrawerLayout>
\ No newline at end of file
diff --git a/prebuilts/gradle/WearDrawers/Wearable/src/main/res/values/strings.xml b/prebuilts/gradle/WearDrawers/Wearable/src/main/res/values/strings.xml
index 0a0cd87..b423003 100644
--- a/prebuilts/gradle/WearDrawers/Wearable/src/main/res/values/strings.xml
+++ b/prebuilts/gradle/WearDrawers/Wearable/src/main/res/values/strings.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
<resources>
- <string name="app_name">Wearable Drawer Layout</string>
+ <string name="app_name">Wear Drawers</string>
<!--
Reference name for each planet's information array.
diff --git a/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/build.gradle b/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/build.gradle
index 9b5c934..45663ff 100644
--- a/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/build.gradle
+++ b/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/build.gradle
@@ -5,24 +5,32 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
+ compile 'com.android.support:wear:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +43,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -45,7 +54,10 @@
minSdkVersion 24
- targetSdkVersion 25
+ targetSdkVersion 26
+
+ multiDexEnabled true
+
}
compileOptions {
diff --git a/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/src/main/res/layout/activity_main.xml b/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/src/main/res/layout/activity_main.xml
index 9b716d9..6bbf514 100644
--- a/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/src/main/res/layout/activity_main.xml
+++ b/prebuilts/gradle/WearHighBandwidthNetworking/Wearable/src/main/res/layout/activity_main.xml
@@ -46,14 +46,14 @@
</RelativeLayout>
- <android.support.wearable.view.BoxInsetLayout
+ <android.support.wear.widget.BoxInsetLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
- app:layout_box="left|right">
+ app:boxedEdges="left|right">
<TextView
android:id="@+id/info_text"
@@ -97,5 +97,5 @@
android:visibility="gone" />
</RelativeLayout>
- </android.support.wearable.view.BoxInsetLayout>
+ </android.support.wear.widget.BoxInsetLayout>
</LinearLayout>
\ No newline at end of file
diff --git a/prebuilts/gradle/WearNotifications/Application/build.gradle b/prebuilts/gradle/WearNotifications/Application/build.gradle
index a3ac742..fb5679c 100644
--- a/prebuilts/gradle/WearNotifications/Application/build.gradle
+++ b/prebuilts/gradle/WearNotifications/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,18 +13,18 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
- compile 'com.android.support:appcompat-v7:25.1.1'
- compile 'com.android.support:cardview-v7:25.1.1'
- compile 'com.android.support:design:25.1.1'
+ compile 'com.android.support:appcompat-v7:26.0.0'
+ compile 'com.android.support:cardview-v7:26.0.0'
+ compile 'com.android.support:design:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
+ compile project(':Shared')
wearApp project(':Wearable')
}
@@ -37,12 +37,15 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 26
+
buildToolsVersion "25.0.3"
defaultConfig {
minSdkVersion 18
- targetSdkVersion 24
+ targetSdkVersion 26
+ versionCode 1
+ versionName "1.0"
}
compileOptions {
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java
index 1b1743f..79997e2 100644
--- a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java
+++ b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java
@@ -15,7 +15,7 @@
*/
package com.example.android.wearable.wear.wearnotifications;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.app.NotificationCompat;
/**
* We use a Singleton for a global copy of the NotificationCompat.Builder to update active
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java
index 6c44fcb..004f2de 100644
--- a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java
+++ b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java
@@ -22,6 +22,7 @@
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigPictureStyle;
import android.support.v4.app.NotificationCompat.BigTextStyle;
import android.support.v4.app.NotificationCompat.InboxStyle;
@@ -29,8 +30,8 @@
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
import android.support.v4.app.TaskStackBuilder;
+import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
-import android.support.v7.app.NotificationCompat;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
@@ -39,8 +40,8 @@
import android.widget.Spinner;
import android.widget.TextView;
-
-
+import com.example.android.wearable.wear.common.mock.MockDatabase;
+import com.example.android.wearable.wear.common.util.NotificationUtil;
import com.example.android.wearable.wear.wearnotifications.handlers.BigPictureSocialIntentService;
import com.example.android.wearable.wear.wearnotifications.handlers.BigPictureSocialMainActivity;
import com.example.android.wearable.wear.wearnotifications.handlers.BigTextIntentService;
@@ -48,7 +49,6 @@
import com.example.android.wearable.wear.wearnotifications.handlers.InboxMainActivity;
import com.example.android.wearable.wear.wearnotifications.handlers.MessagingIntentService;
import com.example.android.wearable.wear.wearnotifications.handlers.MessagingMainActivity;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
/**
* The Activity demonstrates several popular Notification.Style examples along with their best
@@ -61,13 +61,13 @@
public static final int NOTIFICATION_ID = 888;
- // Used for Notification Style array and switch statement for Spinner selection
+ // Used for Notification Style array and switch statement for Spinner selection.
private static final String BIG_TEXT_STYLE = "BIG_TEXT_STYLE";
private static final String BIG_PICTURE_STYLE = "BIG_PICTURE_STYLE";
private static final String INBOX_STYLE = "INBOX_STYLE";
private static final String MESSAGING_STYLE = "MESSAGING_STYLE";
- // Collection of notification styles to back ArrayAdapter for Spinner
+ // Collection of notification styles to back ArrayAdapter for Spinner.
private static final String[] NOTIFICATION_STYLES =
{BIG_TEXT_STYLE, BIG_PICTURE_STYLE, INBOX_STYLE, MESSAGING_STYLE};
@@ -83,7 +83,7 @@
private int mSelectedNotification = 0;
- // RelativeLayout is needed for SnackBars to alert users when Notifications are disabled for app
+ // RelativeLayout required for SnackBars to alert users when Notifications are disabled for app.
private RelativeLayout mMainRelativeLayout;
private Spinner mSpinner;
private TextView mNotificationDetailsTextView;
@@ -100,15 +100,15 @@
mNotificationManagerCompat = NotificationManagerCompat.from(getApplicationContext());
- // Create an ArrayAdapter using the string array and a default spinner layout
+ // Create an ArrayAdapter using the string array and a default spinner layout.
ArrayAdapter<CharSequence> adapter =
new ArrayAdapter(
this,
android.R.layout.simple_spinner_item,
NOTIFICATION_STYLES);
- // Specify the layout to use when the list of choices appears
+ // Specify the layout to use when the list of choices appears.
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
- // Apply the adapter to the spinner
+ // Apply the adapter to the spinner.
mSpinner.setAdapter(adapter);
mSpinner.setOnItemSelectedListener(this);
}
@@ -187,28 +187,34 @@
// Main steps for building a BIG_TEXT_STYLE notification:
// 0. Get your data
- // 1. Build the BIG_TEXT_STYLE
- // 2. Set up main Intent for notification
- // 3. Create additional Actions for the Notification
- // 4. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the BIG_TEXT_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Create additional Actions for the Notification
+ // 5. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.BigTextStyleReminderAppData bigTextStyleReminderAppData =
MockDatabase.getBigTextStyleData();
- // 1. Build the BIG_TEXT_STYLE
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, bigTextStyleReminderAppData);
+
+
+ // 2. Build the BIG_TEXT_STYLE.
BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle()
- // Overrides ContentText in the big form of the template
+ // Overrides ContentText in the big form of the template.
.bigText(bigTextStyleReminderAppData.getBigText())
- // Overrides ContentTitle in the big form of the template
+ // Overrides ContentTitle in the big form of the template.
.setBigContentTitle(bigTextStyleReminderAppData.getBigContentTitle())
- // Summary line after the detail section in the big form of the template
+ // Summary line after the detail section in the big form of the template.
// Note: To improve readability, don't overload the user with info. If Summary Text
// doesn't add critical information, you should skip it.
.setSummaryText(bigTextStyleReminderAppData.getSummaryText());
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent notifyIntent = new Intent(this, BigTextMainActivity.class);
// When creating your Intent, you need to take into account the back state, i.e., what
@@ -243,10 +249,10 @@
);
- // 3. Create additional Actions (Intents) for the Notification
+ // 4. Create additional Actions (Intents) for the Notification.
- // In our case, we create two additional actions: a Snooze action and a Dismiss action
- // Snooze Action
+ // In our case, we create two additional actions: a Snooze action and a Dismiss action.
+ // Snooze Action.
Intent snoozeIntent = new Intent(this, BigTextIntentService.class);
snoozeIntent.setAction(BigTextIntentService.ACTION_SNOOZE);
@@ -259,7 +265,7 @@
.build();
- // Dismiss Action
+ // Dismiss Action.
Intent dismissIntent = new Intent(this, BigTextIntentService.class);
dismissIntent.setAction(BigTextIntentService.ACTION_DISMISS);
@@ -272,32 +278,34 @@
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification.
// Because we want this to be a new notification (not updating a previous notification), we
// create a new Builder. Later, we use the same global builder to get back the notification
// we built here for the snooze action, that is, canceling the notification and relaunching
// it several seconds later.
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
Notification notification = notificationCompatBuilder
- // BIG_TEXT_STYLE sets title and content for API 16 (4.1 and after)
+ // BIG_TEXT_STYLE sets title and content for API 16 (4.1 and after).
.setStyle(bigTextStyle)
- // Title for API <16 (4.0 and below) devices
+ // Title for API <16 (4.0 and below) devices.
.setContentTitle(bigTextStyleReminderAppData.getContentTitle())
- // Content for API <24 (7.0 and below) devices
+ // Content for API <24 (7.0 and below) devices.
.setContentText(bigTextStyleReminderAppData.getContentText())
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(
getResources(),
R.drawable.ic_alarm_white_48dp))
.setContentIntent(notifyPendingIntent)
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
// SIDE NOTE: Auto-bundling is enabled for 4 or more notifications on API 24+ (N+)
// devices and all Android Wear devices. If you have more than one notification and
@@ -307,12 +315,17 @@
// .setGroup(GROUP_KEY_YOUR_NAME_HERE)
.setCategory(Notification.CATEGORY_REMINDER)
- .setPriority(Notification.PRIORITY_HIGH)
- // Shows content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PUBLIC)
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(bigTextStyleReminderAppData.getPriority())
- // Adds additional actions specified above
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(bigTextStyleReminderAppData.getChannelLockscreenVisibility())
+
+ // Adds additional actions specified above.
.addAction(snoozeAction)
.addAction(dismissAction)
@@ -336,28 +349,33 @@
// Main steps for building a BIG_PICTURE_STYLE notification:
// 0. Get your data
- // 1. Build the BIG_PICTURE_STYLE
- // 2. Set up main Intent for notification
- // 3. Set up RemoteInput, so users can input (keyboard and voice) from notification
- // 4. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the BIG_PICTURE_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Set up RemoteInput, so users can input (keyboard and voice) from notification
+ // 5. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.BigPictureStyleSocialAppData bigPictureStyleSocialAppData =
MockDatabase.getBigPictureStyleData();
- // 1. Build the BIG_PICTURE_STYLE
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, bigPictureStyleSocialAppData);
+
+ // 2. Build the BIG_PICTURE_STYLE.
BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle()
- // Provides the bitmap for the BigPicture notification
+ // Provides the bitmap for the BigPicture notification.
.bigPicture(
BitmapFactory.decodeResource(
getResources(),
bigPictureStyleSocialAppData.getBigImage()))
- // Overrides ContentTitle in the big form of the template
+ // Overrides ContentTitle in the big form of the template.
.setBigContentTitle(bigPictureStyleSocialAppData.getBigContentTitle())
- // Summary line after the detail section in the big form of the template
+ // Summary line after the detail section in the big form of the template.
.setSummaryText(bigPictureStyleSocialAppData.getSummaryText());
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent mainIntent = new Intent(this, BigPictureSocialMainActivity.class);
// When creating your Intent, you need to take into account the back state, i.e., what
@@ -381,11 +399,11 @@
// https://developer.android.com/training/notify-user/navigation.html
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
- // Adds the back stack
+ // Adds the back stack.
stackBuilder.addParentStack(BigPictureSocialMainActivity.class);
- // Adds the Intent to the top of the stack
+ // Adds the Intent to the top of the stack.
stackBuilder.addNextIntent(mainIntent);
- // Gets a PendingIntent containing the entire back stack
+ // Gets a PendingIntent containing the entire back stack.
PendingIntent mainPendingIntent =
PendingIntent.getActivity(
this,
@@ -394,14 +412,14 @@
PendingIntent.FLAG_UPDATE_CURRENT
);
- // 3. Set up RemoteInput, so users can input (keyboard and voice) from notification
+ // 4. Set up RemoteInput, so users can input (keyboard and voice) from notification.
// Note: For API <24 (M and below) we need to use an Activity, so the lock-screen presents
// the auth challenge. For API 24+ (N and above), we use a Service (could be a
// BroadcastReceiver), so the user can input from Notification or lock-screen (they have
// choice to allow) without leaving the notification.
- // Create the RemoteInput
+ // Create the RemoteInput.
String replyLabel = getString(R.string.reply_label);
RemoteInput remoteInput =
new RemoteInput.Builder(BigPictureSocialIntentService.EXTRA_COMMENT)
@@ -432,32 +450,31 @@
.addRemoteInput(remoteInput)
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification.
// Because we want this to be a new notification (not updating a previous notification), we
// create a new Builder. Later, we use the same global builder to get back the notification
// we built here for a comment on the post.
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // 4. Build and issue the notification
notificationCompatBuilder
- // BIG_PICTURE_STYLE sets title and content for API 16 (4.1 and after)
+ // BIG_PICTURE_STYLE sets title and content for API 16 (4.1 and after).
.setStyle(bigPictureStyle)
- // Title for API <16 (4.0 and below) devices
+ // Title for API <16 (4.0 and below) devices.
.setContentTitle(bigPictureStyleSocialAppData.getContentTitle())
- // Content for API <24 (7.0 and below) devices
+ // Content for API <24 (7.0 and below) devices.
.setContentText(bigPictureStyleSocialAppData.getContentText())
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
// SIDE NOTE: Auto-bundling is enabled for 4 or more notifications on API 24+ (N+)
// devices and all Android Wear devices. If you have more than one notification and
@@ -469,10 +486,15 @@
.setSubText(Integer.toString(1))
.addAction(replyAction)
.setCategory(Notification.CATEGORY_SOCIAL)
- .setPriority(Notification.PRIORITY_HIGH)
- // Hides content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PRIVATE);
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(bigPictureStyleSocialAppData.getPriority())
+
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(bigPictureStyleSocialAppData.getChannelLockscreenVisibility());
// If the phone is in "Do not disturb mode, the user will still be notified if
// the sender(s) is starred as a favorite.
@@ -497,27 +519,32 @@
// Main steps for building a INBOX_STYLE notification:
// 0. Get your data
- // 1. Build the INBOX_STYLE
- // 2. Set up main Intent for notification
- // 3. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the INBOX_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.InboxStyleEmailAppData inboxStyleEmailAppData =
MockDatabase.getInboxStyleData();
- // 1. Build the INBOX_STYLE
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, inboxStyleEmailAppData);
+
+ // 2. Build the INBOX_STYLE.
InboxStyle inboxStyle = new NotificationCompat.InboxStyle()
// This title is slightly different than regular title, since I know INBOX_STYLE is
// available.
.setBigContentTitle(inboxStyleEmailAppData.getBigContentTitle())
.setSummaryText(inboxStyleEmailAppData.getSummaryText());
- // Add each summary line of the new emails, you can add up to 5
+ // Add each summary line of the new emails, you can add up to 5.
for (String summary : inboxStyleEmailAppData.getIndividualEmailSummary()) {
inboxStyle.addLine(summary);
}
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent mainIntent = new Intent(this, InboxMainActivity.class);
// When creating your Intent, you need to take into account the back state, i.e., what
@@ -541,11 +568,11 @@
// https://developer.android.com/training/notify-user/navigation.html
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
- // Adds the back stack
+ // Adds the back stack.
stackBuilder.addParentStack(InboxMainActivity.class);
- // Adds the Intent to the top of the stack
+ // Adds the Intent to the top of the stack.
stackBuilder.addNextIntent(mainIntent);
- // Gets a PendingIntent containing the entire back stack
+ // Gets a PendingIntent containing the entire back stack.
PendingIntent mainPendingIntent =
PendingIntent.getActivity(
this,
@@ -554,38 +581,37 @@
PendingIntent.FLAG_UPDATE_CURRENT
);
- // 3. Build and issue the notification
+ // 4. Build and issue the notification.
// Because we want this to be a new notification (not updating a previous notification), we
// create a new Builder. However, we don't need to update this notification later, so we
// will not need to set a global builder for access to the notification later.
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // 4. Build and issue the notification
notificationCompatBuilder
// INBOX_STYLE sets title and content for API 16+ (4.1 and after) when the
- // notification is expanded
+ // notification is expanded.
.setStyle(inboxStyle)
// Title for API <16 (4.0 and below) devices and API 16+ (4.1 and after) when the
- // notification is collapsed
+ // notification is collapsed.
.setContentTitle(inboxStyleEmailAppData.getContentTitle())
// Content for API <24 (7.0 and below) devices and API 16+ (4.1 and after) when the
- // notification is collapsed
+ // notification is collapsed.
.setContentText(inboxStyleEmailAppData.getContentText())
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
// SIDE NOTE: Auto-bundling is enabled for 4 or more notifications on API 24+ (N+)
// devices and all Android Wear devices. If you have more than one notification and
@@ -594,14 +620,19 @@
// .setGroupSummary(true)
// .setGroup(GROUP_KEY_YOUR_NAME_HERE)
- // Sets large number at the right-hand side of the notification for API <24 devices
+ // Sets large number at the right-hand side of the notification for API <24 devices.
.setSubText(Integer.toString(inboxStyleEmailAppData.getNumberOfNewEmails()))
.setCategory(Notification.CATEGORY_EMAIL)
- .setPriority(Notification.PRIORITY_HIGH)
- // Hides content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PRIVATE);
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(inboxStyleEmailAppData.getPriority())
+
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(inboxStyleEmailAppData.getChannelLockscreenVisibility());
// If the phone is in "Do not disturb mode, the user will still be notified if
// the sender(s) is starred as a favorite.
@@ -625,16 +656,21 @@
// Main steps for building a MESSAGING_STYLE notification:
// 0. Get your data
- // 1. Build the MESSAGING_STYLE
- // 2. Set up main Intent for notification
- // 3. Set up RemoteInput (users can input directly from notification)
- // 4. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the MESSAGING_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Set up RemoteInput (users can input directly from notification)
+ // 5. Build and issue the notification
// 0. Get your data (everything unique per Notification)
MockDatabase.MessagingStyleCommsAppData messagingStyleCommsAppData =
MockDatabase.getMessagingStyleData();
- // 1. Build the Notification.Style (MESSAGING_STYLE)
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, messagingStyleCommsAppData);
+
+ // 2. Build the Notification.Style (MESSAGING_STYLE).
String contentTitle = messagingStyleCommsAppData.getContentTitle();
MessagingStyle messagingStyle =
@@ -647,13 +683,13 @@
// In our case, we use the same title.
.setConversationTitle(contentTitle);
- // Adds all Messages
- // Note: Messages include the text, timestamp, and sender
+ // Adds all Messages.
+ // Note: Messages include the text, timestamp, and sender.
for (MessagingStyle.Message message : messagingStyleCommsAppData.getMessages()) {
messagingStyle.addMessage(message);
}
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent notifyIntent = new Intent(this, MessagingMainActivity.class);
// When creating your Intent, you need to take into account the back state, i.e., what
@@ -692,22 +728,22 @@
);
- // 3. Set up RemoteInput, so users can input (keyboard and voice) from notification
+ // 4. Set up RemoteInput, so users can input (keyboard and voice) from notification.
// Note: For API <24 (M and below) we need to use an Activity, so the lock-screen present
// the auth challenge. For API 24+ (N and above), we use a Service (could be a
// BroadcastReceiver), so the user can input from Notification or lock-screen (they have
// choice to allow) without leaving the notification.
- // Create the RemoteInput specifying this key
+ // Create the RemoteInput specifying this key.
String replyLabel = getString(R.string.reply_label);
RemoteInput remoteInput = new RemoteInput.Builder(MessagingIntentService.EXTRA_REPLY)
.setLabel(replyLabel)
.build();
// Pending intent =
- // API <24 (M and below): activity so the lock-screen presents the auth challenge
- // API 24+ (N and above): this should be a Service or BroadcastReceiver
+ // API <24 (M and below): activity so the lock-screen presents the auth challenge.
+ // API 24+ (N and above): this should be a Service or BroadcastReceiver.
PendingIntent replyActionPendingIntent;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
@@ -725,37 +761,36 @@
replyLabel,
replyActionPendingIntent)
.addRemoteInput(remoteInput)
- // Allows system to generate replies by context of conversation
+ // Allows system to generate replies by context of conversation.
.setAllowGeneratedReplies(true)
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification.
// Because we want this to be a new notification (not updating current notification), we
// create a new Builder. Later, we update this same notification, so we need to save this
// Builder globally (as outlined earlier).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // Builds and issues notification
notificationCompatBuilder
- // MESSAGING_STYLE sets title and content for API 16 and above devices
+ // MESSAGING_STYLE sets title and content for API 16 and above devices.
.setStyle(messagingStyle)
- // Title for API < 16 devices
+ // Title for API < 16 devices.
.setContentTitle(contentTitle)
- // Content for API < 16 devices
+ // Content for API < 16 devices.
.setContentText(messagingStyleCommsAppData.getContentText())
.setSmallIcon(R.drawable.ic_launcher)
.setLargeIcon(BitmapFactory.decodeResource(
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
// SIDE NOTE: Auto-bundling is enabled for 4 or more notifications on API 24+ (N+)
// devices and all Android Wear devices. If you have more than one notification and
@@ -764,15 +799,20 @@
// .setGroupSummary(true)
// .setGroup(GROUP_KEY_YOUR_NAME_HERE)
- // Number of new notifications for API <24 (M and below) devices
+ // Number of new notifications for API <24 (M and below) devices.
.setSubText(Integer.toString(messagingStyleCommsAppData.getNumberOfNewMessages()))
.addAction(replyAction)
.setCategory(Notification.CATEGORY_MESSAGE)
- .setPriority(Notification.PRIORITY_HIGH)
- // Hides content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PRIVATE);
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(messagingStyleCommsAppData.getPriority())
+
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(messagingStyleCommsAppData.getChannelLockscreenVisibility());
// If the phone is in "Do not disturb mode, the user will still be notified if
// the sender(s) is starred as a favorite.
@@ -794,7 +834,7 @@
* is a bad idea.
*/
private void openNotificationSettingsForApp() {
- // Links to this app's notification settings
+ // Links to this app's notification settings.
Intent intent = new Intent();
intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS");
intent.putExtra("app_package", getPackageName());
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java
index 470eedb..30c970b 100644
--- a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java
+++ b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java
@@ -22,17 +22,17 @@
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigPictureStyle;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
import android.support.v4.app.TaskStackBuilder;
-import android.support.v7.app.NotificationCompat;
import android.util.Log;
import com.example.android.wearable.wear.wearnotifications.GlobalNotificationBuilder;
import com.example.android.wearable.wear.wearnotifications.MainActivity;
import com.example.android.wearable.wear.wearnotifications.R;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
+import com.example.android.wearable.wear.common.mock.MockDatabase;
/**
* Asynchronously handles updating social app posts (and active Notification) with comments from
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java
index 8f6664d..bfd577c 100644
--- a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java
+++ b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java
@@ -20,15 +20,15 @@
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.BitmapFactory;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigTextStyle;
import android.support.v4.app.NotificationManagerCompat;
-import android.support.v7.app.NotificationCompat;
import android.util.Log;
import com.example.android.wearable.wear.wearnotifications.GlobalNotificationBuilder;
import com.example.android.wearable.wear.wearnotifications.MainActivity;
import com.example.android.wearable.wear.wearnotifications.R;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
+import com.example.android.wearable.wear.common.mock.MockDatabase;
import java.util.concurrent.TimeUnit;
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java
index 6d30c4f..da56242 100644
--- a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java
+++ b/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java
@@ -22,17 +22,18 @@
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.MessagingStyle;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
import android.support.v4.app.TaskStackBuilder;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.content.ContextCompat;
import android.util.Log;
import com.example.android.wearable.wear.wearnotifications.GlobalNotificationBuilder;
import com.example.android.wearable.wear.wearnotifications.MainActivity;
import com.example.android.wearable.wear.wearnotifications.R;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
+import com.example.android.wearable.wear.common.mock.MockDatabase;
/**
* Asynchronously handles updating messaging app posts (and active Notification) with replies from
@@ -144,49 +145,38 @@
private NotificationCompat.Builder recreateBuilderWithMessagingStyle() {
// Main steps for building a MESSAGING_STYLE notification (for more detailed comments on
- // building this notification, check MainActivity.java)::
+ // building this notification, check MainActivity.java):
// 0. Get your data
- // 1. Build the MESSAGING_STYLE
- // 2. Add support for Wear 1.+
+ // 1. Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the MESSAGING_STYLE
// 3. Set up main Intent for notification
// 4. Set up RemoteInput (users can input directly from notification)
// 5. Build and issue the notification
- // 0. Get your data
+ // 0. Get your data.
MockDatabase.MessagingStyleCommsAppData messagingData =
MockDatabase.getMessagingStyleData();
- // 1. Build the Notification.Style (MESSAGING_STYLE)
+ // 1. Retrieve Notification Channel for O and beyond devices (26+). We don't need to create
+ // the NotificationChannel, since it was created the first time this Notification was
+ // created.
+ String notificationChannelId = messagingData.getChannelId();
+
+ // 2. Build the Notification.Style (MESSAGING_STYLE).
String contentTitle = messagingData.getContentTitle();
MessagingStyle messagingStyle =
new NotificationCompat.MessagingStyle(messagingData.getReplayName())
.setConversationTitle(contentTitle);
- // Adds all Messages
- // Note: Messages include the text, timestamp, and sender
+ // Adds all Messages.
+ // Note: Messages include the text, timestamp, and sender.
for (MessagingStyle.Message message : messagingData.getMessages()) {
messagingStyle.addMessage(message);
}
- // 2. Add support for Wear 1.+
- String fullMessageForWearVersion1 = messagingData.getFullConversation();
-
- Notification chatHistoryForWearV1 = new NotificationCompat.Builder(getApplicationContext())
- .setStyle(new NotificationCompat.BigTextStyle().bigText(fullMessageForWearVersion1))
- .setContentTitle(contentTitle)
- .setSmallIcon(R.drawable.ic_launcher)
- .setContentText(fullMessageForWearVersion1)
- .build();
-
- NotificationCompat.WearableExtender wearableExtenderForWearVersion1 =
- new NotificationCompat.WearableExtender()
- .addPage(chatHistoryForWearV1);
-
-
-
- // 3. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent notifyIntent = new Intent(this, MessagingMainActivity.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
@@ -202,7 +192,7 @@
);
- // 4. Set up RemoteInput, so users can input (keyboard and voice) from notification
+ // 4. Set up RemoteInput, so users can input (keyboard and voice) from notification.
String replyLabel = getString(R.string.reply_label);
RemoteInput remoteInput = new RemoteInput.Builder(MessagingIntentService.EXTRA_REPLY)
.setLabel(replyLabel)
@@ -225,14 +215,17 @@
replyLabel,
replyActionPendingIntent)
.addRemoteInput(remoteInput)
- // Allows system to generate replies by context of conversation
+ // Allows system to generate replies by context of conversation.
.setAllowGeneratedReplies(true)
.build();
- // 5. Build and issue the notification
+ // 5. Build and issue the notification.
+
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
@@ -245,13 +238,12 @@
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setSubText(Integer.toString(messagingData.getNumberOfNewMessages()))
.addAction(replyAction)
.setCategory(Notification.CATEGORY_MESSAGE)
- .setPriority(Notification.PRIORITY_HIGH)
- .setVisibility(Notification.VISIBILITY_PRIVATE)
- .extend(wearableExtenderForWearVersion1);
+ .setPriority(messagingData.getPriority())
+ .setVisibility(messagingData.getChannelLockscreenVisibility());
for (String name : messagingData.getParticipants()) {
notificationCompatBuilder.addPerson(name);
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/earth.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/earth.png
deleted file mode 100644
index 13abd77..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/earth.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_alarm_white_48dp.png
deleted file mode 100644
index 75e5a46..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_alarm_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_cancel_white_48dp.png
deleted file mode 100644
index dc32a14..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_cancel_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_message_black_18dp.png
deleted file mode 100644
index d921ba2..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_message_black_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_person_black_48dp.png
deleted file mode 100644
index f1e1484..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_person_black_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_reply_white_18dp.png
deleted file mode 100644
index cc732ba..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-hdpi/ic_reply_white_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_alarm_white_48dp.png
deleted file mode 100644
index 280e09d..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_alarm_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_cancel_white_48dp.png
deleted file mode 100644
index 6ebbc83..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_cancel_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_message_black_18dp.png
deleted file mode 100644
index 2156f16..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_message_black_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_person_black_48dp.png
deleted file mode 100644
index 360a32f..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_person_black_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_reply_white_18dp.png
deleted file mode 100644
index b336e2f..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-mdpi/ic_reply_white_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_alarm_white_48dp.png
deleted file mode 100644
index aa8102f..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_alarm_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_cancel_white_48dp.png
deleted file mode 100644
index dc775b2..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_cancel_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_message_black_18dp.png
deleted file mode 100644
index 185d613..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_message_black_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_person_black_48dp.png
deleted file mode 100644
index 1ebc37b..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_person_black_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_reply_white_18dp.png
deleted file mode 100644
index 0424c2b..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xhdpi/ic_reply_white_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_alarm_white_48dp.png
deleted file mode 100644
index f665286..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_alarm_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_cancel_white_48dp.png
deleted file mode 100644
index cf2822a..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_cancel_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png
deleted file mode 100644
index e710dee..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_person_black_48dp.png
deleted file mode 100644
index 77e3a18..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_person_black_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_reply_white_18dp.png
deleted file mode 100644
index eeb5d49..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxhdpi/ic_reply_white_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_alarm_white_48dp.png
deleted file mode 100644
index 419f4bb..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_alarm_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_cancel_white_48dp.png
deleted file mode 100644
index 8bea844..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_cancel_white_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png
deleted file mode 100644
index 5456c42..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_person_black_48dp.png
deleted file mode 100644
index 6be3e30..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_person_black_48dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_reply_white_18dp.png
deleted file mode 100644
index de0dad2..0000000
--- a/prebuilts/gradle/WearNotifications/Application/src/main/res/drawable-xxxhdpi/ic_reply_white_18dp.png
+++ /dev/null
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/README.md b/prebuilts/gradle/WearNotifications/README.md
index 7e164fa..eaefd5a 100644
--- a/prebuilts/gradle/WearNotifications/README.md
+++ b/prebuilts/gradle/WearNotifications/README.md
@@ -46,7 +46,7 @@
Pre-requisites
--------------
-- Android SDK 25
+- Android SDK 26
- Android Build Tools v25.0.3
- Android Support Repository
diff --git a/prebuilts/gradle/WearNotifications/Shared/build.gradle b/prebuilts/gradle/WearNotifications/Shared/build.gradle
new file mode 100644
index 0000000..0970e28
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/build.gradle
@@ -0,0 +1,57 @@
+
+buildscript {
+ repositories {
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:2.3.3'
+ }
+}
+
+apply plugin: 'android-library'
+
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
+dependencies {
+ compile 'com.android.support:support-v4:26.0.0'
+}
+
+// The sample build uses multiple directories to
+// keep boilerplate and common code separate from
+// the main sample code.
+List<String> dirs = [
+ 'main', // main sample code; look here for the interesting stuff.
+ 'common', // components that are reused by multiple samples
+ 'template'] // boilerplate code that is generated by the sample template process
+
+android {
+ compileSdkVersion 26
+
+ buildToolsVersion "25.0.3"
+
+ defaultConfig {
+ minSdkVersion 18
+ targetSdkVersion 26
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+
+ sourceSets {
+ main {
+ dirs.each { dir ->
+ java.srcDirs "src/${dir}/java"
+ res.srcDirs "src/${dir}/res"
+ }
+ }
+
+ }
+}
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/AndroidManifest.xml b/prebuilts/gradle/WearNotifications/Shared/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..0f49418
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/AndroidManifest.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2017 Google Inc. All rights reserved.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.wearable.wear.wearnotifications.common">
+
+ <application android:allowBackup="true" android:label="@string/app_name">
+
+ </application>
+
+</manifest>
diff --git a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/mock/MockDatabase.java b/prebuilts/gradle/WearNotifications/Shared/src/main/java/com/example/android/wearable/wear/common/mock/MockDatabase.java
similarity index 62%
rename from prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/mock/MockDatabase.java
rename to prebuilts/gradle/WearNotifications/Shared/src/main/java/com/example/android/wearable/wear/common/mock/MockDatabase.java
index b552f6d..de25111 100644
--- a/prebuilts/gradle/WearNotifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/mock/MockDatabase.java
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/java/com/example/android/wearable/wear/common/mock/MockDatabase.java
@@ -1,8 +1,25 @@
-package com.example.android.wearable.wear.wearnotifications.mock;
+/*
+ * Copyright (C) 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.example.android.wearable.wear.common.mock;
+import android.app.NotificationManager;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.MessagingStyle;
-import com.example.android.wearable.wear.wearnotifications.R;
+import com.example.android.wearable.wear.wearnotifications.common.R;
import java.util.ArrayList;
@@ -30,20 +47,15 @@
/**
* Represents data needed for BigTextStyle Notification.
*/
- public static class BigTextStyleReminderAppData {
+ public static class BigTextStyleReminderAppData extends MockNotificationData {
private static BigTextStyleReminderAppData sInstance = null;
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
-
- // Style notification values
+ // Unique data for this Notification.Style:
private String mBigContentTitle;
private String mBigText;
private String mSummaryText;
-
public static BigTextStyleReminderAppData getInstance() {
if (sInstance == null) {
sInstance = getSync();
@@ -61,24 +73,30 @@
}
private BigTextStyleReminderAppData() {
- // Standard Notification values
- // Title for API <16 (4.0 and below) devices
- mContentTitle = "Don't forget to...";
- // Content for API <24 (4.0 and below) devices
- mContentText = "Feed Dogs and check garage!";
- // BigText Style Notification values
+ // Standard Notification values:
+ // Title for API <16 (4.0 and below) devices.
+ mContentTitle = "Don't forget to...";
+ // Content for API <24 (4.0 and below) devices.
+ mContentText = "Feed Dogs and check garage!";
+ mPriority = NotificationCompat.PRIORITY_DEFAULT;
+
+ // BigText Style Notification values:
mBigContentTitle = "Don't forget to...";
mBigText = "... feed the dogs before you leave for work, and check the garage to "
- + "make sure the door is closed.";
+ + "make sure the door is closed.";
mSummaryText = "Dogs and Garage";
- }
- public String getContentTitle() {
- return mContentTitle;
- }
- public String getContentText() {
- return mContentText;
+
+ // Notification channel values (for devices targeting 26 and above):
+ mChannelId = "channel_reminder_1";
+ // The user-visible name of the channel.
+ mChannelName = "Sample Reminder";
+ // The user-visible description of the channel.
+ mChannelDescription = "Sample Reminder Notifications";
+ mChannelImportance = NotificationManager.IMPORTANCE_DEFAULT;
+ mChannelEnableVibrate = false;
+ mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PUBLIC;
}
public String getBigContentTitle() {
@@ -102,14 +120,11 @@
/**
* Represents data needed for BigPictureStyle Notification.
*/
- public static class BigPictureStyleSocialAppData {
+ public static class BigPictureStyleSocialAppData extends MockNotificationData {
+
private static BigPictureStyleSocialAppData sInstance = null;
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
-
- // Style notification values
+ // Unique data for this Notification.Style:
private int mBigImage;
private String mBigContentTitle;
private String mSummaryText;
@@ -118,7 +133,6 @@
private ArrayList<String> mParticipants;
-
public static BigPictureStyleSocialAppData getInstance() {
if (sInstance == null) {
sInstance = getSync();
@@ -135,29 +149,32 @@
}
private BigPictureStyleSocialAppData() {
- // Standard Notification values
- // Title/Content for API <16 (4.0 and below) devices
+ // Standard Notification values:
+ // Title/Content for API <16 (4.0 and below) devices.
mContentTitle = "Bob's Post";
mContentText = "[Picture] Like my shot of Earth?";
+ mPriority = NotificationCompat.PRIORITY_HIGH;
- // Style notification values
+ // Style notification values:
mBigImage = R.drawable.earth;
mBigContentTitle = "Bob's Post";
mSummaryText = "Like my shot of Earth?";
- // This would be possible responses based on the contents of the post
+ // This would be possible responses based on the contents of the post.
mPossiblePostResponses = new CharSequence[]{"Yes", "No", "Maybe?"};
mParticipants = new ArrayList<>();
mParticipants.add("Bob Smith");
- }
- public String getContentTitle() {
- return mContentTitle;
- }
-
- public String getContentText() {
- return mContentText;
+ // Notification channel values (for devices targeting 26 and above):
+ mChannelId = "channel_social_1";
+ // The user-visible name of the channel.
+ mChannelName = "Sample Social";
+ // The user-visible description of the channel.
+ mChannelDescription = "Sample Social Notifications";
+ mChannelImportance = NotificationManager.IMPORTANCE_HIGH;
+ mChannelEnableVibrate = true;
+ mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
public int getBigImage() {
@@ -189,15 +206,12 @@
/**
* Represents data needed for InboxStyle Notification.
*/
- public static class InboxStyleEmailAppData {
+ public static class InboxStyleEmailAppData extends MockNotificationData {
+
private static InboxStyleEmailAppData sInstance = null;
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
+ // Unique data for this Notification.Style:
private int mNumberOfNewEmails;
-
- // Style notification values
private String mBigContentTitle;
private String mSummaryText;
private ArrayList<String> mIndividualEmailSummary;
@@ -220,17 +234,18 @@
}
private InboxStyleEmailAppData() {
- // Standard Notification values
- // Title/Content for API <16 (4.0 and below) devices
+ // Standard Notification values:
+ // Title/Content for API <16 (4.0 and below) devices.
mContentTitle = "5 new emails";
mContentText = "from Jane, Jay, Alex +2 more";
mNumberOfNewEmails = 5;
+ mPriority = NotificationCompat.PRIORITY_DEFAULT;
- // Style notification values
+ // Style notification values:
mBigContentTitle = "5 new emails from Jane, Jay, Alex +2";
mSummaryText = "New emails";
- // Add each summary line of the new emails, you can add up to 5
+ // Add each summary line of the new emails, you can add up to 5.
mIndividualEmailSummary = new ArrayList<>();
mIndividualEmailSummary.add("Jane Faab - Launch Party is here...");
mIndividualEmailSummary.add("Jay Walker - There's a turtle on the server!");
@@ -246,14 +261,17 @@
mParticipants.add("Alex Chang");
mParticipants.add("Jane Johns");
mParticipants.add("John Smith");
- }
- public String getContentTitle() {
- return mContentTitle;
- }
- public String getContentText() {
- return mContentText;
+ // Notification channel values (for devices targeting 26 and above):
+ mChannelId = "channel_email_1";
+ // The user-visible name of the channel.
+ mChannelName = "Sample Email";
+ // The user-visible description of the channel.
+ mChannelDescription = "Sample Email Notifications";
+ mChannelImportance = NotificationManager.IMPORTANCE_DEFAULT;
+ mChannelEnableVibrate = true;
+ mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
}
public int getNumberOfNewEmails() {
@@ -285,23 +303,20 @@
/**
* Represents data needed for MessagingStyle Notification.
*/
- public static class MessagingStyleCommsAppData {
+ public static class MessagingStyleCommsAppData extends MockNotificationData {
private static MessagingStyleCommsAppData sInstance = null;
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
-
- // Style notification values
+ // Unique data for this Notification.Style:
private ArrayList<MessagingStyle.Message> mMessages;
- // Basically, String of all mMessages
+ // String of all mMessages.
private String mFullConversation;
- // Name preferred when replying to chat
+ // Name preferred when replying to chat.
private String mReplayName;
private int mNumberOfNewMessages;
private ArrayList<String> mParticipants;
+
public static MessagingStyleCommsAppData getInstance() {
if (sInstance == null) {
sInstance = getSync();
@@ -318,12 +333,11 @@
}
private MessagingStyleCommsAppData() {
- // Standard notification values
- // Content for API <24 (M and below) devices
+ // Standard notification values:
+ // Content for API <24 (M and below) devices.
mContentTitle = "2 Messages w/ Famous McFamously";
- mContentText = "Dude! ... You know I am a Pesce-pescetarian. :P";
-
- // Style notification values
+ mContentText = "HEY! ... You know I am a Pesce-pescetarian. :P";
+ mPriority = NotificationCompat.PRIORITY_HIGH;
// For each message, you need the timestamp, in this case, we are using arbitrary ones.
long currentTime = System.currentTimeMillis();
@@ -337,24 +351,24 @@
"Sounds good.", currentTime - 2000, "Famous"));
mMessages.add(new MessagingStyle.Message(
"How about BBQ?", currentTime - 1000, null));
- // Last two are the newest message (2) from friend
+ // Last two are the newest message (2) from friend.
mMessages.add(new MessagingStyle.Message(
- "Dude!", currentTime, "Famous"));
+ "HEY!", currentTime, "Famous"));
mMessages.add(new MessagingStyle.Message(
"You know I am a Pesce-pescetarian. :P", currentTime, "Famous"));
- // String version of the mMessages above
+ // String version of the mMessages above.
mFullConversation = "Famous: What are you doing tonight?\n\n"
+ "Me: I don't know, dinner maybe?\n\n"
+ "Famous: Sounds good.\n\n"
+ "Me: How about BBQ?\n\n"
- + "Famous: Dude!\n\n"
+ + "Famous: HEY!\n\n"
+ "Famous: You know I am a Pesce-pescetarian. :P\n\n";
mNumberOfNewMessages = 2;
- // Name preferred when replying to chat
+ // Name preferred when replying to chat.
mReplayName = "Me";
// If the phone is in "Do not disturb mode, the user will still be notified if
@@ -362,14 +376,17 @@
mParticipants = new ArrayList<>();
mParticipants.add("Famous McFamously");
- }
- public String getContentTitle() {
- return mContentTitle;
- }
+ // Notification channel values (for devices targeting 26 and above):
+ mChannelId = "channel_messaging_1";
+ // The user-visible name of the channel.
+ mChannelName = "Sample Messaging";
+ // The user-visible description of the channel.
+ mChannelDescription = "Sample Messaging Notifications";
+ mChannelImportance = NotificationManager.IMPORTANCE_MAX;
+ mChannelEnableVibrate = true;
+ mChannelLockscreenVisibility = NotificationCompat.VISIBILITY_PRIVATE;
- public String getContentText() {
- return mContentText;
}
public ArrayList<MessagingStyle.Message> getMessages() {
@@ -396,5 +413,65 @@
public String toString() {
return getFullConversation();
}
+
+
+ }
+
+ /**
+ * Represents standard data needed for a Notification.
+ */
+ public static abstract class MockNotificationData {
+
+ // Standard notification values:
+ protected String mContentTitle;
+ protected String mContentText;
+ protected int mPriority;
+
+ // Notification channel values (O and above):
+ protected String mChannelId;
+ protected CharSequence mChannelName;
+ protected String mChannelDescription;
+ protected int mChannelImportance;
+ protected boolean mChannelEnableVibrate;
+ protected int mChannelLockscreenVisibility;
+
+
+ // Notification Standard notification get methods:
+ public String getContentTitle() {
+ return mContentTitle;
+ }
+
+ public String getContentText() {
+ return mContentText;
+ }
+
+ public int getPriority() {
+ return mPriority;
+ }
+
+ // Channel values (O and above) get methods:
+ public String getChannelId() {
+ return mChannelId;
+ }
+
+ public CharSequence getChannelName() {
+ return mChannelName;
+ }
+
+ public String getChannelDescription() {
+ return mChannelDescription;
+ }
+
+ public int getChannelImportance() {
+ return mChannelImportance;
+ }
+
+ public boolean isChannelEnableVibrate() {
+ return mChannelEnableVibrate;
+ }
+
+ public int getChannelLockscreenVisibility() {
+ return mChannelLockscreenVisibility;
+ }
}
}
\ No newline at end of file
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/java/com/example/android/wearable/wear/common/util/NotificationUtil.java b/prebuilts/gradle/WearNotifications/Shared/src/main/java/com/example/android/wearable/wear/common/util/NotificationUtil.java
new file mode 100644
index 0000000..7db1504
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/java/com/example/android/wearable/wear/common/util/NotificationUtil.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.example.android.wearable.wear.common.util;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.content.Context;
+import android.os.Build;
+
+import com.example.android.wearable.wear.common.mock.MockDatabase;
+
+/**
+ * Simplifies common {@link Notification} tasks.
+ */
+public class NotificationUtil {
+
+ public static String createNotificationChannel(
+ Context context,
+ MockDatabase.MockNotificationData mockNotificationData) {
+
+ // NotificationChannels are required for Notifications on O (API 26) and above.
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
+
+ // The id of the channel.
+ String channelId = mockNotificationData.getChannelId();
+
+ // The user-visible name of the channel.
+ CharSequence channelName = mockNotificationData.getChannelName();
+ // The user-visible description of the channel.
+ String channelDescription = mockNotificationData.getChannelDescription();
+ int channelImportance = mockNotificationData.getChannelImportance();
+ boolean channelEnableVibrate = mockNotificationData.isChannelEnableVibrate();
+ int channelLockscreenVisibility =
+ mockNotificationData.getChannelLockscreenVisibility();
+
+ // Initializes NotificationChannel.
+ NotificationChannel notificationChannel =
+ new NotificationChannel(channelId, channelName, channelImportance);
+ notificationChannel.setDescription(channelDescription);
+ notificationChannel.enableVibration(channelEnableVibrate);
+ notificationChannel.setLockscreenVisibility(channelLockscreenVisibility);
+
+ // Adds NotificationChannel to system. Attempting to create an existing notification
+ // channel with its original values performs no operation, so it's safe to perform the
+ // below sequence.
+ NotificationManager notificationManager =
+ (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
+ notificationManager.createNotificationChannel(notificationChannel);
+
+ return channelId;
+ } else {
+ // Returns null for pre-O (26) devices.
+ return null;
+ }
+ }
+}
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/earth.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/earth.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/earth.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/earth.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_alarm_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_alarm_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_alarm_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_cancel_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_cancel_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_cancel_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_launcher.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..0ed1b5f
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_message_black_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_message_black_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_message_black_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_n_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_n_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_n_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_n_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_person_black_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_person_black_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_person_black_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_reply_white_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-hdpi/ic_reply_white_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-hdpi/ic_reply_white_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_alarm_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_alarm_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_alarm_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_cancel_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_cancel_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_cancel_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_launcher.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..2b6948a
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_message_black_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_message_black_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_message_black_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_person_black_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_person_black_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_person_black_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_reply_white_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-mdpi/ic_reply_white_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-mdpi/ic_reply_white_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_alarm_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_alarm_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_alarm_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_cancel_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_cancel_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_cancel_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_launcher.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..d9b1348
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_message_black_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_message_black_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_message_black_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_person_black_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_person_black_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_person_black_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_reply_white_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xhdpi/ic_reply_white_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xhdpi/ic_reply_white_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_alarm_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_alarm_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_alarm_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_cancel_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_cancel_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_cancel_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_launcher.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..cb4f56f
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_message_black_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_person_black_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_person_black_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_person_black_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_reply_white_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxhdpi/ic_reply_white_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxhdpi/ic_reply_white_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_alarm_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_alarm_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_alarm_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_alarm_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_cancel_white_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_cancel_white_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_cancel_white_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_cancel_white_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_launcher.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..77c9929
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_message_black_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_person_black_48dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_person_black_48dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_person_black_48dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_person_black_48dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_reply_white_18dp.png b/prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_reply_white_18dp.png
similarity index 100%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/res/drawable-xxxhdpi/ic_reply_white_18dp.png
rename to prebuilts/gradle/WearNotifications/Shared/src/main/res/drawable-xxxhdpi/ic_reply_white_18dp.png
Binary files differ
diff --git a/prebuilts/gradle/WearNotifications/Shared/src/main/res/values/strings.xml b/prebuilts/gradle/WearNotifications/Shared/src/main/res/values/strings.xml
new file mode 100644
index 0000000..cc0aaa9
--- /dev/null
+++ b/prebuilts/gradle/WearNotifications/Shared/src/main/res/values/strings.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2015 Google Inc. All rights reserved.
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+ <string name="app_name">Shared</string>
+</resources>
diff --git a/prebuilts/gradle/WearNotifications/Wearable/build.gradle b/prebuilts/gradle/WearNotifications/Wearable/build.gradle
index 2833d41..7a0ce21 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/build.gradle
+++ b/prebuilts/gradle/WearNotifications/Wearable/build.gradle
@@ -5,27 +5,31 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
dependencies {
-
- compile 'com.android.support:appcompat-v7:25.1.1'
- compile 'com.android.support:design:25.1.1'
-
-
+ compile 'com.android.support:appcompat-v7:26.0.0'
+ compile 'com.android.support:wear:26.0.0'
+ compile 'com.android.support:design:26.0.0'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
+ compile project(':Shared')
}
// The sample build uses multiple directories to
@@ -37,7 +41,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 26
buildToolsVersion "25.0.3"
@@ -45,9 +50,12 @@
versionCode 1
versionName "1.0"
- minSdkVersion 18
+ minSdkVersion 23
- targetSdkVersion 24
+ targetSdkVersion 26
+
+ multiDexEnabled true
+
}
compileOptions {
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/AndroidManifest.xml b/prebuilts/gradle/WearNotifications/Wearable/src/main/AndroidManifest.xml
index 2fdee0d..084bc35 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/AndroidManifest.xml
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/AndroidManifest.xml
@@ -27,7 +27,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
- android:theme="@style/AppThemeOverride">
+ android:theme="@android:style/Theme.Material">
<!-- Let's Play Store know this app is standalone. -->
<meta-data android:name="com.google.android.wearable.standalone" android:value="true"/>
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/Controller.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/Controller.java
index ee372bc..eb63309 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/Controller.java
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/Controller.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright (C) 2017 Google Inc. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package com.example.android.wearable.wear.wearnotifications;
import android.app.Notification;
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java
index 427c789..e7d461e 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/GlobalNotificationBuilder.java
@@ -15,7 +15,7 @@
*/
package com.example.android.wearable.wear.wearnotifications;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.app.NotificationCompat;
/**
* We use a Singleton for a global copy of the NotificationCompat.Builder to update active
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/ScalingOffsettingHelper.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/ScalingScrollLayoutCallback.java
similarity index 60%
rename from prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/ScalingOffsettingHelper.java
rename to prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/ScalingScrollLayoutCallback.java
index 84ec2fd..6c68b43 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/ScalingOffsettingHelper.java
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/ScalingScrollLayoutCallback.java
@@ -15,36 +15,37 @@
*/
package com.example.android.wearable.wear.wearnotifications;
-import android.support.wearable.view.DefaultOffsettingHelper;
-import android.support.wearable.view.WearableRecyclerView;
+import android.support.v7.widget.RecyclerView;
+import android.support.wear.widget.WearableLinearLayoutManager;
+import android.support.wear.widget.WearableRecyclerView;
import android.view.View;
/**
- * Customizes all items (children) in a {@link WearableRecyclerView} to align to left side of
- * surface/watch and shrinks each item (child) as you scroll away from it.
+ * Shrinks items (children) farther away from the center in a {@link WearableRecyclerView}. The UX
+ * makes scrolling more readable.
*/
-public class ScalingOffsettingHelper extends DefaultOffsettingHelper {
+public class ScalingScrollLayoutCallback extends WearableLinearLayoutManager.LayoutCallback {
- // Max we scale the child View
+ // Max we scale the child View.
private static final float MAX_CHILD_SCALE = 0.65f;
private float mProgressToCenter;
- public ScalingOffsettingHelper() {}
-
- // Shrinks icons/text and you scroll away
+ /*
+ * Scales the item's icons and text the farther away they are from center allowing the main
+ * item to be more readable to the user on small devices like Wear.
+ */
@Override
- public void updateChild(View child, WearableRecyclerView parent) {
- super.updateChild(child, parent);
+ public void onLayoutFinished(View child, RecyclerView parent) {
- // Figure out % progress from top to bottom
+ // Figure out % progress from top to bottom.
float centerOffset = ((float) child.getHeight() / 2.0f) / (float) parent.getHeight();
float yRelativeToCenterOffset = (child.getY() / parent.getHeight()) + centerOffset;
- // Normalize for center
+ // Normalizes for center.
mProgressToCenter = Math.abs(0.5f - yRelativeToCenterOffset);
- // Adjust to the maximum scale
+ // Adjusts to the maximum scale.
mProgressToCenter = Math.min(mProgressToCenter, MAX_CHILD_SCALE);
child.setScaleX(1 - mProgressToCenter);
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/StandaloneMainActivity.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/StandaloneMainActivity.java
index 64c1b55..28fa1e5 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/StandaloneMainActivity.java
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/StandaloneMainActivity.java
@@ -22,19 +22,23 @@
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigPictureStyle;
import android.support.v4.app.NotificationCompat.BigTextStyle;
import android.support.v4.app.NotificationCompat.InboxStyle;
import android.support.v4.app.NotificationCompat.MessagingStyle;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.content.ContextCompat;
+import android.support.wear.widget.WearableLinearLayoutManager;
+import android.support.wear.widget.WearableRecyclerView;
import android.support.wearable.activity.WearableActivity;
-import android.support.wearable.view.WearableRecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.FrameLayout;
+import com.example.android.wearable.wear.common.mock.MockDatabase;
+import com.example.android.wearable.wear.common.util.NotificationUtil;
import com.example.android.wearable.wear.wearnotifications.handlers.BigPictureSocialIntentService;
import com.example.android.wearable.wear.wearnotifications.handlers.BigPictureSocialMainActivity;
import com.example.android.wearable.wear.wearnotifications.handlers.BigTextIntentService;
@@ -42,7 +46,7 @@
import com.example.android.wearable.wear.wearnotifications.handlers.InboxMainActivity;
import com.example.android.wearable.wear.wearnotifications.handlers.MessagingIntentService;
import com.example.android.wearable.wear.wearnotifications.handlers.MessagingMainActivity;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
+
/**
* Demonstrates best practice for {@link NotificationCompat} Notifications created by local
@@ -93,11 +97,13 @@
mWearableRecyclerView = (WearableRecyclerView) findViewById(R.id.recycler_view);
// Aligns the first and last items on the list vertically centered on the screen.
- mWearableRecyclerView.setCenterEdgeItems(true);
+ mWearableRecyclerView.setEdgeItemsCenteringEnabled(true);
- // Customizes scrolling (zoom) and offsets of WearableRecyclerView's items
- ScalingOffsettingHelper scalingOffsettingHelper = new ScalingOffsettingHelper();
- mWearableRecyclerView.setOffsettingHelper(scalingOffsettingHelper);
+ // Customizes scrolling so items farther away form center are smaller.
+ ScalingScrollLayoutCallback scalingScrollLayoutCallback =
+ new ScalingScrollLayoutCallback();
+ mWearableRecyclerView.setLayoutManager(
+ new WearableLinearLayoutManager(this, scalingScrollLayoutCallback));
// Improves performance because we know changes in content do not change the layout size of
// the RecyclerView.
@@ -113,7 +119,8 @@
mWearableRecyclerView.setAdapter(mCustomRecyclerAdapter);
}
- // Called by WearableRecyclerView when an item is selected (check onCreate() for initialization)
+ // Called by WearableRecyclerView when an item is selected (check onCreate() for
+ // initialization).
public void itemSelected(String data) {
Log.d(TAG, "itemSelected()");
@@ -127,12 +134,12 @@
Snackbar snackbar = Snackbar
.make(
mMainFrameLayout,
- "", // Not enough space for both text and action text
+ "", // Not enough space for both text and action text.
Snackbar.LENGTH_LONG)
.setAction("Enable Notifications", new View.OnClickListener() {
@Override
public void onClick(View view) {
- // Links to this app's notification settings
+ // Links to this app's notification settings.
openNotificationSettingsForApp();
}
});
@@ -160,7 +167,7 @@
break;
default:
- // continue below
+ // continue below.
}
}
@@ -187,20 +194,25 @@
// Main steps for building a BIG_TEXT_STYLE notification:
// 0. Get your data
- // 1. Build the BIG_TEXT_STYLE
- // 2. Set up main Intent for notification
- // 3. Create additional Actions for the Notification
- // 4. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the BIG_TEXT_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Create additional Actions for the Notification
+ // 5. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.BigTextStyleReminderAppData bigTextStyleReminderAppData =
MockDatabase.getBigTextStyleData();
- // 1. Build the BIG_TEXT_STYLE
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, bigTextStyleReminderAppData);
+
+ // 2. Build the BIG_TEXT_STYLE
BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle()
- // Overrides ContentText in the big form of the template
+ // Overrides ContentText in the big form of the template.
.bigText(bigTextStyleReminderAppData.getBigText())
- // Overrides ContentTitle in the big form of the template
+ // Overrides ContentTitle in the big form of the template.
.setBigContentTitle(bigTextStyleReminderAppData.getBigContentTitle())
// Summary line after the detail section in the big form of the template
// Note: To improve readability, don't overload the user with info. If Summary Text
@@ -208,7 +220,7 @@
.setSummaryText(bigTextStyleReminderAppData.getSummaryText());
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent mainIntent = new Intent(this, BigTextMainActivity.class);
PendingIntent mainPendingIntent =
@@ -220,11 +232,11 @@
);
- // 3. Create additional Actions (Intents) for the Notification
+ // 4. Create additional Actions (Intents) for the Notification.
// In our case, we create two additional actions: a Snooze action and a Dismiss action.
- // Snooze Action
+ // Snooze Action.
Intent snoozeIntent = new Intent(this, BigTextIntentService.class);
snoozeIntent.setAction(BigTextIntentService.ACTION_SNOOZE);
@@ -236,7 +248,7 @@
snoozePendingIntent)
.build();
- // Dismiss Action
+ // Dismiss Action.
Intent dismissIntent = new Intent(this, BigTextIntentService.class);
dismissIntent.setAction(BigTextIntentService.ACTION_DISMISS);
@@ -249,20 +261,22 @@
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification.
// Because we want this to be a new notification (not updating a previous notification), we
// create a new Builder. Later, we use the same global builder to get back the notification
// we built here for the snooze action, that is, canceling the notification and relaunching
// it several seconds later.
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
notificationCompatBuilder
- // BIG_TEXT_STYLE sets title and content
+ // BIG_TEXT_STYLE sets title and content.
.setStyle(bigTextStyle)
.setContentTitle(bigTextStyleReminderAppData.getContentTitle())
.setContentText(bigTextStyleReminderAppData.getContentText())
@@ -270,16 +284,21 @@
.setLargeIcon(BitmapFactory.decodeResource(
getResources(),
R.drawable.ic_alarm_white_48dp))
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setCategory(Notification.CATEGORY_REMINDER)
- .setPriority(Notification.PRIORITY_HIGH)
- // Shows content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PUBLIC)
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(bigTextStyleReminderAppData.getPriority())
- // Adds additional actions specified above
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(bigTextStyleReminderAppData.getChannelLockscreenVisibility())
+
+ // Adds additional actions specified above.
.addAction(snoozeAction)
.addAction(dismissAction);
@@ -340,28 +359,33 @@
// Main steps for building a BIG_PICTURE_STYLE notification:
// 0. Get your data
- // 1. Build the BIG_PICTURE_STYLE
- // 2. Set up main Intent for notification
- // 3. Set up RemoteInput, so users can input (keyboard and voice) from notification
- // 4. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the BIG_PICTURE_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Set up RemoteInput, so users can input (keyboard and voice) from notification
+ // 5. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.BigPictureStyleSocialAppData bigPictureStyleSocialAppData =
MockDatabase.getBigPictureStyleData();
- // 1. Build the BIG_PICTURE_STYLE
+ // 1. Build the BIG_PICTURE_STYLE.
BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle()
- // Provides the bitmap for the BigPicture notification
+ // Provides the bitmap for the BigPicture notification.
.bigPicture(
BitmapFactory.decodeResource(
getResources(),
bigPictureStyleSocialAppData.getBigImage()))
- // Overrides ContentTitle in the big form of the template
+ // Overrides ContentTitle in the big form of the template.
.setBigContentTitle(bigPictureStyleSocialAppData.getBigContentTitle())
- // Summary line after the detail section in the big form of the template
+ // Summary line after the detail section in the big form of the template.
.setSummaryText(bigPictureStyleSocialAppData.getSummaryText());
- // 2. Set up main Intent for notification
+ // 2. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, bigPictureStyleSocialAppData);
+
+ // 3. Set up main Intent for notification.
Intent mainIntent = new Intent(this, BigPictureSocialMainActivity.class);
PendingIntent mainPendingIntent =
@@ -372,7 +396,7 @@
PendingIntent.FLAG_UPDATE_CURRENT
);
- // 3. Set up a RemoteInput Action, so users can input (keyboard, drawing, voice) directly
+ // 4. Set up a RemoteInput Action, so users can input (keyboard, drawing, voice) directly
// from the notification without entering the app.
// Create the RemoteInput.
@@ -380,7 +404,7 @@
RemoteInput remoteInput =
new RemoteInput.Builder(BigPictureSocialIntentService.EXTRA_COMMENT)
.setLabel(replyLabel)
- // List of quick response choices for any wearables paired with the phone
+ // List of quick response choices for any wearables paired with the phone.
.setChoices(bigPictureStyleSocialAppData.getPossiblePostResponses())
.build();
@@ -402,24 +426,25 @@
replyLabel,
replyActionPendingIntent)
.addRemoteInput(remoteInput)
- // Add WearableExtender to enable inline actions
+ // Add WearableExtender to enable inline actions.
.extend(inlineActionForWear2)
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification
// Because we want this to be a new notification (not updating a previous notification), we
// create a new Builder. Later, we use the same global builder to get back the notification
// we built here for a comment on the post.
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // Build notification
notificationCompatBuilder
- // BIG_PICTURE_STYLE sets title and content
+ // BIG_PICTURE_STYLE sets title and content.
.setStyle(bigPictureStyle)
.setContentTitle(bigPictureStyleSocialAppData.getContentTitle())
.setContentText(bigPictureStyleSocialAppData.getContentText())
@@ -428,16 +453,21 @@
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setSubText(Integer.toString(1))
.addAction(replyAction)
.setCategory(Notification.CATEGORY_SOCIAL)
- .setPriority(Notification.PRIORITY_HIGH)
- // Hides content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PRIVATE)
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(bigPictureStyleSocialAppData.getPriority())
+
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(bigPictureStyleSocialAppData.getChannelLockscreenVisibility())
// Notifies system that the main launch intent is an Activity.
.extend(new NotificationCompat.WearableExtender()
.setHintContentIntentLaunchesActivity(true));
@@ -465,27 +495,32 @@
// Main steps for building a INBOX_STYLE notification:
// 0. Get your data
- // 1. Build the INBOX_STYLE
- // 2. Set up main Intent for notification
- // 3. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the INBOX_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.InboxStyleEmailAppData inboxStyleEmailAppData =
MockDatabase.getInboxStyleData();
- // 1. Build the INBOX_STYLE
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, inboxStyleEmailAppData);
+
+ // 2. Build the INBOX_STYLE
InboxStyle inboxStyle = new NotificationCompat.InboxStyle()
// This title is slightly different than regular title, since I know INBOX_STYLE is
// available.
.setBigContentTitle(inboxStyleEmailAppData.getBigContentTitle())
.setSummaryText(inboxStyleEmailAppData.getSummaryText());
- // Add each summary line of the new emails, you can add up to 5
+ // Add each summary line of the new emails, you can add up to 5.
for (String summary : inboxStyleEmailAppData.getIndividualEmailSummary()) {
inboxStyle.addLine(summary);
}
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent mainIntent = new Intent(this, InboxMainActivity.class);
PendingIntent mainPendingIntent =
@@ -496,20 +531,21 @@
PendingIntent.FLAG_UPDATE_CURRENT
);
- // 3. Build and issue the notification
+ // 4. Build and issue the notification.
// Because we want this to be a new notification (not updating a previous notification), we
// create a new Builder. However, we don't need to update this notification later, so we
// will not need to set a global builder for access to the notification later.
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // 4. Build and issue the notification
notificationCompatBuilder
- // INBOX_STYLE sets title and content
+ // INBOX_STYLE sets title and content.
.setStyle(inboxStyle)
.setContentTitle(inboxStyleEmailAppData.getContentTitle())
.setContentText(inboxStyleEmailAppData.getContentText())
@@ -518,17 +554,22 @@
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
// Sets large number at the right-hand side of the notification for Wear 1.+.
.setSubText(Integer.toString(inboxStyleEmailAppData.getNumberOfNewEmails()))
.setCategory(Notification.CATEGORY_EMAIL)
- .setPriority(Notification.PRIORITY_HIGH)
- // Hides content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PRIVATE)
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(inboxStyleEmailAppData.getPriority())
+
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(inboxStyleEmailAppData.getChannelLockscreenVisibility())
// Notifies system that the main launch intent is an Activity.
.extend(new NotificationCompat.WearableExtender()
.setHintContentIntentLaunchesActivity(true));
@@ -570,16 +611,21 @@
// Main steps for building a MESSAGING_STYLE notification:
// 0. Get your data
- // 1. Build the MESSAGING_STYLE
- // 2. Set up main Intent for notification
- // 3. Set up RemoteInput (users can input directly from notification)
- // 4. Build and issue the notification
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the MESSAGING_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Set up RemoteInput (users can input directly from notification)
+ // 5. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.MessagingStyleCommsAppData messagingStyleCommsAppData =
MockDatabase.getMessagingStyleData();
- // 1. Build the Notification.Style (MESSAGING_STYLE)
+ // 1. Create/Retrieve Notification Channel for O and beyond devices (26+).
+ String notificationChannelId =
+ NotificationUtil.createNotificationChannel(this, messagingStyleCommsAppData);
+
+ // 2. Build the Notification.Style (MESSAGING_STYLE).
String contentTitle = messagingStyleCommsAppData.getContentTitle();
MessagingStyle messagingStyle =
@@ -589,13 +635,13 @@
// title.
.setConversationTitle(contentTitle);
- // Adds all Messages
- // Note: Messages include the text, timestamp, and sender
+ // Adds all Messages.
+ // Note: Messages include the text, timestamp, and sender.
for (MessagingStyle.Message message : messagingStyleCommsAppData.getMessages()) {
messagingStyle.addMessage(message);
}
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent notifyIntent = new Intent(this, MessagingMainActivity.class);
PendingIntent mainPendingIntent =
@@ -607,7 +653,7 @@
);
- // 3. Set up a RemoteInput Action, so users can input (keyboard, drawing, voice) directly
+ // 4. Set up a RemoteInput Action, so users can input (keyboard, drawing, voice) directly
// from the notification without entering the app.
// Create the RemoteInput specifying this key.
@@ -634,25 +680,26 @@
replyLabel,
replyActionPendingIntent)
.addRemoteInput(remoteInput)
- // Allows system to generate replies by context of conversation
+ // Allows system to generate replies by context of conversation.
.setAllowGeneratedReplies(true)
- // Add WearableExtender to enable inline actions
+ // Add WearableExtender to enable inline actions.
.extend(inlineActionForWear2)
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification.
// Because we want this to be a new notification (not updating current notification), we
// create a new Builder. Later, we update this same notification, so we need to save this
// Builder globally (as outlined earlier).
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // Builds and issues notification
notificationCompatBuilder
// MESSAGING_STYLE sets title and content for Wear 1.+ and Wear 2.0 devices.
.setStyle(messagingStyle)
@@ -663,18 +710,23 @@
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- // Set primary color (important for Wear 2.0 Notifications)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ // Set primary color (important for Wear 2.0 Notifications).
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
- // Number of new notifications for API <24 (Wear 1.+) devices
+ // Number of new notifications for API <24 (Wear 1.+) devices.
.setSubText(Integer.toString(messagingStyleCommsAppData.getNumberOfNewMessages()))
.addAction(replyAction)
.setCategory(Notification.CATEGORY_MESSAGE)
- .setPriority(Notification.PRIORITY_HIGH)
- // Hides content on the lock-screen
- .setVisibility(Notification.VISIBILITY_PRIVATE);
+ // Sets priority for 25 and below. For 26 and above, 'priority' is deprecated for
+ // 'importance' which is set in the NotificationChannel. The integers representing
+ // 'priority' are different from 'importance', so make sure you don't mix them.
+ .setPriority(messagingStyleCommsAppData.getPriority())
+
+ // Sets lock-screen visibility for 25 and below. For 26 and above, lock screen
+ // visibility is set in the NotificationChannel.
+ .setVisibility(messagingStyleCommsAppData.getChannelLockscreenVisibility());
// If the phone is in "Do not disturb mode, the user will still be notified if
// the sender(s) is starred as a favorite.
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java
index d49210c..cc22dc1 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigPictureSocialIntentService.java
@@ -21,16 +21,17 @@
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigPictureStyle;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.content.ContextCompat;
import android.util.Log;
import com.example.android.wearable.wear.wearnotifications.GlobalNotificationBuilder;
import com.example.android.wearable.wear.wearnotifications.R;
import com.example.android.wearable.wear.wearnotifications.StandaloneMainActivity;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
+import com.example.android.wearable.wear.common.mock.MockDatabase;
/**
* Asynchronously handles updating social app posts (and active Notification) with comments from
@@ -135,16 +136,23 @@
// Main steps for building a BIG_PICTURE_STYLE notification (for more detailed comments on
// building this notification, check StandaloneMainActivity.java):
// 0. Get your data
- // 1. Build the BIG_PICTURE_STYLE
- // 2. Set up main Intent for notification
- // 3. Set up RemoteInput, so users can input (keyboard and voice) from notification
- // 4. Build and issue the notification
+ // 1. Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the BIG_PICTURE_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Set up RemoteInput, so users can input (keyboard and voice) from notification
+ // 5. Build and issue the notification
// 0. Get your data (everything unique per Notification)
MockDatabase.BigPictureStyleSocialAppData bigPictureStyleSocialAppData =
MockDatabase.getBigPictureStyleData();
- // 1. Build the BIG_PICTURE_STYLE
+ // 1. Retrieve Notification Channel for O and beyond devices (26+). We don't need to create
+ // the NotificationChannel, since it was created the first time this Notification was
+ // created.
+ String notificationChannelId = bigPictureStyleSocialAppData.getChannelId();
+
+
+ // 2. Build the BIG_PICTURE_STYLE.
BigPictureStyle bigPictureStyle = new NotificationCompat.BigPictureStyle()
.bigPicture(
BitmapFactory.decodeResource(
@@ -153,7 +161,7 @@
.setBigContentTitle(bigPictureStyleSocialAppData.getBigContentTitle())
.setSummaryText(bigPictureStyleSocialAppData.getSummaryText());
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent mainIntent = new Intent(this, BigPictureSocialMainActivity.class);
PendingIntent mainPendingIntent =
@@ -164,7 +172,7 @@
PendingIntent.FLAG_UPDATE_CURRENT
);
- // 3. Set up a RemoteInput Action, so users can input (keyboard, drawing, voice) directly
+ // 4. Set up a RemoteInput Action, so users can input (keyboard, drawing, voice) directly
// from the notification without entering the app.
String replyLabel = getString(R.string.reply_label);
RemoteInput remoteInput =
@@ -190,17 +198,19 @@
replyLabel,
replyActionPendingIntent)
.addRemoteInput(remoteInput)
- // Add WearableExtender to enable inline actions
+ // Add WearableExtender to enable inline actions.
.extend(inlineActionForWear2)
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification.
+
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // Build notification
notificationCompatBuilder
.setStyle(bigPictureStyle)
.setContentTitle(bigPictureStyleSocialAppData.getContentTitle())
@@ -210,12 +220,12 @@
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setSubText(Integer.toString(1))
.addAction(replyAction)
.setCategory(Notification.CATEGORY_SOCIAL)
- .setPriority(Notification.PRIORITY_HIGH)
- .setVisibility(Notification.VISIBILITY_PRIVATE)
+ .setPriority(bigPictureStyleSocialAppData.getPriority())
+ .setVisibility(bigPictureStyleSocialAppData.getChannelLockscreenVisibility())
.extend(new NotificationCompat.WearableExtender()
.setHintContentIntentLaunchesActivity(true));
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java
index 67e92a7..bf50afd 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/BigTextIntentService.java
@@ -21,15 +21,16 @@
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Build;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.BigTextStyle;
import android.support.v4.app.NotificationManagerCompat;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.content.ContextCompat;
import android.util.Log;
import com.example.android.wearable.wear.wearnotifications.GlobalNotificationBuilder;
import com.example.android.wearable.wear.wearnotifications.R;
import com.example.android.wearable.wear.wearnotifications.StandaloneMainActivity;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
+import com.example.android.wearable.wear.common.mock.MockDatabase;
import java.util.concurrent.TimeUnit;
@@ -123,25 +124,31 @@
private NotificationCompat.Builder recreateBuilderWithBigTextStyle() {
// Main steps for building a BIG_TEXT_STYLE notification (for more detailed comments on
- // building this notification, check StandaloneMainActivity.java)::
+ // building this notification, check StandaloneMainActivity.java):
// 0. Get your data
- // 1. Build the BIG_TEXT_STYLE
- // 2. Set up main Intent for notification
- // 3. Create additional Actions for the Notification
- // 4. Build and issue the notification
+ // 1. Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the BIG_TEXT_STYLE
+ // 3. Set up main Intent for notification
+ // 4. Create additional Actions for the Notification
+ // 5. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.BigTextStyleReminderAppData bigTextStyleReminderAppData =
MockDatabase.getBigTextStyleData();
- // 1. Build the BIG_TEXT_STYLE
+ // 1. Retrieve Notification Channel for O and beyond devices (26+). We don't need to create
+ // the NotificationChannel, since it was created the first time this Notification was
+ // created.
+ String notificationChannelId = bigTextStyleReminderAppData.getChannelId();
+
+ // 2. Build the BIG_TEXT_STYLE.
BigTextStyle bigTextStyle = new NotificationCompat.BigTextStyle()
.bigText(bigTextStyleReminderAppData.getBigText())
.setBigContentTitle(bigTextStyleReminderAppData.getBigContentTitle())
.setSummaryText(bigTextStyleReminderAppData.getSummaryText());
- // 2. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent mainIntent = new Intent(this, BigTextMainActivity.class);
PendingIntent mainPendingIntent =
@@ -153,8 +160,9 @@
);
- // 3. Create additional Actions (Intents) for the Notification
- // Snooze Action
+ // 4. Create additional Actions (Intents) for the Notification.
+
+ // Snooze Action.
Intent snoozeIntent = new Intent(this, BigTextIntentService.class);
snoozeIntent.setAction(BigTextIntentService.ACTION_SNOOZE);
@@ -179,9 +187,12 @@
.build();
- // 4. Build and issue the notification
+ // 5. Build and issue the notification.
+
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
@@ -193,10 +204,10 @@
.setLargeIcon(BitmapFactory.decodeResource(
getResources(),
R.drawable.ic_alarm_white_48dp))
- .setColor(getResources().getColor(R.color.colorPrimary))
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setCategory(Notification.CATEGORY_REMINDER)
- .setPriority(Notification.PRIORITY_HIGH)
- .setVisibility(Notification.VISIBILITY_PUBLIC)
+ .setPriority(bigTextStyleReminderAppData.getPriority())
+ .setVisibility(bigTextStyleReminderAppData.getChannelLockscreenVisibility())
.addAction(snoozeAction)
.addAction(dismissAction);
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java
index 2268cfc..cf17fdd 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/handlers/MessagingIntentService.java
@@ -21,16 +21,17 @@
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
+import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationCompat.MessagingStyle;
import android.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.RemoteInput;
-import android.support.v7.app.NotificationCompat;
+import android.support.v4.content.ContextCompat;
import android.util.Log;
import com.example.android.wearable.wear.wearnotifications.GlobalNotificationBuilder;
import com.example.android.wearable.wear.wearnotifications.R;
import com.example.android.wearable.wear.wearnotifications.StandaloneMainActivity;
-import com.example.android.wearable.wear.wearnotifications.mock.MockDatabase;
+import com.example.android.wearable.wear.common.mock.MockDatabase;
/**
* Asynchronously handles updating messaging app posts (and active Notification) with replies from
@@ -142,48 +143,38 @@
private NotificationCompat.Builder recreateBuilderWithMessagingStyle() {
// Main steps for building a MESSAGING_STYLE notification (for more detailed comments on
- // building this notification, check StandaloneMainActivity.java)::
+ // building this notification, check StandaloneMainActivity.java):
// 0. Get your data
- // 1. Build the MESSAGING_STYLE
- // 2. Add support for Wear 1.+
+ // 1. Retrieve Notification Channel for O and beyond devices (26+)
+ // 2. Build the MESSAGING_STYLE
// 3. Set up main Intent for notification
// 4. Set up RemoteInput (users can input directly from notification)
// 5. Build and issue the notification
- // 0. Get your data (everything unique per Notification)
+ // 0. Get your data (everything unique per Notification).
MockDatabase.MessagingStyleCommsAppData messagingStyleCommsAppData =
MockDatabase.getMessagingStyleData();
- // 1. Build the Notification.Style (MESSAGING_STYLE)
+ // 1. Retrieve Notification Channel for O and beyond devices (26+). We don't need to create
+ // the NotificationChannel, since it was created the first time this Notification was
+ // created.
+ String notificationChannelId = messagingStyleCommsAppData.getChannelId();
+
+
+ // 2. Build the Notification.Style (MESSAGING_STYLE).
String contentTitle = messagingStyleCommsAppData.getContentTitle();
MessagingStyle messagingStyle =
new NotificationCompat.MessagingStyle(messagingStyleCommsAppData.getReplayName())
.setConversationTitle(contentTitle);
- // Adds all Messages
+ // Adds all Messages.
for (MessagingStyle.Message message : messagingStyleCommsAppData.getMessages()) {
messagingStyle.addMessage(message);
}
- // 2. Add support for Wear 1.+.
- String fullMessageForWearVersion1 = messagingStyleCommsAppData.getFullConversation();
-
- Notification chatHistoryForWearV1 = new NotificationCompat.Builder(getApplicationContext())
- .setStyle(new NotificationCompat.BigTextStyle().bigText(fullMessageForWearVersion1))
- .setContentTitle(contentTitle)
- .setSmallIcon(R.drawable.ic_launcher)
- .setContentText(fullMessageForWearVersion1)
- .build();
-
- // Adds page with all text to support Wear 1.+.
- NotificationCompat.WearableExtender wearableExtenderForWearVersion1 =
- new NotificationCompat.WearableExtender()
- .setHintContentIntentLaunchesActivity(true)
- .addPage(chatHistoryForWearV1);
-
- // 3. Set up main Intent for notification
+ // 3. Set up main Intent for notification.
Intent notifyIntent = new Intent(this, MessagingMainActivity.class);
PendingIntent mainPendingIntent =
@@ -219,20 +210,22 @@
replyLabel,
replyActionPendingIntent)
.addRemoteInput(remoteInput)
- // Allows system to generate replies by context of conversation
+ // Allows system to generate replies by context of conversation.
.setAllowGeneratedReplies(true)
- // Add WearableExtender to enable inline actions
+ // Add WearableExtender to enable inline actions.
.extend(inlineActionForWear2_0)
.build();
- // 5. Build and issue the notification
+ // 5. Build and issue the notification.
+
+ // Notification Channel Id is ignored for Android pre O (26).
NotificationCompat.Builder notificationCompatBuilder =
- new NotificationCompat.Builder(getApplicationContext());
+ new NotificationCompat.Builder(
+ getApplicationContext(), notificationChannelId);
GlobalNotificationBuilder.setNotificationCompatBuilderInstance(notificationCompatBuilder);
- // Builds and issues notification
notificationCompatBuilder
.setStyle(messagingStyle)
.setContentTitle(contentTitle)
@@ -242,13 +235,12 @@
getResources(),
R.drawable.ic_person_black_48dp))
.setContentIntent(mainPendingIntent)
- .setColor(getResources().getColor(R.color.colorPrimary))
+ .setColor(ContextCompat.getColor(getApplicationContext(), R.color.colorPrimary))
.setSubText(Integer.toString(messagingStyleCommsAppData.getNumberOfNewMessages()))
.addAction(replyAction)
.setCategory(Notification.CATEGORY_MESSAGE)
- .setPriority(Notification.PRIORITY_HIGH)
- .setVisibility(Notification.VISIBILITY_PRIVATE)
- .extend(wearableExtenderForWearVersion1);
+ .setPriority(messagingStyleCommsAppData.getPriority())
+ .setVisibility(messagingStyleCommsAppData.getChannelLockscreenVisibility());
for (String name : messagingStyleCommsAppData.getParticipants()) {
notificationCompatBuilder.addPerson(name);
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/mock/MockDatabase.java b/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/mock/MockDatabase.java
deleted file mode 100644
index b552f6d..0000000
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/java/com/example/android/wearable/wear/wearnotifications/mock/MockDatabase.java
+++ /dev/null
@@ -1,400 +0,0 @@
-package com.example.android.wearable.wear.wearnotifications.mock;
-
-import android.support.v4.app.NotificationCompat.MessagingStyle;
-
-import com.example.android.wearable.wear.wearnotifications.R;
-
-import java.util.ArrayList;
-
-/**
- * Mock data for each of the Notification Style Demos.
- */
-public final class MockDatabase {
-
- public static BigTextStyleReminderAppData getBigTextStyleData() {
- return BigTextStyleReminderAppData.getInstance();
- }
-
- public static BigPictureStyleSocialAppData getBigPictureStyleData() {
- return BigPictureStyleSocialAppData.getInstance();
- }
-
- public static InboxStyleEmailAppData getInboxStyleData() {
- return InboxStyleEmailAppData.getInstance();
- }
-
- public static MessagingStyleCommsAppData getMessagingStyleData() {
- return MessagingStyleCommsAppData.getInstance();
- }
-
- /**
- * Represents data needed for BigTextStyle Notification.
- */
- public static class BigTextStyleReminderAppData {
-
- private static BigTextStyleReminderAppData sInstance = null;
-
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
-
- // Style notification values
- private String mBigContentTitle;
- private String mBigText;
- private String mSummaryText;
-
-
- public static BigTextStyleReminderAppData getInstance() {
- if (sInstance == null) {
- sInstance = getSync();
- }
-
- return sInstance;
- }
-
- private static synchronized BigTextStyleReminderAppData getSync() {
- if (sInstance == null) {
- sInstance = new BigTextStyleReminderAppData();
- }
-
- return sInstance;
- }
-
- private BigTextStyleReminderAppData() {
- // Standard Notification values
- // Title for API <16 (4.0 and below) devices
- mContentTitle = "Don't forget to...";
- // Content for API <24 (4.0 and below) devices
- mContentText = "Feed Dogs and check garage!";
-
- // BigText Style Notification values
- mBigContentTitle = "Don't forget to...";
- mBigText = "... feed the dogs before you leave for work, and check the garage to "
- + "make sure the door is closed.";
- mSummaryText = "Dogs and Garage";
- }
- public String getContentTitle() {
- return mContentTitle;
- }
-
- public String getContentText() {
- return mContentText;
- }
-
- public String getBigContentTitle() {
- return mBigContentTitle;
- }
-
- public String getBigText() {
- return mBigText;
- }
-
- public String getSummaryText() {
- return mSummaryText;
- }
-
- @Override
- public String toString() {
- return getBigContentTitle() + getBigText();
- }
- }
-
- /**
- * Represents data needed for BigPictureStyle Notification.
- */
- public static class BigPictureStyleSocialAppData {
- private static BigPictureStyleSocialAppData sInstance = null;
-
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
-
- // Style notification values
- private int mBigImage;
- private String mBigContentTitle;
- private String mSummaryText;
-
- private CharSequence[] mPossiblePostResponses;
-
- private ArrayList<String> mParticipants;
-
-
- public static BigPictureStyleSocialAppData getInstance() {
- if (sInstance == null) {
- sInstance = getSync();
- }
- return sInstance;
- }
-
- private static synchronized BigPictureStyleSocialAppData getSync() {
- if (sInstance == null) {
- sInstance = new BigPictureStyleSocialAppData();
- }
-
- return sInstance;
- }
-
- private BigPictureStyleSocialAppData() {
- // Standard Notification values
- // Title/Content for API <16 (4.0 and below) devices
- mContentTitle = "Bob's Post";
- mContentText = "[Picture] Like my shot of Earth?";
-
- // Style notification values
- mBigImage = R.drawable.earth;
- mBigContentTitle = "Bob's Post";
- mSummaryText = "Like my shot of Earth?";
-
- // This would be possible responses based on the contents of the post
- mPossiblePostResponses = new CharSequence[]{"Yes", "No", "Maybe?"};
-
- mParticipants = new ArrayList<>();
- mParticipants.add("Bob Smith");
- }
-
- public String getContentTitle() {
- return mContentTitle;
- }
-
- public String getContentText() {
- return mContentText;
- }
-
- public int getBigImage() {
- return mBigImage;
- }
-
- public String getBigContentTitle() {
- return mBigContentTitle;
- }
-
- public String getSummaryText() {
- return mSummaryText;
- }
-
- public CharSequence[] getPossiblePostResponses() {
- return mPossiblePostResponses;
- }
-
- public ArrayList<String> getParticipants() {
- return mParticipants;
- }
-
- @Override
- public String toString() {
- return getContentTitle() + " - " + getContentText();
- }
- }
-
- /**
- * Represents data needed for InboxStyle Notification.
- */
- public static class InboxStyleEmailAppData {
- private static InboxStyleEmailAppData sInstance = null;
-
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
- private int mNumberOfNewEmails;
-
- // Style notification values
- private String mBigContentTitle;
- private String mSummaryText;
- private ArrayList<String> mIndividualEmailSummary;
-
- private ArrayList<String> mParticipants;
-
- public static InboxStyleEmailAppData getInstance() {
- if (sInstance == null) {
- sInstance = getSync();
- }
- return sInstance;
- }
-
- private static synchronized InboxStyleEmailAppData getSync() {
- if (sInstance == null) {
- sInstance = new InboxStyleEmailAppData();
- }
-
- return sInstance;
- }
-
- private InboxStyleEmailAppData() {
- // Standard Notification values
- // Title/Content for API <16 (4.0 and below) devices
- mContentTitle = "5 new emails";
- mContentText = "from Jane, Jay, Alex +2 more";
- mNumberOfNewEmails = 5;
-
- // Style notification values
- mBigContentTitle = "5 new emails from Jane, Jay, Alex +2";
- mSummaryText = "New emails";
-
- // Add each summary line of the new emails, you can add up to 5
- mIndividualEmailSummary = new ArrayList<>();
- mIndividualEmailSummary.add("Jane Faab - Launch Party is here...");
- mIndividualEmailSummary.add("Jay Walker - There's a turtle on the server!");
- mIndividualEmailSummary.add("Alex Chang - Check this out...");
- mIndividualEmailSummary.add("Jane Johns - Check in code?");
- mIndividualEmailSummary.add("John Smith - Movies later....");
-
- // If the phone is in "Do not disturb mode, the user will still be notified if
- // the user(s) is starred as a favorite.
- mParticipants = new ArrayList<>();
- mParticipants.add("Jane Faab");
- mParticipants.add("Jay Walker");
- mParticipants.add("Alex Chang");
- mParticipants.add("Jane Johns");
- mParticipants.add("John Smith");
- }
-
- public String getContentTitle() {
- return mContentTitle;
- }
-
- public String getContentText() {
- return mContentText;
- }
-
- public int getNumberOfNewEmails() {
- return mNumberOfNewEmails;
- }
-
- public String getBigContentTitle() {
- return mBigContentTitle;
- }
-
- public String getSummaryText() {
- return mSummaryText;
- }
-
- public ArrayList<String> getIndividualEmailSummary() {
- return mIndividualEmailSummary;
- }
-
- public ArrayList<String> getParticipants() {
- return mParticipants;
- }
-
- @Override
- public String toString() {
- return getContentTitle() + " " + getContentText();
- }
- }
-
- /**
- * Represents data needed for MessagingStyle Notification.
- */
- public static class MessagingStyleCommsAppData {
-
- private static MessagingStyleCommsAppData sInstance = null;
-
- // Standard notification values
- private String mContentTitle;
- private String mContentText;
-
- // Style notification values
- private ArrayList<MessagingStyle.Message> mMessages;
- // Basically, String of all mMessages
- private String mFullConversation;
- // Name preferred when replying to chat
- private String mReplayName;
- private int mNumberOfNewMessages;
- private ArrayList<String> mParticipants;
-
- public static MessagingStyleCommsAppData getInstance() {
- if (sInstance == null) {
- sInstance = getSync();
- }
- return sInstance;
- }
-
- private static synchronized MessagingStyleCommsAppData getSync() {
- if (sInstance == null) {
- sInstance = new MessagingStyleCommsAppData();
- }
-
- return sInstance;
- }
-
- private MessagingStyleCommsAppData() {
- // Standard notification values
- // Content for API <24 (M and below) devices
- mContentTitle = "2 Messages w/ Famous McFamously";
- mContentText = "Dude! ... You know I am a Pesce-pescetarian. :P";
-
- // Style notification values
-
- // For each message, you need the timestamp, in this case, we are using arbitrary ones.
- long currentTime = System.currentTimeMillis();
-
- mMessages = new ArrayList<>();
- mMessages.add(new MessagingStyle.Message(
- "What are you doing tonight?", currentTime - 4000, "Famous"));
- mMessages.add(new MessagingStyle.Message(
- "I don't know, dinner maybe?", currentTime - 3000, null));
- mMessages.add(new MessagingStyle.Message(
- "Sounds good.", currentTime - 2000, "Famous"));
- mMessages.add(new MessagingStyle.Message(
- "How about BBQ?", currentTime - 1000, null));
- // Last two are the newest message (2) from friend
- mMessages.add(new MessagingStyle.Message(
- "Dude!", currentTime, "Famous"));
- mMessages.add(new MessagingStyle.Message(
- "You know I am a Pesce-pescetarian. :P", currentTime, "Famous"));
-
-
- // String version of the mMessages above
- mFullConversation = "Famous: What are you doing tonight?\n\n"
- + "Me: I don't know, dinner maybe?\n\n"
- + "Famous: Sounds good.\n\n"
- + "Me: How about BBQ?\n\n"
- + "Famous: Dude!\n\n"
- + "Famous: You know I am a Pesce-pescetarian. :P\n\n";
-
- mNumberOfNewMessages = 2;
-
- // Name preferred when replying to chat
- mReplayName = "Me";
-
- // If the phone is in "Do not disturb mode, the user will still be notified if
- // the user(s) is starred as a favorite.
- mParticipants = new ArrayList<>();
- mParticipants.add("Famous McFamously");
-
- }
-
- public String getContentTitle() {
- return mContentTitle;
- }
-
- public String getContentText() {
- return mContentText;
- }
-
- public ArrayList<MessagingStyle.Message> getMessages() {
- return mMessages;
- }
-
- public String getFullConversation() {
- return mFullConversation;
- }
-
- public String getReplayName() {
- return mReplayName;
- }
-
- public int getNumberOfNewMessages() {
- return mNumberOfNewMessages;
- }
-
- public ArrayList<String> getParticipants() {
- return mParticipants;
- }
-
- @Override
- public String toString() {
- return getFullConversation();
- }
- }
-}
\ No newline at end of file
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/layout/activity_main.xml b/prebuilts/gradle/WearNotifications/Wearable/src/main/res/layout/activity_main.xml
index 5dc46fd..10528cf 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/layout/activity_main.xml
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/res/layout/activity_main.xml
@@ -22,12 +22,13 @@
android:layout_height="match_parent"
tools:context="com.example.android.wearable.wear.wearnotifications.StandaloneMainActivity">
- <android.support.wearable.view.WearableRecyclerView
+ <android.support.wear.widget.WearableRecyclerView
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
+ <!-- Stacks the text field above the WearableRecyclerView at the top of the screen. -->
<TextView
android:id="@+id/header_text_view"
android:layout_width="match_parent"
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/values/dimens.xml b/prebuilts/gradle/WearNotifications/Wearable/src/main/res/values/dimens.xml
index e6d1996..3a2b9ca 100644
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/values/dimens.xml
+++ b/prebuilts/gradle/WearNotifications/Wearable/src/main/res/values/dimens.xml
@@ -18,7 +18,7 @@
<dimen name="activity_main_text_header_spacing">5dp</dimen>
<dimen name="recycler_row_padding">5dp</dimen>
- <dimen name="recycler_row_text_size">14sp</dimen>
+ <dimen name="recycler_row_text_size">10sp</dimen>
<dimen name="activity_notification_details_top_padding">5dp</dimen>
<dimen name="activity_notification_details_bottom_padding">5dp</dimen>
diff --git a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/values/styles.xml b/prebuilts/gradle/WearNotifications/Wearable/src/main/res/values/styles.xml
deleted file mode 100644
index 1d68f73..0000000
--- a/prebuilts/gradle/WearNotifications/Wearable/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- ~ Copyright 2016 Google Inc.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<resources>
- <style name="AppThemeOverride" parent="Theme.AppCompat.NoActionBar" />
-</resources>
\ No newline at end of file
diff --git a/prebuilts/gradle/WearNotifications/settings.gradle b/prebuilts/gradle/WearNotifications/settings.gradle
index f35b8cc..8c3a205 100644
--- a/prebuilts/gradle/WearNotifications/settings.gradle
+++ b/prebuilts/gradle/WearNotifications/settings.gradle
@@ -1,2 +1,2 @@
-include ':Application', ':Wearable'
+include ':Application', ':Wearable', ':Shared'
diff --git a/prebuilts/gradle/WearSpeakerSample/build.gradle b/prebuilts/gradle/WearSpeakerSample/build.gradle
index 7253716..b1c03ec 100644
--- a/prebuilts/gradle/WearSpeakerSample/build.gradle
+++ b/prebuilts/gradle/WearSpeakerSample/build.gradle
@@ -21,7 +21,7 @@
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.3'
+ classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
diff --git a/prebuilts/gradle/WearSpeakerSample/wear/build.gradle b/prebuilts/gradle/WearSpeakerSample/wear/build.gradle
index 5a0264e..5c2c234 100644
--- a/prebuilts/gradle/WearSpeakerSample/wear/build.gradle
+++ b/prebuilts/gradle/WearSpeakerSample/wear/build.gradle
@@ -37,8 +37,8 @@
}
dependencies {
- provided 'com.google.android.wearable:wearable:2.0.0'
- compile 'com.google.android.support:wearable:2.0.0'
- compile 'com.google.android.gms:play-services-wearable:10.0.1'
- compile 'com.android.support:appcompat-v7:25.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
+ compile 'com.google.android.support:wearable:2.0.3'
+ compile 'com.google.android.gms:play-services-wearable:10.2.6'
+ compile 'com.android.support:appcompat-v7:25.3.1'
}
diff --git a/prebuilts/gradle/WearVerifyRemoteApp/Application/build.gradle b/prebuilts/gradle/WearVerifyRemoteApp/Application/build.gradle
index bdcdad6..e4c34c4 100644
--- a/prebuilts/gradle/WearVerifyRemoteApp/Application/build.gradle
+++ b/prebuilts/gradle/WearVerifyRemoteApp/Application/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.2.0'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,14 +13,17 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile "com.android.support:support-v4:25.0.1"
- compile "com.android.support:support-v13:25.0.1"
- compile "com.android.support:cardview-v7:25.0.1"
- compile "com.android.support:appcompat-v7:25.0.1"
- compile 'com.google.android.support:wearable:2.0.0'
+ compile "com.android.support:support-v4:25.3.1"
+ compile "com.android.support:support-v13:25.3.1"
+ compile "com.android.support:cardview-v7:25.3.1"
+ compile "com.android.support:appcompat-v7:25.3.1"
+ compile 'com.google.android.support:wearable:2.0.3'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
wearApp project(':Wearable')
@@ -35,7 +38,9 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
+
buildToolsVersion "25.0.3"
defaultConfig {
diff --git a/prebuilts/gradle/WearVerifyRemoteApp/Wearable/build.gradle b/prebuilts/gradle/WearVerifyRemoteApp/Wearable/build.gradle
index c30407b..fc4aaa4 100644
--- a/prebuilts/gradle/WearVerifyRemoteApp/Wearable/build.gradle
+++ b/prebuilts/gradle/WearVerifyRemoteApp/Wearable/build.gradle
@@ -5,12 +5,19 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
+repositories {
+ jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
+}
+
dependencies {
@@ -20,9 +27,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
}
@@ -35,7 +42,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,6 +54,8 @@
minSdkVersion 23
targetSdkVersion 25
+
+
}
compileOptions {
diff --git a/prebuilts/gradle/XYZTouristAttractions/Application/build.gradle b/prebuilts/gradle/XYZTouristAttractions/Application/build.gradle
index 295c7d6..234a384 100644
--- a/prebuilts/gradle/XYZTouristAttractions/Application/build.gradle
+++ b/prebuilts/gradle/XYZTouristAttractions/Application/build.gradle
@@ -5,24 +5,26 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
compile 'com.google.android.gms:play-services-location:10.2.4'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'com.github.bumptech.glide:glide:3.6.1'
- compile 'com.android.support:appcompat-v7:24.0.0'
- compile 'com.android.support:recyclerview-v7:24.0.0'
- compile 'com.android.support:design:24.0.0'
+ compile 'com.android.support:appcompat-v7:25.3.1'
+ compile 'com.android.support:recyclerview-v7:25.3.1'
+ compile 'com.android.support:design:25.3.1'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
compile project(':Shared')
@@ -38,7 +40,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/XYZTouristAttractions/Shared/build.gradle b/prebuilts/gradle/XYZTouristAttractions/Shared/build.gradle
index 034f87a..1230b46 100644
--- a/prebuilts/gradle/XYZTouristAttractions/Shared/build.gradle
+++ b/prebuilts/gradle/XYZTouristAttractions/Shared/build.gradle
@@ -5,7 +5,7 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
@@ -13,10 +13,13 @@
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
- compile 'com.android.support:support-v13:23.0.0'
+ compile 'com.android.support:support-v13:25.3.1'
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.google.android.gms:play-services-maps:10.2.4'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
@@ -31,7 +34,7 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
diff --git a/prebuilts/gradle/XYZTouristAttractions/Wearable/build.gradle b/prebuilts/gradle/XYZTouristAttractions/Wearable/build.gradle
index 95c1883..79ad46d 100644
--- a/prebuilts/gradle/XYZTouristAttractions/Wearable/build.gradle
+++ b/prebuilts/gradle/XYZTouristAttractions/Wearable/build.gradle
@@ -5,16 +5,17 @@
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:2.3.3'
}
}
apply plugin: 'com.android.application'
-
-
repositories {
jcenter()
+ maven {
+ url 'https://maven.google.com'
+ }
}
dependencies {
@@ -22,9 +23,9 @@
compile 'com.google.android.gms:play-services-wearable:10.2.4'
compile 'com.android.support:support-v13:25.3.1'
- provided 'com.google.android.wearable:wearable:2.0.1'
+ provided 'com.google.android.wearable:wearable:2.0.3'
- compile 'com.google.android.support:wearable:2.0.1'
+ compile 'com.google.android.support:wearable:2.0.3'
compile project(':Shared')
}
@@ -38,7 +39,8 @@
'template'] // boilerplate code that is generated by the sample template process
android {
- compileSdkVersion 25
+
+ compileSdkVersion 25
buildToolsVersion "25.0.3"
@@ -46,8 +48,11 @@
versionCode 1
versionName "1.0"
+ minSdkVersion 18
+
targetSdkVersion 25
+
}
compileOptions {