am 11b32f03: Clean up samples (gradle files and Compat stuff in wearable code).
* commit '11b32f038486390d91aafb56c6204666267db89f': Clean up samples (gradle files and Compat stuff in wearable code).
@@ -1,12 +1,12 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 20
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
targetSdkVersion 20
|
targetSdkVersion 19
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
@@ -23,4 +23,4 @@ dependencies {
|
|||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
compile "com.android.support:support-v4:20.0.+"
|
||||||
wearApp project(':Wearable')
|
wearApp project(':Wearable')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.agendadata">
|
package="com.example.android.wearable.agendadata">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.READ_CALENDAR" />
|
<uses-permission android:name="android.permission.READ_CALENDAR" />
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.+@aar'
|
compile 'com.google.android.gms:play-services-wearable:+'
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.agendadata" >
|
package="com.example.android.wearable.agendadata" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@@ -23,4 +23,4 @@ dependencies {
|
|||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
compile "com.android.support:support-v4:20.0.+"
|
||||||
wearApp project(':Wearable')
|
wearApp project(':Wearable')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.datalayer" >
|
package="com.example.android.wearable.datalayer" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19" />
|
|
||||||
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
<uses-feature android:name="android.hardware.camera" android:required="false" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 20
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 19
|
minSdkVersion 20
|
||||||
targetSdkVersion 19
|
targetSdkVersion 20
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services-wearable:+'
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.datalayer" >
|
package="com.example.android.wearable.datalayer" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 20
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
targetSdkVersion 20
|
targetSdkVersion 19
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
@@ -22,4 +22,4 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
||||||
wearApp project(':Wearable')
|
wearApp project(':Wearable')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.delayedconfirmation" >
|
package="com.example.android.wearable.delayedconfirmation" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services-wearable:+'
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,8 @@ package com.example.android.wearable.delayedconfirmation;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.support.v4.app.NotificationManagerCompat;
|
|
||||||
import android.support.wearable.view.DelayedConfirmationView;
|
import android.support.wearable.view.DelayedConfirmationView;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -70,12 +69,12 @@ public class MainActivity extends Activity implements
|
|||||||
@Override
|
@Override
|
||||||
public void onTimerSelected(View v) {
|
public void onTimerSelected(View v) {
|
||||||
v.setPressed(true);
|
v.setPressed(true);
|
||||||
Notification notification = new NotificationCompat.Builder(this)
|
Notification notification = new Notification.Builder(this)
|
||||||
.setSmallIcon(R.drawable.ic_launcher)
|
.setSmallIcon(R.drawable.ic_launcher)
|
||||||
.setContentTitle(getString(R.string.notification_title))
|
.setContentTitle(getString(R.string.notification_title))
|
||||||
.setContentText(getString(R.string.notification_timer_selected))
|
.setContentText(getString(R.string.notification_timer_selected))
|
||||||
.build();
|
.build();
|
||||||
NotificationManagerCompat.from(this).notify(0, notification);
|
((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).notify(0, notification);
|
||||||
sendMessageToCompanion(TIMER_SELECTED_PATH);
|
sendMessageToCompanion(TIMER_SELECTED_PATH);
|
||||||
// Prevent onTimerFinished from being heard.
|
// Prevent onTimerFinished from being heard.
|
||||||
((DelayedConfirmationView) v).setListener(null);
|
((DelayedConfirmationView) v).setListener(null);
|
||||||
@@ -84,12 +83,12 @@ public class MainActivity extends Activity implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTimerFinished(View v) {
|
public void onTimerFinished(View v) {
|
||||||
Notification notification = new NotificationCompat.Builder(this)
|
Notification notification = new Notification.Builder(this)
|
||||||
.setSmallIcon(R.drawable.ic_launcher)
|
.setSmallIcon(R.drawable.ic_launcher)
|
||||||
.setContentTitle(getString(R.string.notification_title))
|
.setContentTitle(getString(R.string.notification_title))
|
||||||
.setContentText(getString(R.string.notification_timer_finished))
|
.setContentText(getString(R.string.notification_timer_finished))
|
||||||
.build();
|
.build();
|
||||||
NotificationManagerCompat.from(this).notify(0, notification);
|
((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).notify(0, notification);
|
||||||
sendMessageToCompanion(TIMER_FINISHED_PATH);
|
sendMessageToCompanion(TIMER_FINISHED_PATH);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|||||||
24
samples/wearable/ElizaChat/Application/build.gradle
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
apply plugin: 'android'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion 18
|
||||||
|
buildToolsVersion '20'
|
||||||
|
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 18
|
||||||
|
targetSdkVersion 19
|
||||||
|
versionCode 1
|
||||||
|
versionName "1.0"
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
runProguard false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
compile "com.android.support:support-v4:20.0.+"
|
||||||
|
}
|
||||||
@@ -17,6 +17,4 @@
|
|||||||
# class:
|
# class:
|
||||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
# public *;
|
# public *;
|
||||||
#}
|
#}
|
||||||
-dontwarn android.support.wearable.view.DelayedConfirmationView
|
|
||||||
-dontwarn android.support.wearable.view.CircledImageView
|
|
||||||
14
samples/wearable/ElizaChat/Application/project.properties
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# This file is automatically generated by Android Tools.
|
||||||
|
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||||
|
#
|
||||||
|
# This file must be checked in Version Control Systems.
|
||||||
|
#
|
||||||
|
# To customize properties used by the Ant build system edit
|
||||||
|
# "ant.properties", and override values to adapt the script to your
|
||||||
|
# project structure.
|
||||||
|
#
|
||||||
|
# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
|
||||||
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
|
# Project target.
|
||||||
|
target=android-19
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.elizachat" >
|
package="com.example.android.wearable.elizachat" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_app_eliza"
|
android:icon="@mipmap/ic_app_eliza"
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.example.android.wearable.elizachat;
|
package com.example.android.wearable.elizachat;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.PendingIntent;
|
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.content.LocalBroadcastManager;
|
import android.support.v4.content.LocalBroadcastManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
@@ -129,4 +129,4 @@ public class ResponderService extends Service {
|
|||||||
mBroadcastManager = null;
|
mBroadcastManager = null;
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 366 KiB After Width: | Height: | Size: 366 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
@@ -1,5 +1,3 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
@@ -13,29 +11,4 @@ allprojects {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
apply plugin: 'android'
|
|
||||||
|
|
||||||
android {
|
|
||||||
compileSdkVersion 19
|
|
||||||
buildToolsVersion '20'
|
|
||||||
|
|
||||||
defaultConfig {
|
|
||||||
minSdkVersion 18
|
|
||||||
targetSdkVersion 19
|
|
||||||
versionCode 1
|
|
||||||
versionName "1.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTypes {
|
|
||||||
release {
|
|
||||||
runProguard false
|
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
|
||||||
}
|
}
|
||||||
1
samples/wearable/ElizaChat/settings.gradle
Normal file
@@ -0,0 +1 @@
|
|||||||
|
include 'Application'
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 20
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
targetSdkVersion 20
|
targetSdkVersion 19
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
@@ -23,4 +23,4 @@ dependencies {
|
|||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
compile "com.android.support:support-v4:20.0.+"
|
||||||
wearApp project(':Wearable')
|
wearApp project(':Wearable')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.findphone">
|
package="com.example.android.wearable.findphone">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.+@aar'
|
compile 'com.google.android.gms:play-services-wearable:+'
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.findphone" >
|
package="com.example.android.wearable.findphone" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="20" />
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -20,6 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.flashlight" >
|
package="com.example.android.wearable.flashlight" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 20
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
targetSdkVersion 20
|
targetSdkVersion 19
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
@@ -23,4 +23,4 @@ dependencies {
|
|||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
compile "com.android.support:support-v4:20.0.+"
|
||||||
wearApp project(':Wearable')
|
wearApp project(':Wearable')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.geofencing">
|
package="com.example.android.wearable.geofencing">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="20"/>
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
|
||||||
|
|
||||||
<application
|
<application
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.+@aar'
|
compile 'com.google.android.gms:play-services-wearable:+'
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.geofencing" >
|
package="com.example.android.wearable.geofencing" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
@@ -20,6 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.gridviewpager"
|
package="com.example.android.wearable.gridviewpager" >
|
||||||
android:versionCode="1"
|
|
||||||
android:versionName="1.0" >
|
|
||||||
|
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="20"
|
|
||||||
android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services-wearable:+'
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
@@ -22,4 +22,4 @@ android {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
compile "com.android.support:support-v4:20.0.+"
|
||||||
wearApp project(':Wearable')
|
wearApp project(':Wearable')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.support.wearable.notifications" >
|
package="com.example.android.support.wearable.notifications" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
|||||||
@@ -20,6 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.support.wearable.notifications" >
|
package="com.example.android.support.wearable.notifications" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19"/>
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package com.example.android.support.wearable.notifications;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.app.RemoteInput;
|
import android.app.RemoteInput;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.NotificationManagerCompat;
|
|
||||||
import android.support.wearable.view.WearableListView;
|
import android.support.wearable.view.WearableListView;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@@ -46,7 +46,8 @@ public class MainActivity extends Activity implements WearableListView.ClickList
|
|||||||
private void updateNotification(int presetIndex) {
|
private void updateNotification(int presetIndex) {
|
||||||
NotificationPreset preset = NotificationPresets.PRESETS[presetIndex];
|
NotificationPreset preset = NotificationPresets.PRESETS[presetIndex];
|
||||||
Notification notif = preset.buildNotification(this);
|
Notification notif = preset.buildNotification(this);
|
||||||
NotificationManagerCompat.from(this).notify(SAMPLE_NOTIFICATION_ID, notif);
|
((NotificationManager) getSystemService(NOTIFICATION_SERVICE))
|
||||||
|
.notify(SAMPLE_NOTIFICATION_ID, notif);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 20
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
targetSdkVersion 20
|
targetSdkVersion 19
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.quiz" >
|
package="com.example.android.wearable.quiz" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19"/>
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
|||||||
@@ -20,7 +20,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.0.+@aar'
|
compile 'com.google.android.gms:play-services-wearable:+'
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.quiz" >
|
package="com.example.android.wearable.quiz" >
|
||||||
|
|
||||||
<uses-sdk
|
|
||||||
android:minSdkVersion="20"
|
|
||||||
android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.recipeassistant"
|
package="com.example.android.wearable.recipeassistant" >
|
||||||
android:versionCode="1"
|
|
||||||
android:versionName="1.0" >
|
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -20,6 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
apply plugin: 'android'
|
apply plugin: 'android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 19
|
compileSdkVersion 18
|
||||||
buildToolsVersion '20'
|
buildToolsVersion '20'
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 18
|
minSdkVersion 18
|
||||||
|
|||||||
@@ -20,7 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'com.google.android.gms:play-services:5.+@aar'
|
|
||||||
compile "com.android.support:support-v4:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,16 +17,11 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.wearable.timer" >
|
package="com.example.android.wearable.timer" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:icon="@mipmap/ic_launcher"
|
android:icon="@mipmap/ic_launcher"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@android:style/Theme.DeviceDefault.Light">
|
android:theme="@android:style/Theme.DeviceDefault.Light"
|
||||||
|
android:allowBackup="true">
|
||||||
<meta-data
|
|
||||||
android:name="com.google.android.gms.version"
|
|
||||||
android:value="@integer/google_play_services_version" />
|
|
||||||
|
|
||||||
<!-- Timer components -->
|
<!-- Timer components -->
|
||||||
<activity android:name=".SetTimerActivity">
|
<activity android:name=".SetTimerActivity">
|
||||||
|
|||||||
@@ -19,14 +19,13 @@ package com.example.android.wearable.timer;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.AlarmClock;
|
import android.provider.AlarmClock;
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.support.v4.app.NotificationManagerCompat;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
@@ -35,21 +34,15 @@ import android.widget.ListView;
|
|||||||
|
|
||||||
import com.example.android.wearable.timer.util.Constants;
|
import com.example.android.wearable.timer.util.Constants;
|
||||||
import com.example.android.wearable.timer.util.TimerFormat;
|
import com.example.android.wearable.timer.util.TimerFormat;
|
||||||
import com.google.android.gms.common.ConnectionResult;
|
|
||||||
import com.google.android.gms.common.api.GoogleApiClient;
|
|
||||||
import com.google.android.gms.wearable.Wearable;
|
|
||||||
|
|
||||||
/** This class sets a timer. */
|
/** This class sets a timer. */
|
||||||
public class SetTimerActivity extends Activity
|
public class SetTimerActivity extends Activity implements AdapterView.OnItemClickListener {
|
||||||
implements AdapterView.OnItemClickListener, GoogleApiClient.ConnectionCallbacks,
|
|
||||||
GoogleApiClient.OnConnectionFailedListener {
|
|
||||||
|
|
||||||
public static final int NUMBER_OF_TIMES = 10;
|
public static final int NUMBER_OF_TIMES = 10;
|
||||||
public static final String TAG = "SetTimerActivity";
|
public static final String TAG = "SetTimerActivity";
|
||||||
|
|
||||||
private ListViewItem[] mTimeOptions = new ListViewItem[NUMBER_OF_TIMES];
|
private ListViewItem[] mTimeOptions = new ListViewItem[NUMBER_OF_TIMES];
|
||||||
private ListView mListView;
|
private ListView mListView;
|
||||||
private GoogleApiClient mGoogleApiClient;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,24 +75,6 @@ public class SetTimerActivity extends Activity
|
|||||||
android.R.layout.simple_list_item_1, mTimeOptions);
|
android.R.layout.simple_list_item_1, mTimeOptions);
|
||||||
mListView.setAdapter(arrayAdapter);
|
mListView.setAdapter(arrayAdapter);
|
||||||
mListView.setOnItemClickListener(this);
|
mListView.setOnItemClickListener(this);
|
||||||
|
|
||||||
mGoogleApiClient = new GoogleApiClient.Builder(this)
|
|
||||||
.addApi(Wearable.API)
|
|
||||||
.addConnectionCallbacks(this)
|
|
||||||
.addOnConnectionFailedListener(this)
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStart() {
|
|
||||||
super.onStart();
|
|
||||||
mGoogleApiClient.connect();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onStop() {
|
|
||||||
super.onStop();
|
|
||||||
mGoogleApiClient.disconnect();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +82,8 @@ public class SetTimerActivity extends Activity
|
|||||||
* milliseconds.
|
* milliseconds.
|
||||||
*/
|
*/
|
||||||
private void setupTimer(long duration) {
|
private void setupTimer(long duration) {
|
||||||
NotificationManagerCompat notifyMgr = NotificationManagerCompat.from(this);
|
NotificationManager notifyMgr =
|
||||||
|
((NotificationManager) getSystemService(NOTIFICATION_SERVICE));
|
||||||
|
|
||||||
// Delete dataItem and cancel a potential old countdown.
|
// Delete dataItem and cancel a potential old countdown.
|
||||||
cancelCountdown(notifyMgr);
|
cancelCountdown(notifyMgr);
|
||||||
@@ -165,7 +141,7 @@ public class SetTimerActivity extends Activity
|
|||||||
.getService(this, 0, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
.getService(this, 0, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
// Create countdown notification using a chronometer style.
|
// Create countdown notification using a chronometer style.
|
||||||
return new NotificationCompat.Builder(this)
|
return new Notification.Builder(this)
|
||||||
.setSmallIcon(R.drawable.ic_cc_alarm)
|
.setSmallIcon(R.drawable.ic_cc_alarm)
|
||||||
.setContentTitle(getString(R.string.timer_time_left))
|
.setContentTitle(getString(R.string.timer_time_left))
|
||||||
.setContentText(TimerFormat.getTimeString(duration))
|
.setContentText(TimerFormat.getTimeString(duration))
|
||||||
@@ -185,7 +161,7 @@ public class SetTimerActivity extends Activity
|
|||||||
*
|
*
|
||||||
* @param notifyMgr the notification manager.
|
* @param notifyMgr the notification manager.
|
||||||
*/
|
*/
|
||||||
private void cancelCountdown(NotificationManagerCompat notifyMgr) {
|
private void cancelCountdown(NotificationManager notifyMgr) {
|
||||||
notifyMgr.cancel(Constants.NOTIFICATION_TIMER_EXPIRED);
|
notifyMgr.cancel(Constants.NOTIFICATION_TIMER_EXPIRED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,15 +184,4 @@ public class SetTimerActivity extends Activity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnected(Bundle connectionHint) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionSuspended(int cause) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionFailed(ConnectionResult result) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,27 +19,18 @@ package com.example.android.wearable.timer;
|
|||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.app.IntentService;
|
import android.app.IntentService;
|
||||||
import android.app.Notification;
|
import android.app.Notification;
|
||||||
|
import android.app.NotificationManager;
|
||||||
import android.app.PendingIntent;
|
import android.app.PendingIntent;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
|
||||||
import android.support.v4.app.NotificationCompat;
|
|
||||||
import android.support.v4.app.NotificationManagerCompat;
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.example.android.wearable.timer.util.Constants;
|
import com.example.android.wearable.timer.util.Constants;
|
||||||
import com.google.android.gms.common.ConnectionResult;
|
|
||||||
import com.google.android.gms.common.api.GoogleApiClient;
|
|
||||||
import com.google.android.gms.wearable.Wearable;
|
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service class that manages notifications of the timer.
|
* Service class that manages notifications of the timer.
|
||||||
*/
|
*/
|
||||||
public class TimerNotificationService extends IntentService
|
public class TimerNotificationService extends IntentService {
|
||||||
implements GoogleApiClient.ConnectionCallbacks,
|
|
||||||
GoogleApiClient.OnConnectionFailedListener {
|
|
||||||
|
|
||||||
public static final String TAG = "TimerNotificationSvc";
|
public static final String TAG = "TimerNotificationSvc";
|
||||||
|
|
||||||
@@ -94,7 +85,8 @@ public class TimerNotificationService extends IntentService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cancelCountdownNotification() {
|
private void cancelCountdownNotification() {
|
||||||
NotificationManagerCompat notifyMgr = NotificationManagerCompat.from(this);
|
NotificationManager notifyMgr =
|
||||||
|
((NotificationManager) getSystemService(NOTIFICATION_SERVICE));
|
||||||
notifyMgr.cancel(Constants.NOTIFICATION_TIMER_COUNTDOWN);
|
notifyMgr.cancel(Constants.NOTIFICATION_TIMER_COUNTDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,8 +101,9 @@ public class TimerNotificationService extends IntentService
|
|||||||
.getService(this, 0, restartIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
.getService(this, 0, restartIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
// Create notification that timer has expired.
|
// Create notification that timer has expired.
|
||||||
NotificationManagerCompat notifyMgr = NotificationManagerCompat.from(this);
|
NotificationManager notifyMgr =
|
||||||
Notification notif = new NotificationCompat.Builder(this)
|
((NotificationManager) getSystemService(NOTIFICATION_SERVICE));
|
||||||
|
Notification notif = new Notification.Builder(this)
|
||||||
.setSmallIcon(R.drawable.ic_cc_alarm)
|
.setSmallIcon(R.drawable.ic_cc_alarm)
|
||||||
.setContentTitle(getString(R.string.timer_done))
|
.setContentTitle(getString(R.string.timer_done))
|
||||||
.setContentText(getString(R.string.timer_done))
|
.setContentText(getString(R.string.timer_done))
|
||||||
@@ -123,15 +116,4 @@ public class TimerNotificationService extends IntentService
|
|||||||
notifyMgr.notify(Constants.NOTIFICATION_TIMER_EXPIRED, notif);
|
notifyMgr.notify(Constants.NOTIFICATION_TIMER_EXPIRED, notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnected(Bundle connectionHint) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionSuspended(int cause) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onConnectionFailed(ConnectionResult result) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|||||||
@@ -20,6 +20,5 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "com.android.support:support-v13:20.0.+"
|
|
||||||
compile "com.google.android.support:wearable:1.0.+"
|
compile "com.google.android.support:wearable:1.0.+"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.android.google.wearable.watchviewstub" >
|
package="com.example.android.google.wearable.watchviewstub" >
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="20" />
|
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/ic_launcher"
|
android:icon="@drawable/ic_launcher"
|
||||||
|
|||||||