diff options
705 files changed, 115 insertions, 22259 deletions
diff --git a/build/sdk.atree b/build/sdk.atree index f2cbfa278..8a82f7941 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -284,7 +284,7 @@ developers/build/prebuilts/gradle/NavigationDrawer sam developers/build/prebuilts/gradle/ElevationBasic samples/${PLATFORM_NAME}/ui/views/Elevation/ElevationBasic developers/build/prebuilts/gradle/ElevationDrag samples/${PLATFORM_NAME}/ui/views/Elevation/ElevationDrag developers/build/prebuilts/gradle/ClippingBasic samples/${PLATFORM_NAME}/ui/views/Clipping/ClippingBasic -developers/build/prebuilts/gradle/JobScheduler samples/${PLATFORM_NAME}/ui/views/Clipping/JobScheduler +developers/build/prebuilts/gradle/JobScheduler samples/${PLATFORM_NAME}/background/JobScheduler developers/build/prebuilts/gradle/HdrViewfinder samples/${PLATFORM_NAME}/media/HdrViewfinder developers/build/prebuilts/gradle/DocumentCentricApps samples/${PLATFORM_NAME}/ui/activitytasks/DocumentCentricApps developers/build/prebuilts/gradle/DocumentCentricRelinquishIdentity samples/${PLATFORM_NAME}/ui/activitytasks/DocumentCentricRelinquishIdentity @@ -302,23 +302,24 @@ developers/build/prebuilts/gradle/RevealEffectBasic sam developers/build/prebuilts/androidtv samples/${PLATFORM_NAME}/androidtv # Wearable sample tree -development/samples/wearable/AgendaData samples/${PLATFORM_NAME}/wearable/AgendaData -development/samples/wearable/DataLayer samples/${PLATFORM_NAME}/wearable/DataLayer -development/samples/wearable/DelayedConfirmation samples/${PLATFORM_NAME}/wearable/DelayedConfirmation -development/samples/wearable/ElizaChat samples/${PLATFORM_NAME}/wearable/ElizaChat -development/samples/wearable/EmbeddedApp samples/${PLATFORM_NAME}/wearable/EmbeddedApp -development/samples/wearable/FindMyPhone samples/${PLATFORM_NAME}/wearable/FindMyPhone -development/samples/wearable/Flashlight samples/${PLATFORM_NAME}/wearable/Flashlight -development/samples/wearable/Geofencing samples/${PLATFORM_NAME}/wearable/Geofencing -development/samples/wearable/GridViewPager samples/${PLATFORM_NAME}/wearable/GridViewPager -development/samples/wearable/JumpingJack samples/${PLATFORM_NAME}/wearable/JumpingJack -development/samples/wearable/Notifications samples/${PLATFORM_NAME}/wearable/Notifications -development/samples/wearable/Quiz samples/${PLATFORM_NAME}/wearable/Quiz -development/samples/wearable/RecipeAssistant samples/${PLATFORM_NAME}/wearable/RecipeAssistant -development/samples/wearable/SkeletonWearableApp samples/${PLATFORM_NAME}/wearable/SkeletonWearableApp -development/samples/wearable/SynchronizedNotifications samples/${PLATFORM_NAME}/wearable/SynchronizedNotifications -development/samples/wearable/Timer samples/${PLATFORM_NAME}/wearable/Timer -development/samples/wearable/WatchViewStub samples/${PLATFORM_NAME}/wearable/WatchViewStub +developers/build/prebuilts/gradle/AgendaData samples/${PLATFORM_NAME}/wearable/AgendaData +developers/build/prebuilts/gradle/DataLayer samples/${PLATFORM_NAME}/wearable/DataLayer +developers/build/prebuilts/gradle/DelayedConfirmation samples/${PLATFORM_NAME}/wearable/DelayedConfirmation +developers/build/prebuilts/gradle/ElizaChat samples/${PLATFORM_NAME}/wearable/ElizaChat +developers/build/prebuilts/gradle/EmbeddedApp samples/${PLATFORM_NAME}/wearable/EmbeddedApp +developers/build/prebuilts/gradle/FindMyPhone samples/${PLATFORM_NAME}/wearable/FindMyPhone +developers/build/prebuilts/gradle/Flashlight samples/${PLATFORM_NAME}/wearable/Flashlight +developers/build/prebuilts/gradle/Geofencing samples/${PLATFORM_NAME}/wearable/Geofencing +developers/build/prebuilts/gradle/GridViewPager samples/${PLATFORM_NAME}/wearable/GridViewPager +developers/build/prebuilts/gradle/JumpingJack samples/${PLATFORM_NAME}/wearable/JumpingJack +developers/build/prebuilts/gradle/Notifications samples/${PLATFORM_NAME}/wearable/Notifications +developers/build/prebuilts/gradle/Quiz samples/${PLATFORM_NAME}/wearable/Quiz +developers/build/prebuilts/gradle/RecipeAssistant samples/${PLATFORM_NAME}/wearable/RecipeAssistant +developers/build/prebuilts/gradle/SkeletonWearableApp samples/${PLATFORM_NAME}/wearable/SkeletonWearableApp +developers/build/prebuilts/gradle/SpeedTracker samples/${PLATFORM_NAME}/wearable/SpeedTracker +developers/build/prebuilts/gradle/SynchronizedNotifications samples/${PLATFORM_NAME}/wearable/SynchronizedNotifications +developers/build/prebuilts/gradle/Timer samples/${PLATFORM_NAME}/wearable/Timer +developers/build/prebuilts/gradle/WatchViewStub samples/${PLATFORM_NAME}/wearable/WatchViewStub # Old sample tree development/samples/AccelerometerPlay samples/${PLATFORM_NAME}/legacy/AccelerometerPlay diff --git a/samples/Support7Demos/res/layout/activity_card_view.xml b/samples/Support7Demos/res/layout/activity_card_view.xml index cfd307142..9b985f70e 100644 --- a/samples/Support7Demos/res/layout/activity_card_view.xml +++ b/samples/Support7Demos/res/layout/activity_card_view.xml @@ -123,14 +123,62 @@ android:layout_height="wrap_content" android:layout_toRightOf="@id/alpha_label" android:layout_alignTop="@id/alpha_label"/> - + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="5dp" + android:id="@+id/color_label" + android:textColor="@android:color/black" + android:text="@string/card_view_bg_color" + android:layout_below="@id/alpha_label" + android:layout_alignRight="@id/alpha_label"/> <RadioGroup - android:id="@+id/select_target_radio" + android:id="@+id/select_bg_color_radio" + android:layout_toRightOf="@id/color_label" + android:layout_alignTop="@id/color_label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_below="@id/alpha_seek_bar"> <RadioButton + android:id="@+id/def" + android:layout_width="40dp" + android:layout_height="wrap_content" + android:background="@color/cardview_light_background" + android:checked="true"/> + <RadioButton + android:id="@+id/yellow" + android:layout_width="40dp" + android:layout_height="wrap_content" + android:background="@color/card_yellow"/> + <RadioButton + android:id="@+id/aquatic" + android:layout_width="40dp" + android:layout_height="wrap_content" + android:background="@color/card_aquatic"/> + <RadioButton + android:id="@+id/classic" + android:layout_width="40dp" + android:layout_height="wrap_content" + android:background="@color/card_classic"/> + <RadioButton + android:id="@+id/sunbrite" + android:layout_width="40dp" + android:layout_height="wrap_content" + android:background="@color/card_sunbrite"/> + <RadioButton + android:id="@+id/tropical" + android:layout_width="40dp" + android:layout_height="wrap_content" + android:background="@color/card_tropical"/> + </RadioGroup> + <RadioGroup + android:id="@+id/select_target_radio" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_below="@id/color_label"> + <RadioButton android:id="@+id/resize_card_view" android:layout_width="wrap_content" android:layout_height="wrap_content" @@ -144,7 +192,6 @@ android:textColor="@android:color/black" android:text="@string/card_view_resize_content"/> </RadioGroup> - </RelativeLayout> <RelativeLayout android:layout_width="fill_parent" android:layout_height="match_parent"> @@ -155,9 +202,10 @@ card_view:cardElevation="10dp"> <TextView android:id="@+id/info_text" + android:text="@string/card_view" android:textColor="@android:color/black" - android:layout_width="match_parent" - android:layout_height="match_parent" /> + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> </android.support.v7.widget.CardView> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/card_view_sample_text" diff --git a/samples/Support7Demos/res/values/colors.xml b/samples/Support7Demos/res/values/colors.xml index b129b8de6..c8c67a0a2 100644 --- a/samples/Support7Demos/res/values/colors.xml +++ b/samples/Support7Demos/res/values/colors.xml @@ -16,4 +16,9 @@ <resources> <drawable name="blue">#770000ff</drawable> + <color name="card_yellow">#FCF0AD</color> + <color name="card_aquatic">#FCF0AD</color> + <color name="card_classic">#BAB7A9</color> + <color name="card_sunbrite">#F9D6AC</color> + <color name="card_tropical">#56C4E8</color> </resources> diff --git a/samples/Support7Demos/res/values/strings.xml b/samples/Support7Demos/res/values/strings.xml index 03282affd..789e19ef8 100644 --- a/samples/Support7Demos/res/values/strings.xml +++ b/samples/Support7Demos/res/values/strings.xml @@ -150,6 +150,7 @@ <string name="card_view_radius">Radius</string> <string name="card_view_width">Width</string> <string name="card_view_height">Height</string> + <string name="card_view_bg_color">Background</string> <string name="card_view_elevation">Elevation</string> <string name="card_view_max_elevation">Max Elevation</string> <string name="card_view_alpha">Alpha</string> diff --git a/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java b/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java index ba4f0cb1d..ca0c08aac 100644 --- a/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java +++ b/samples/Support7Demos/src/com/example/android/supportv7/view/CardViewActivity.java @@ -16,6 +16,8 @@ package com.example.android.supportv7.view; import android.app.Activity; +import android.graphics.drawable.ColorDrawable; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v4.view.ViewCompat; @@ -25,8 +27,11 @@ import android.view.ViewGroup; import android.widget.RadioGroup; import android.widget.SeekBar; import android.widget.TextView; + import com.example.android.supportv7.R; +import java.lang.reflect.Field; + public class CardViewActivity extends Activity { CardView mCardView; @@ -84,7 +89,7 @@ public class CardViewActivity extends Activity { lp = setViewBounds(mInfoText); } mInfoText.setText("radius: " + mCornerRadiusSeekBar.getProgress() - +", alpha: " + mAlphaSeekBar.getProgress() + + ", alpha: " + mAlphaSeekBar.getProgress() + "\n w: " + lp.width + "\nh: " + lp.height + "\nelevation: " + mCardView.getCardElevation() + " of " + mCardView.getMaxCardElevation()); @@ -143,15 +148,42 @@ public class CardViewActivity extends Activity { } }); - update(); new Handler().postDelayed(new Runnable() { @Override public void run() { View content = findViewById(android.R.id.content); + mWidthSeekBar.setProgress(mCardView.getWidth()); + mHeightSeekBar.setProgress(mCardView.getHeight()); mWidthSeekBar.setMax(content.getWidth()); mHeightSeekBar.setMax(content.getHeight()); + update(); } }, 100); + + ((RadioGroup) findViewById(R.id.select_bg_color_radio)) + .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(RadioGroup group, int checkedId) { + mCardView.setCardBackgroundColor( + getResources().getColor(getColorId(checkedId))); + } + }); } + private int getColorId(int id) { + switch (id) { + case R.id.yellow: + return R.color.card_yellow; + case R.id.aquatic: + return R.color.card_aquatic; + case R.id.classic: + return R.color.card_classic; + case R.id.sunbrite: + return R.color.card_sunbrite; + case R.id.tropical: + return R.color.card_tropical; + default: + return R.color.cardview_light_background; + } + } } diff --git a/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java b/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java index 50fe1e1a8..b503bcf0e 100644 --- a/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java +++ b/samples/Support7Demos/src/com/example/android/supportv7/widget/AnimatedRecyclerView.java @@ -480,7 +480,7 @@ public class AnimatedRecyclerView extends Activity { } public void selectItem(MyViewHolder holder, boolean selected) { - mSelected.put((String) holder.textView.getText(), selected); + mSelected.put((String) holder.textView.getText().toString(), selected); } public void toggleExpanded(MyViewHolder holder) { diff --git a/samples/samples_source.prop_template b/samples/samples_source.prop_template index d3cdfd5ee..523d6bda8 100644 --- a/samples/samples_source.prop_template +++ b/samples/samples_source.prop_template @@ -1,4 +1,4 @@ Pkg.UserSrc=false -Pkg.Revision=1 +Pkg.Revision=2 AndroidVersion.ApiLevel=${PLATFORM_SDK_VERSION} AndroidVersion.CodeName=${PLATFORM_VERSION_CODENAME} diff --git a/samples/wearable/.gitignore b/samples/wearable/.gitignore deleted file mode 100644 index a76265553..000000000 --- a/samples/wearable/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -# built application files -*.apk -*.ap_ - -# files for the dex VM -*.dex - -# Java class files -*.class - -# generated files -bin/ -out/ -src/common -src/template -_index.jd -README.txt - -# Libraries used by the app -# Can explicitly add if we want, but shouldn't do so blindly. Licenses, bloat, etc. -/libs - - -# Build stuff (auto-generated by android update project ...) -ant.properties -local.properties - -# Eclipse project files -.classpath -.project - -# idea project files -.idea/ -.idea/.name -*.iml -*.ipr -*.iws - -##Gradle-based build -.gradle -build/ - diff --git a/samples/wearable/AgendaData/Application/build.gradle b/samples/wearable/AgendaData/Application/build.gradle deleted file mode 100644 index 8d1d61958..000000000 --- a/samples/wearable/AgendaData/Application/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -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.google.android.gms:play-services:5.0.+' - compile "com.android.support:support-v4:20.0.+" - wearApp project(':Wearable') -} diff --git a/samples/wearable/AgendaData/Application/proguard-rules.txt b/samples/wearable/AgendaData/Application/proguard-rules.txt deleted file mode 100644 index 53f713a6b..000000000 --- a/samples/wearable/AgendaData/Application/proguard-rules.txt +++ /dev/null @@ -1,28 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView - --keep class android.support.wearable.view.WearableListView { - private void setScrollAnimator(int); - protected void setScrollVertically(int); -} - diff --git a/samples/wearable/AgendaData/Application/project.properties b/samples/wearable/AgendaData/Application/project.properties deleted file mode 100644 index 4ab125693..000000000 --- a/samples/wearable/AgendaData/Application/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/samples/wearable/AgendaData/Application/src/main/AndroidManifest.xml b/samples/wearable/AgendaData/Application/src/main/AndroidManifest.xml deleted file mode 100644 index 0f1e7dbef..000000000 --- a/samples/wearable/AgendaData/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,45 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.agendadata"> - - <uses-permission android:name="android.permission.READ_CALENDAR" /> - <uses-permission android:name="android.permission.READ_CONTACTS" /> - - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.Holo.Light" - android:allowBackup="false"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <activity - android:name="com.example.android.wearable.agendadata.MainActivity" - android:label="@string/app_name" - android:configChanges="keyboardHidden|orientation|screenSize"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - - <service android:name="com.example.android.wearable.agendadata.CalendarQueryService"/> - </application> -</manifest> diff --git a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/CalendarQueryService.java b/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/CalendarQueryService.java deleted file mode 100644 index c39a5ed1b..000000000 --- a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/CalendarQueryService.java +++ /dev/null @@ -1,267 +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.agendadata; - - -import static com.example.android.wearable.agendadata.Constants.TAG; -import static com.example.android.wearable.agendadata.Constants.CONNECTION_TIME_OUT_MS; -import static com.example.android.wearable.agendadata.Constants.CAL_DATA_ITEM_PATH_PREFIX; -import static com.example.android.wearable.agendadata.Constants.ALL_DAY; -import static com.example.android.wearable.agendadata.Constants.BEGIN; -import static com.example.android.wearable.agendadata.Constants.DATA_ITEM_URI; -import static com.example.android.wearable.agendadata.Constants.DESCRIPTION; -import static com.example.android.wearable.agendadata.Constants.END; -import static com.example.android.wearable.agendadata.Constants.EVENT_ID; -import static com.example.android.wearable.agendadata.Constants.ID; -import static com.example.android.wearable.agendadata.Constants.PROFILE_PIC; -import static com.example.android.wearable.agendadata.Constants.TITLE; - -import android.app.IntentService; -import android.content.ContentResolver; -import android.content.ContentUris; -import android.content.Context; -import android.content.Intent; -import android.content.res.Resources; -import android.database.Cursor; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.Uri; -import android.os.Bundle; -import android.provider.CalendarContract; -import android.provider.ContactsContract.CommonDataKinds.Email; -import android.provider.ContactsContract.Contacts; -import android.provider.ContactsContract.Data; -import android.text.format.Time; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; -import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.Wearable; - -import java.io.ByteArrayOutputStream; -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Queries calendar events using Android Calendar Provider API and creates a data item for each - * event. - */ -public class CalendarQueryService extends IntentService - implements ConnectionCallbacks, OnConnectionFailedListener { - - private static final String[] INSTANCE_PROJECTION = { - CalendarContract.Instances._ID, - CalendarContract.Instances.EVENT_ID, - CalendarContract.Instances.TITLE, - CalendarContract.Instances.BEGIN, - CalendarContract.Instances.END, - CalendarContract.Instances.ALL_DAY, - CalendarContract.Instances.DESCRIPTION, - CalendarContract.Instances.ORGANIZER - }; - - private static final String[] CONTACT_PROJECTION = new String[] { Data._ID, Data.CONTACT_ID }; - private static final String CONTACT_SELECTION = Email.ADDRESS + " = ?"; - - private GoogleApiClient mGoogleApiClient; - - public CalendarQueryService() { - super(CalendarQueryService.class.getSimpleName()); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onHandleIntent(Intent intent) { - mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); - // Query calendar events in the next 24 hours. - Time time = new Time(); - time.setToNow(); - long beginTime = time.toMillis(true); - time.monthDay++; - time.normalize(true); - long endTime = time.normalize(true); - - List<Event> events = queryEvents(this, beginTime, endTime); - for (Event event : events) { - final PutDataMapRequest putDataMapRequest = event.toPutDataMapRequest(); - if (mGoogleApiClient.isConnected()) { - Wearable.DataApi.putDataItem( - mGoogleApiClient, putDataMapRequest.asPutDataRequest()).await(); - } else { - Log.e(TAG, "Failed to send data item: " + putDataMapRequest - + " - Client disconnected from Google Play Services"); - } - } - mGoogleApiClient.disconnect(); - } - - private static String makeDataItemPath(long eventId, long beginTime) { - return CAL_DATA_ITEM_PATH_PREFIX + eventId + "/" + beginTime; - } - - private static List<Event> queryEvents(Context context, long beginTime, long endTime) { - ContentResolver contentResolver = context.getContentResolver(); - Uri.Builder builder = CalendarContract.Instances.CONTENT_URI.buildUpon(); - ContentUris.appendId(builder, beginTime); - ContentUris.appendId(builder, endTime); - - Cursor cursor = contentResolver.query(builder.build(), INSTANCE_PROJECTION, - null /* selection */, null /* selectionArgs */, null /* sortOrder */); - try { - int idIdx = cursor.getColumnIndex(CalendarContract.Instances._ID); - int eventIdIdx = cursor.getColumnIndex(CalendarContract.Instances.EVENT_ID); - int titleIdx = cursor.getColumnIndex(CalendarContract.Instances.TITLE); - int beginIdx = cursor.getColumnIndex(CalendarContract.Instances.BEGIN); - int endIdx = cursor.getColumnIndex(CalendarContract.Instances.END); - int allDayIdx = cursor.getColumnIndex(CalendarContract.Instances.ALL_DAY); - int descIdx = cursor.getColumnIndex(CalendarContract.Instances.DESCRIPTION); - int ownerEmailIdx = cursor.getColumnIndex(CalendarContract.Instances.ORGANIZER); - - List<Event> events = new ArrayList<Event>(cursor.getCount()); - while (cursor.moveToNext()) { - Event event = new Event(); - event.id = cursor.getLong(idIdx); - event.eventId = cursor.getLong(eventIdIdx); - event.title = cursor.getString(titleIdx); - event.begin = cursor.getLong(beginIdx); - event.end = cursor.getLong(endIdx); - event.allDay = cursor.getInt(allDayIdx) != 0; - event.description = cursor.getString(descIdx); - String ownerEmail = cursor.getString(ownerEmailIdx); - Cursor contactCursor = contentResolver.query(Data.CONTENT_URI, - CONTACT_PROJECTION, CONTACT_SELECTION, new String[] {ownerEmail}, null); - int ownerIdIdx = contactCursor.getColumnIndex(Data.CONTACT_ID); - long ownerId = -1; - if (contactCursor.moveToFirst()) { - ownerId = contactCursor.getLong(ownerIdIdx); - } - contactCursor.close(); - // Use event organizer's profile picture as the notification background. - event.ownerProfilePic = getProfilePicture(contentResolver, context, ownerId); - events.add(event); - } - return events; - } finally { - cursor.close(); - } - } - - @Override - public void onConnected(Bundle connectionHint) { - } - - @Override - public void onConnectionSuspended(int cause) { - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - } - - private static Asset getDefaultProfile(Resources res) { - Bitmap bitmap = BitmapFactory.decodeResource(res, R.drawable.nobody); - return Asset.createFromBytes(toByteArray(bitmap)); - } - - private static Asset getProfilePicture(ContentResolver contentResolver, Context context, - long contactId) { - if (contactId != -1) { - // Try to retrieve the profile picture for the given contact. - Uri contactUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, contactId); - InputStream inputStream = Contacts.openContactPhotoInputStream(contentResolver, - contactUri, true /*preferHighres*/); - - if (null != inputStream) { - try { - Bitmap bitmap = BitmapFactory.decodeStream(inputStream); - if (bitmap != null) { - return Asset.createFromBytes(toByteArray(bitmap)); - } else { - Log.e(TAG, "Cannot decode profile picture for contact " + contactId); - } - } finally { - closeQuietly(inputStream); - } - } - } - // Use a default background image if the user has no profile picture or there was an error. - return getDefaultProfile(context.getResources()); - } - - private static byte[] toByteArray(Bitmap bitmap) { - ByteArrayOutputStream stream = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream); - byte[] byteArray = stream.toByteArray(); - closeQuietly(stream); - return byteArray; - } - - private static void closeQuietly(Closeable closeable) { - try { - closeable.close(); - } catch (IOException e) { - Log.e(TAG, "IOException while closing closeable.", e); - } - } - - private static class Event { - - public long id; - public long eventId; - public String title; - public long begin; - public long end; - public boolean allDay; - public String description; - public Asset ownerProfilePic; - - public PutDataMapRequest toPutDataMapRequest(){ - final PutDataMapRequest putDataMapRequest = PutDataMapRequest.create( - makeDataItemPath(eventId, begin)); - DataMap data = putDataMapRequest.getDataMap(); - data.putString(DATA_ITEM_URI, putDataMapRequest.getUri().toString()); - data.putLong(ID, id); - data.putLong(EVENT_ID, eventId); - data.putString(TITLE, title); - data.putLong(BEGIN, begin); - data.putLong(END, end); - data.putBoolean(ALL_DAY, allDay); - data.putString(DESCRIPTION, description); - data.putAsset(PROFILE_PIC, ownerProfilePic); - - return putDataMapRequest; - } - } -} diff --git a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/Constants.java b/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/Constants.java deleted file mode 100644 index 6dc6952ca..000000000 --- a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/Constants.java +++ /dev/null @@ -1,39 +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.agendadata; - -/** Constants used in companion app. */ -public final class Constants { - private Constants() { - } - - public static final String TAG = "AgendaDataSample"; - - public static final String CAL_DATA_ITEM_PATH_PREFIX = "/event"; - // Timeout for making a connection to GoogleApiClient (in milliseconds). - public static final long CONNECTION_TIME_OUT_MS = 100; - - public static final String EVENT_ID = "event_id"; - public static final String ID = "id"; - public static final String TITLE = "title"; - public static final String DESCRIPTION = "description"; - public static final String BEGIN = "begin"; - public static final String END = "end"; - public static final String DATA_ITEM_URI = "data_item_uri"; - public static final String ALL_DAY = "all_day"; - public static final String PROFILE_PIC = "profile_pic"; -} diff --git a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/MainActivity.java b/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/MainActivity.java deleted file mode 100644 index 8e4063d8c..000000000 --- a/samples/wearable/AgendaData/Application/src/main/java/com/example/android/wearable/agendadata/MainActivity.java +++ /dev/null @@ -1,202 +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.agendadata; - -import static com.example.android.wearable.agendadata.Constants.TAG; - -import android.app.Activity; -import android.content.Intent; -import android.content.IntentSender; -import android.net.Uri; -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.ScrollView; -import android.widget.TextView; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; -import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.common.data.FreezableUtils; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataItem; -import com.google.android.gms.wearable.DataItemBuffer; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.NodeApi; -import com.google.android.gms.wearable.Wearable; - -import java.util.List; - -public class MainActivity extends Activity implements NodeApi.NodeListener, ConnectionCallbacks, - OnConnectionFailedListener { - - /** Request code for launching the Intent to resolve Google Play services errors. */ - private static final int REQUEST_RESOLVE_ERROR = 1000; - - private GoogleApiClient mGoogleApiClient; - private boolean mResolvingError = false; - - private TextView mLogTextView; - ScrollView mScroller; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main); - mLogTextView = (TextView) findViewById(R.id.log); - mScroller = (ScrollView) findViewById(R.id.scroller); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onStart() { - super.onStart(); - if (!mResolvingError) { - mGoogleApiClient.connect(); - } - } - - @Override - protected void onStop() { - if (mGoogleApiClient.isConnected()) { - Wearable.NodeApi.removeListener(mGoogleApiClient, this); - } - mGoogleApiClient.disconnect(); - super.onStop(); - } - - public void onGetEventsClicked(View v) { - startService(new Intent(this, CalendarQueryService.class)); - } - - public void onDeleteEventsClicked(View v) { - if (mGoogleApiClient.isConnected()) { - Wearable.DataApi.getDataItems(mGoogleApiClient) - .setResultCallback(new ResultCallback<DataItemBuffer>() { - @Override - public void onResult(DataItemBuffer result) { - if (result.getStatus().isSuccess()) { - deleteDataItems(result); - } else { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "onDeleteEventsClicked(): failed to get Data Items"); - } - } - result.close(); - } - }); - } else { - Log.e(TAG, "Failed to delete data items" - + " - Client disconnected from Google Play Services"); - } - } - - private void deleteDataItems(DataItemBuffer dataItems) { - if (mGoogleApiClient.isConnected()) { - // Store the DataItem URIs in a List and close the buffer. Then use these URIs - // to delete the DataItems. - final List<DataItem> dataItemList = FreezableUtils.freezeIterable(dataItems); - dataItems.close(); - for (final DataItem dataItem : dataItemList) { - final Uri dataItemUri = dataItem.getUri(); - // In a real calendar application, this might delete the corresponding calendar - // event from the calendar data provider. In this sample, we simply delete the - // DataItem, but leave the phone's calendar data intact. - Wearable.DataApi.deleteDataItems(mGoogleApiClient, dataItemUri) - .setResultCallback(new ResultCallback<DataApi.DeleteDataItemsResult>() { - @Override - public void onResult(DataApi.DeleteDataItemsResult deleteResult) { - if (deleteResult.getStatus().isSuccess()) { - appendLog("Successfully deleted data item: " + dataItemUri); - } else { - appendLog("Failed to delete data item:" + dataItemUri); - } - } - }); - } - } else { - Log.e(TAG, "Failed to delete data items" - + " - Client disconnected from Google Play Services"); - } - } - - private void appendLog(final String s) { - mLogTextView.post(new Runnable() { - @Override - public void run() { - mLogTextView.append(s); - mLogTextView.append("\n"); - mScroller.fullScroll(View.FOCUS_DOWN); - } - }); - } - - @Override - public void onPeerConnected(Node peer) { - appendLog("Device connected"); - } - - @Override - public void onPeerDisconnected(Node peer) { - appendLog("Device disconnected"); - } - - @Override - public void onConnected(Bundle connectionHint) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Connected to Google Api Service"); - } - mResolvingError = false; - Wearable.NodeApi.addListener(mGoogleApiClient, this); - } - - @Override - public void onConnectionSuspended(int cause) { - // Ignore - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Disconnected from Google Api Service"); - } - if (null != Wearable.NodeApi) { - Wearable.NodeApi.removeListener(mGoogleApiClient, this); - } - if (mResolvingError) { - // Already attempting to resolve an error. - return; - } else if (result.hasResolution()) { - try { - mResolvingError = true; - result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR); - } catch (IntentSender.SendIntentException e) { - // There was an error with the resolution intent. Try again. - mGoogleApiClient.connect(); - } - } else { - mResolvingError = false; - } - } -} diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/AgendaData/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 0564717bb..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/AgendaData/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 0f4034743..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-nodpi/nobody.png b/samples/wearable/AgendaData/Application/src/main/res/drawable-nodpi/nobody.png Binary files differdeleted file mode 100644 index 5a33d60e0..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/drawable-nodpi/nobody.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/AgendaData/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index d7705cfb0..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/AgendaData/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index f07299fd2..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Application/src/main/res/layout/main.xml b/samples/wearable/AgendaData/Application/src/main/res/layout/main.xml deleted file mode 100644 index 8e82cdd45..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/layout/main.xml +++ /dev/null @@ -1,58 +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. ---> - -<LinearLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <Button - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:text="@string/get_events" - android:onClick="onGetEventsClicked"/> - <Button - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:text="@string/delete_events" - android:onClick="onDeleteEventsClicked"/> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textAppearance="?android:textAppearanceLarge" - android:layout_marginTop="6dp" - android:padding="6dp" - android:text="@string/log" - android:textAllCaps="true" - android:textColor="@android:color/white" - android:background="@android:color/black"/> - - <ScrollView - android:id="@+id/scroller" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:id="@+id/log" - android:fontFamily="courier" - android:textColor="@android:color/white" - android:background="@android:color/black" - android:layout_width="match_parent" - android:layout_height="wrap_content"/> - </ScrollView> -</LinearLayout> diff --git a/samples/wearable/AgendaData/Application/src/main/res/values/strings.xml b/samples/wearable/AgendaData/Application/src/main/res/values/strings.xml deleted file mode 100644 index b18a6587d..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,22 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="app_name">Android Wear AgendaData Example Application</string> - <string name="get_events">Sync calendar events to wearable</string> - <string name="delete_events">Delete calendar events from wearable</string> - <string name="log">Log</string> -</resources> diff --git a/samples/wearable/AgendaData/Application/src/main/res/values/styles.xml b/samples/wearable/AgendaData/Application/src/main/res/values/styles.xml deleted file mode 100644 index 209e00f81..000000000 --- a/samples/wearable/AgendaData/Application/src/main/res/values/styles.xml +++ /dev/null @@ -1,26 +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. ---> - -<resources> - <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"> - <item name="android:windowAnimationStyle">@null</item> - </style> - - <!-- Application theme. --> - <style name="AppTheme" parent="AppBaseTheme"> - <!-- All customizations that are NOT specific to a particular API-level can go here. --> - </style> -</resources> diff --git a/samples/wearable/AgendaData/Wearable/build.gradle b/samples/wearable/AgendaData/Wearable/build.gradle deleted file mode 100644 index 0e23b4d56..000000000 --- a/samples/wearable/AgendaData/Wearable/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile 'com.google.android.gms:play-services-wearable:+' - compile "com.google.android.support:wearable:1.0.+" -}
\ No newline at end of file diff --git a/samples/wearable/AgendaData/Wearable/proguard-rules.txt b/samples/wearable/AgendaData/Wearable/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/AgendaData/Wearable/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/AgendaData/Wearable/project.properties b/samples/wearable/AgendaData/Wearable/project.properties deleted file mode 100644 index 4ab125693..000000000 --- a/samples/wearable/AgendaData/Wearable/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/samples/wearable/AgendaData/Wearable/src/main/AndroidManifest.xml b/samples/wearable/AgendaData/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 686badc3d..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,43 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.agendadata" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:allowBackup="false"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <service - android:name="com.example.android.wearable.agendadata.HomeListenerService" > - <intent-filter> - <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - </service> - - <service android:name="com.example.android.wearable.agendadata.DeleteService"/> - - <activity android:name="android.support.wearable.activity.ConfirmationActivity"/> - - </application> -</manifest> diff --git a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/Constants.java b/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/Constants.java deleted file mode 100644 index 176a21eb1..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/Constants.java +++ /dev/null @@ -1,35 +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.agendadata; - -/** Constants used in wearable app. */ -public final class Constants { - - private Constants() { - } - - public static final String TAG = "AgendaDataSample"; - - public static final String TITLE = "title"; - public static final String DESCRIPTION = "description"; - public static final String BEGIN = "begin"; - public static final String END = "end"; - public static final String ALL_DAY = "all_day"; - public static final String PROFILE_PIC = "profile_pic"; - - public static final String EXTRA_SILENT = "silent"; -} diff --git a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/DeleteService.java b/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/DeleteService.java deleted file mode 100644 index 86aafe03d..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/DeleteService.java +++ /dev/null @@ -1,118 +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.agendadata; - -import static com.example.android.wearable.agendadata.Constants.TAG; -import static com.example.android.wearable.agendadata.Constants.EXTRA_SILENT; - -import android.app.IntentService; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.support.wearable.activity.ConfirmationActivity; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.Wearable; - -import java.util.concurrent.TimeUnit; - -/** - * Handles "Delete" button on calendar event card. - */ -public class DeleteService extends IntentService implements GoogleApiClient.ConnectionCallbacks, - GoogleApiClient.OnConnectionFailedListener { - - /* Timeout for making a connection to GoogleApiClient (in milliseconds) */ - private static final long TIME_OUT = 100; - - private GoogleApiClient mGoogleApiClient; - - public DeleteService() { - super(DeleteService.class.getSimpleName()); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onHandleIntent(Intent intent) { - mGoogleApiClient.blockingConnect(TIME_OUT, TimeUnit.MILLISECONDS); - Uri dataItemUri = intent.getData(); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "DeleteService.onHandleIntent=" + dataItemUri); - } - if (mGoogleApiClient.isConnected()) { - DataApi.DeleteDataItemsResult result = Wearable.DataApi - .deleteDataItems(mGoogleApiClient, dataItemUri).await(); - if (result.getStatus().isSuccess() && !intent.getBooleanExtra(EXTRA_SILENT, false)) { - // Show the success animation on the watch unless Silent extra is true. - startConfirmationActivity(ConfirmationActivity.SUCCESS_ANIMATION, - getString(R.string.delete_successful)); - } else { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "DeleteService.onHandleIntent: Failed to delete dataItem:" - + dataItemUri); - } - // Show the failure animation on the watch unless Silent extra is true. - if (!intent.getBooleanExtra(EXTRA_SILENT, false)) { - startConfirmationActivity(ConfirmationActivity.FAILURE_ANIMATION, - getString(R.string.delete_unsuccessful)); - } - } - } else { - Log.e(TAG, "Failed to delete data item: " + dataItemUri - + " - Client disconnected from Google Play Services"); - // Show the failure animation on the watch unless Silent extra is true. - if (!intent.getBooleanExtra(EXTRA_SILENT, false)) { - startConfirmationActivity(ConfirmationActivity.FAILURE_ANIMATION, - getString(R.string.delete_unsuccessful)); - } - } - mGoogleApiClient.disconnect(); - } - - private void startConfirmationActivity(int animationType, String message) { - Intent confirmationActivity = new Intent(this, ConfirmationActivity.class) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION) - .putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, animationType) - .putExtra(ConfirmationActivity.EXTRA_MESSAGE, message); - startActivity(confirmationActivity); - } - - @Override - public void onConnected(Bundle connectionHint) { - } - - @Override - public void onConnectionSuspended(int cause) { - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - } - -} diff --git a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/HomeListenerService.java b/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/HomeListenerService.java deleted file mode 100644 index ef47977e3..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/java/com/example/android/wearable/agendadata/HomeListenerService.java +++ /dev/null @@ -1,180 +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.agendadata; - -import static com.example.android.wearable.agendadata.Constants.TAG; -import static com.example.android.wearable.agendadata.Constants.EXTRA_SILENT; - -import static com.example.android.wearable.agendadata.Constants.ALL_DAY; -import static com.example.android.wearable.agendadata.Constants.BEGIN; -import static com.example.android.wearable.agendadata.Constants.DESCRIPTION; -import static com.example.android.wearable.agendadata.Constants.END; -import static com.example.android.wearable.agendadata.Constants.PROFILE_PIC; -import static com.example.android.wearable.agendadata.Constants.TITLE; - -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.Uri; -import android.text.TextUtils; -import android.text.format.DateFormat; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.DataItem; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.DataMapItem; -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.WearableListenerService; - -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -/** - * Listens to DataItem events on the home device. - */ -public class HomeListenerService extends WearableListenerService { - - private static final Map<Uri, Integer> sNotificationIdByDataItemUri = - new HashMap<Uri, Integer>(); - private static int sNotificationId = 1; - private GoogleApiClient mGoogleApiClient; - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "onDataChanged: " + dataEvents + " for " + getPackageName()); - } - for (DataEvent event : dataEvents) { - if (event.getType() == DataEvent.TYPE_DELETED) { - deleteDataItem(event.getDataItem()); - } else if (event.getType() == DataEvent.TYPE_CHANGED) { - UpdateNotificationForDataItem(event.getDataItem()); - } - } - dataEvents.close(); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this.getApplicationContext()) - .addApi(Wearable.API) - .build(); - mGoogleApiClient.connect(); - } - - /** - * Posts a local notification to show calendar card. - */ - private void UpdateNotificationForDataItem(DataItem dataItem) { - DataMapItem mapDataItem = DataMapItem.fromDataItem(dataItem); - DataMap data = mapDataItem.getDataMap(); - - String description = data.getString(DESCRIPTION); - if (TextUtils.isEmpty(description)) { - description = ""; - } else { - // Add a space between the description and the time of the event. - description += " "; - } - String contentText; - if (data.getBoolean(ALL_DAY)) { - contentText = getString(R.string.desc_all_day, description); - } else { - String startTime = DateFormat.getTimeFormat(this).format(new Date(data.getLong(BEGIN))); - String endTime = DateFormat.getTimeFormat(this).format(new Date(data.getLong(END))); - contentText = getString(R.string.desc_time_period, description, startTime, endTime); - } - - Intent deleteOperation = new Intent(this, DeleteService.class); - // Use a unique identifier for the delete action. - String deleteAction = "action_delete" + dataItem.getUri().toString() + sNotificationId; - deleteOperation.setAction(deleteAction); - deleteOperation.setData(dataItem.getUri()); - PendingIntent deleteIntent = PendingIntent.getService(this, 0, deleteOperation, - PendingIntent.FLAG_ONE_SHOT); - PendingIntent silentDeleteIntent = PendingIntent.getService(this, 1, - deleteOperation.putExtra(EXTRA_SILENT, true), PendingIntent.FLAG_ONE_SHOT); - - Notification.Builder notificationBuilder = new Notification.Builder(this) - .setContentTitle(data.getString(TITLE)) - .setContentText(contentText) - .setSmallIcon(R.drawable.ic_launcher) - .addAction(R.drawable.ic_menu_delete, getText(R.string.delete), deleteIntent) - .setDeleteIntent(silentDeleteIntent) // Delete DataItem if notification dismissed. - .setLocalOnly(true) - .setPriority(Notification.PRIORITY_MIN); - - // Set the event owner's profile picture as the notification background. - Asset asset = data.getAsset(PROFILE_PIC); - if (null != asset) { - if (mGoogleApiClient.isConnected()) { - DataApi.GetFdForAssetResult assetFdResult = - Wearable.DataApi.getFdForAsset(mGoogleApiClient, asset).await(); - if (assetFdResult.getStatus().isSuccess()) { - Bitmap profilePic = BitmapFactory.decodeStream(assetFdResult.getInputStream()); - notificationBuilder.extend(new Notification.WearableExtender() - .setBackground(profilePic)); - } else if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "asset fetch failed with statusCode: " - + assetFdResult.getStatus().getStatusCode()); - } - } else { - Log.e(TAG, "Failed to set notification background" - + " - Client disconnected from Google Play Services"); - } - } - Notification card = notificationBuilder.build(); - - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(sNotificationId, card); - - sNotificationIdByDataItemUri.put(dataItem.getUri(), sNotificationId++); - } - - /** - * Deletes the calendar card associated with the data item. - */ - private void deleteDataItem(DataItem dataItem) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "onDataItemDeleted:DataItem=" + dataItem.getUri()); - } - Integer notificationId = sNotificationIdByDataItemUri.remove(dataItem.getUri()); - if (notificationId != null) { - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(notificationId); - } - } - - @Override - public void onMessageReceived(MessageEvent messageEvent) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "onMessageReceived: " + messageEvent.getPath() - + " " + messageEvent.getData() + " for " + getPackageName()); - } - } - -} diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 0564717bb..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_menu_delete.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_menu_delete.png Binary files differdeleted file mode 100644 index 24d8f6a4b..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-hdpi/ic_menu_delete.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 0f4034743..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_menu_delete.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_menu_delete.png Binary files differdeleted file mode 100644 index e2c8700c3..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-mdpi/ic_menu_delete.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index d7705cfb0..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_menu_delete.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_menu_delete.png Binary files differdeleted file mode 100644 index 65b9caed1..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xhdpi/ic_menu_delete.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index f07299fd2..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_menu_delete.png b/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_menu_delete.png Binary files differdeleted file mode 100644 index 8e9e78d43..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/drawable-xxhdpi/ic_menu_delete.png +++ /dev/null diff --git a/samples/wearable/AgendaData/Wearable/src/main/res/values/strings.xml b/samples/wearable/AgendaData/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 10ef53c4a..000000000 --- a/samples/wearable/AgendaData/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,24 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="app_name">Android Wear AgendaData Example Application</string> - <string name="delete">Delete</string> - <string name="desc_all_day">%s(All day)</string> - <string name="desc_time_period">%1$s(%2$s - %3$s)</string> - <string name="delete_successful">Event deleted</string> - <string name="delete_unsuccessful">Unable to delete event</string> -</resources> diff --git a/samples/wearable/AgendaData/_index.html b/samples/wearable/AgendaData/_index.html deleted file mode 100644 index 735e7861e..000000000 --- a/samples/wearable/AgendaData/_index.html +++ /dev/null @@ -1,17 +0,0 @@ -<p><b>About:</b> Syncs calendar events to your wearable at the press of a button, using the Wearable -DataApi to transmit data such as event time, description, and background image. The DataItems can be -deleted individually via an action on the event notifications, or all at once via a button on the -companion. When deleted using the notification action, a ConfirmationActivity is used to indicate -success or failure.</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. Start the sample by running the AgendaData application on the companion.</p> -<p><b>Wearable APIs used:</b> DataApi, NodeApi, WearableListenerService, ConfirmationActivity</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/companion_agenda_data.png" alt="Companion AgendaData" width="216" - height="384"> - <img src="screenshots/dummy_calendar_event.png" alt="Dummy Calendar Event" width="160" - height="160"> - <figcaption>Companion app and wearable app communicate with each other.</figcaption> - </figure> -</p> diff --git a/samples/wearable/AgendaData/build.gradle b/samples/wearable/AgendaData/build.gradle deleted file mode 100644 index d3c8c5971..000000000 --- a/samples/wearable/AgendaData/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -}
\ No newline at end of file diff --git a/samples/wearable/AgendaData/gradle.properties b/samples/wearable/AgendaData/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/AgendaData/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/AgendaData/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/AgendaData/gradlew b/samples/wearable/AgendaData/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/AgendaData/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/AgendaData/gradlew.bat b/samples/wearable/AgendaData/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/AgendaData/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/AgendaData/screenshots/companion_agenda_data.png b/samples/wearable/AgendaData/screenshots/companion_agenda_data.png Binary files differdeleted file mode 100644 index c39503bf2..000000000 --- a/samples/wearable/AgendaData/screenshots/companion_agenda_data.png +++ /dev/null diff --git a/samples/wearable/AgendaData/screenshots/dummy_calendar_event.png b/samples/wearable/AgendaData/screenshots/dummy_calendar_event.png Binary files differdeleted file mode 100644 index 074c56b4a..000000000 --- a/samples/wearable/AgendaData/screenshots/dummy_calendar_event.png +++ /dev/null diff --git a/samples/wearable/AgendaData/settings.gradle b/samples/wearable/AgendaData/settings.gradle deleted file mode 100644 index f3f25a547..000000000 --- a/samples/wearable/AgendaData/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Wearable', 'Application' diff --git a/samples/wearable/DataLayer/Application/build.gradle b/samples/wearable/DataLayer/Application/build.gradle deleted file mode 100644 index 8d1d61958..000000000 --- a/samples/wearable/DataLayer/Application/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -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.google.android.gms:play-services:5.0.+' - compile "com.android.support:support-v4:20.0.+" - wearApp project(':Wearable') -} diff --git a/samples/wearable/DataLayer/Application/proguard-rules.txt b/samples/wearable/DataLayer/Application/proguard-rules.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/samples/wearable/DataLayer/Application/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/DataLayer/Application/src/main/AndroidManifest.xml b/samples/wearable/DataLayer/Application/src/main/AndroidManifest.xml deleted file mode 100644 index 33e7bdb90..000000000 --- a/samples/wearable/DataLayer/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,41 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.datalayer" > - - <uses-feature android:name="android.hardware.camera" android:required="false" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <activity - android:name=".MainActivity" - android:label="@string/app_name" - android:launchMode="singleTask" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/samples/wearable/DataLayer/Application/src/main/java/com/example/android/wearable/datalayer/MainActivity.java b/samples/wearable/DataLayer/Application/src/main/java/com/example/android/wearable/datalayer/MainActivity.java deleted file mode 100644 index 23bc696d3..000000000 --- a/samples/wearable/DataLayer/Application/src/main/java/com/example/android/wearable/datalayer/MainActivity.java +++ /dev/null @@ -1,484 +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.datalayer; - -import android.app.Activity; -import android.content.Context; -import android.content.Intent; -import android.content.IntentSender; -import android.content.pm.PackageManager; -import android.graphics.Bitmap; -import android.os.AsyncTask; -import android.os.Bundle; -import android.os.Handler; -import android.provider.MediaStore; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ArrayAdapter; -import android.widget.Button; -import android.widget.ImageView; -import android.widget.ListView; -import android.widget.TextView; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; -import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; -import com.google.android.gms.common.data.FreezableUtils; -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.DataApi.DataItemResult; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.MessageApi.SendMessageResult; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.MessageApi; -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.NodeApi; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.PutDataRequest; -import com.google.android.gms.wearable.Wearable; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.Collection; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - -/** - * Receives its own events using a listener API designed for foreground activities. Updates a data - * item every second while it is open. Also allows user to take a photo and send that as an asset to - * the paired wearable. - */ -public class MainActivity extends Activity implements DataApi.DataListener, - MessageApi.MessageListener, NodeApi.NodeListener, ConnectionCallbacks, - OnConnectionFailedListener { - - private static final String TAG = "MainActivity"; - - /** Request code for launching the Intent to resolve Google Play services errors. */ - private static final int REQUEST_RESOLVE_ERROR = 1000; - - private static final String START_ACTIVITY_PATH = "/start-activity"; - private static final String COUNT_PATH = "/count"; - private static final String IMAGE_PATH = "/image"; - private static final String IMAGE_KEY = "photo"; - private static final String COUNT_KEY = "count"; - - private GoogleApiClient mGoogleApiClient; - private boolean mResolvingError = false; - private boolean mCameraSupported = false; - - private ListView mDataItemList; - private Button mTakePhotoBtn; - private Button mSendPhotoBtn; - private ImageView mThumbView; - private Bitmap mImageBitmap; - private View mStartActivityBtn; - - private DataItemAdapter mDataItemListAdapter; - private Handler mHandler; - - // Send DataItems. - private ScheduledExecutorService mGeneratorExecutor; - private ScheduledFuture<?> mDataItemGeneratorFuture; - - static final int REQUEST_IMAGE_CAPTURE = 1; - - @Override - public void onCreate(Bundle b) { - super.onCreate(b); - mHandler = new Handler(); - LOGD(TAG, "onCreate"); - mCameraSupported = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA); - setContentView(R.layout.main_activity); - setupViews(); - - // Stores DataItems received by the local broadcaster or from the paired watch. - mDataItemListAdapter = new DataItemAdapter(this, android.R.layout.simple_list_item_1); - mDataItemList.setAdapter(mDataItemListAdapter); - - mGeneratorExecutor = new ScheduledThreadPoolExecutor(1); - - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) { - Bundle extras = data.getExtras(); - mImageBitmap = (Bitmap) extras.get("data"); - mThumbView.setImageBitmap(mImageBitmap); - } - } - - @Override - protected void onStart() { - super.onStart(); - if (!mResolvingError) { - mGoogleApiClient.connect(); - } - } - - @Override - public void onResume() { - super.onResume(); - mDataItemGeneratorFuture = mGeneratorExecutor.scheduleWithFixedDelay( - new DataItemGenerator(), 1, 5, TimeUnit.SECONDS); - } - - @Override - public void onPause() { - super.onPause(); - mDataItemGeneratorFuture.cancel(true /* mayInterruptIfRunning */); - } - - @Override - protected void onStop() { - if (!mResolvingError) { - Wearable.DataApi.removeListener(mGoogleApiClient, this); - Wearable.MessageApi.removeListener(mGoogleApiClient, this); - Wearable.NodeApi.removeListener(mGoogleApiClient, this); - mGoogleApiClient.disconnect(); - } - super.onStop(); - } - - @Override //ConnectionCallbacks - public void onConnected(Bundle connectionHint) { - LOGD(TAG, "Google API Client was connected"); - mResolvingError = false; - mStartActivityBtn.setEnabled(true); - mSendPhotoBtn.setEnabled(mCameraSupported); - Wearable.DataApi.addListener(mGoogleApiClient, this); - Wearable.MessageApi.addListener(mGoogleApiClient, this); - Wearable.NodeApi.addListener(mGoogleApiClient, this); - } - - @Override //ConnectionCallbacks - public void onConnectionSuspended(int cause) { - LOGD(TAG, "Connection to Google API client was suspended"); - mStartActivityBtn.setEnabled(false); - mSendPhotoBtn.setEnabled(false); - } - - @Override //OnConnectionFailedListener - public void onConnectionFailed(ConnectionResult result) { - if (mResolvingError) { - // Already attempting to resolve an error. - return; - } else if (result.hasResolution()) { - try { - mResolvingError = true; - result.startResolutionForResult(this, REQUEST_RESOLVE_ERROR); - } catch (IntentSender.SendIntentException e) { - // There was an error with the resolution intent. Try again. - mGoogleApiClient.connect(); - } - } else { - Log.e(TAG, "Connection to Google API client has failed"); - mResolvingError = false; - mStartActivityBtn.setEnabled(false); - mSendPhotoBtn.setEnabled(false); - Wearable.DataApi.removeListener(mGoogleApiClient, this); - Wearable.MessageApi.removeListener(mGoogleApiClient, this); - Wearable.NodeApi.removeListener(mGoogleApiClient, this); - } - } - - @Override //DataListener - public void onDataChanged(DataEventBuffer dataEvents) { - LOGD(TAG, "onDataChanged: " + dataEvents); - final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents); - dataEvents.close(); - runOnUiThread(new Runnable() { - @Override - public void run() { - for (DataEvent event : events) { - if (event.getType() == DataEvent.TYPE_CHANGED) { - mDataItemListAdapter.add( - new Event("DataItem Changed", event.getDataItem().toString())); - } else if (event.getType() == DataEvent.TYPE_DELETED) { - mDataItemListAdapter.add( - new Event("DataItem Deleted", event.getDataItem().toString())); - } - } - } - }); - } - - @Override //MessageListener - public void onMessageReceived(final MessageEvent messageEvent) { - LOGD(TAG, "onMessageReceived() A message from watch was received:" + messageEvent - .getRequestId() + " " + messageEvent.getPath()); - mHandler.post(new Runnable() { - @Override - public void run() { - mDataItemListAdapter.add(new Event("Message from watch", messageEvent.toString())); - } - }); - - } - - @Override //NodeListener - public void onPeerConnected(final Node peer) { - LOGD(TAG, "onPeerConnected: " + peer); - mHandler.post(new Runnable() { - @Override - public void run() { - mDataItemListAdapter.add(new Event("Connected", peer.toString())); - } - }); - - } - - @Override //NodeListener - public void onPeerDisconnected(final Node peer) { - LOGD(TAG, "onPeerDisconnected: " + peer); - mHandler.post(new Runnable() { - @Override - public void run() { - mDataItemListAdapter.add(new Event("Disconnected", peer.toString())); - } - }); - } - - /** - * A View Adapter for presenting the Event objects in a list - */ - private static class DataItemAdapter extends ArrayAdapter<Event> { - - private final Context mContext; - - public DataItemAdapter(Context context, int unusedResource) { - super(context, unusedResource); - mContext = context; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder holder; - if (convertView == null) { - holder = new ViewHolder(); - LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - convertView = inflater.inflate(android.R.layout.two_line_list_item, null); - convertView.setTag(holder); - holder.text1 = (TextView) convertView.findViewById(android.R.id.text1); - holder.text2 = (TextView) convertView.findViewById(android.R.id.text2); - } else { - holder = (ViewHolder) convertView.getTag(); - } - Event event = getItem(position); - holder.text1.setText(event.title); - holder.text2.setText(event.text); - return convertView; - } - - private class ViewHolder { - - TextView text1; - TextView text2; - } - } - - private class Event { - - String title; - String text; - - public Event(String title, String text) { - this.title = title; - this.text = text; - } - } - - private Collection<String> getNodes() { - HashSet<String> results = new HashSet<String>(); - NodeApi.GetConnectedNodesResult nodes = - Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await(); - - for (Node node : nodes.getNodes()) { - results.add(node.getId()); - } - - return results; - } - - private void sendStartActivityMessage(String node) { - Wearable.MessageApi.sendMessage( - mGoogleApiClient, node, START_ACTIVITY_PATH, new byte[0]).setResultCallback( - new ResultCallback<SendMessageResult>() { - @Override - public void onResult(SendMessageResult sendMessageResult) { - if (!sendMessageResult.getStatus().isSuccess()) { - Log.e(TAG, "Failed to send message with status code: " - + sendMessageResult.getStatus().getStatusCode()); - } - } - } - ); - } - - private class StartWearableActivityTask extends AsyncTask<Void, Void, Void> { - - @Override - protected Void doInBackground(Void... args) { - Collection<String> nodes = getNodes(); - for (String node : nodes) { - sendStartActivityMessage(node); - } - return null; - } - } - - /** Sends an RPC to start a fullscreen Activity on the wearable. */ - public void onStartWearableActivityClick(View view) { - LOGD(TAG, "Generating RPC"); - - // Trigger an AsyncTask that will query for a list of connected nodes and send a - // "start-activity" message to each connected node. - new StartWearableActivityTask().execute(); - } - - /** Generates a DataItem based on an incrementing count. */ - private class DataItemGenerator implements Runnable { - - private int count = 0; - - @Override - public void run() { - PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(COUNT_PATH); - putDataMapRequest.getDataMap().putInt(COUNT_KEY, count++); - PutDataRequest request = putDataMapRequest.asPutDataRequest(); - - LOGD(TAG, "Generating DataItem: " + request); - if (!mGoogleApiClient.isConnected()) { - return; - } - Wearable.DataApi.putDataItem(mGoogleApiClient, request) - .setResultCallback(new ResultCallback<DataItemResult>() { - @Override - public void onResult(DataItemResult dataItemResult) { - if (!dataItemResult.getStatus().isSuccess()) { - Log.e(TAG, "ERROR: failed to putDataItem, status code: " - + dataItemResult.getStatus().getStatusCode()); - } - } - }); - } - } - - /** - * Dispatches an {@link android.content.Intent} to take a photo. Result will be returned back - * in onActivityResult(). - */ - private void dispatchTakePictureIntent() { - Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); - if (takePictureIntent.resolveActivity(getPackageManager()) != null) { - startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE); - } - } - - /** - * Builds an {@link com.google.android.gms.wearable.Asset} from a bitmap. The image that we get - * back from the camera in "data" is a thumbnail size. Typically, your image should not exceed - * 320x320 and if you want to have zoom and parallax effect in your app, limit the size of your - * image to 640x400. Resize your image before transferring to your wearable device. - */ - private static Asset toAsset(Bitmap bitmap) { - ByteArrayOutputStream byteStream = null; - try { - byteStream = new ByteArrayOutputStream(); - bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteStream); - return Asset.createFromBytes(byteStream.toByteArray()); - } finally { - if (null != byteStream) { - try { - byteStream.close(); - } catch (IOException e) { - // ignore - } - } - } - } - - /** - * Sends the asset that was created form the photo we took by adding it to the Data Item store. - */ - private void sendPhoto(Asset asset) { - PutDataMapRequest dataMap = PutDataMapRequest.create(IMAGE_PATH); - dataMap.getDataMap().putAsset(IMAGE_KEY, asset); - dataMap.getDataMap().putLong("time", new Date().getTime()); - PutDataRequest request = dataMap.asPutDataRequest(); - Wearable.DataApi.putDataItem(mGoogleApiClient, request) - .setResultCallback(new ResultCallback<DataItemResult>() { - @Override - public void onResult(DataItemResult dataItemResult) { - LOGD(TAG, "Sending image was successful: " + dataItemResult.getStatus() - .isSuccess()); - } - }); - - } - - public void onTakePhotoClick(View view) { - dispatchTakePictureIntent(); - } - - public void onSendPhotoClick(View view) { - if (null != mImageBitmap && mGoogleApiClient.isConnected()) { - sendPhoto(toAsset(mImageBitmap)); - } - } - - /** - * Sets up UI components and their callback handlers. - */ - private void setupViews() { - mTakePhotoBtn = (Button) findViewById(R.id.takePhoto); - mSendPhotoBtn = (Button) findViewById(R.id.sendPhoto); - - // Shows the image received from the handset - mThumbView = (ImageView) findViewById(R.id.imageView); - mDataItemList = (ListView) findViewById(R.id.data_item_list); - - mStartActivityBtn = findViewById(R.id.start_wearable_activity); - } - - /** - * As simple wrapper around Log.d - */ - private static void LOGD(final String tag, String message) { - if (Log.isLoggable(tag, Log.DEBUG)) { - Log.d(tag, message); - } - } - -} diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_content_picture.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_content_picture.png Binary files differdeleted file mode 100644 index 597997ca3..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_content_picture.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_content_picture.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_content_picture.png Binary files differdeleted file mode 100644 index c23f4c039..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_content_picture.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_content_picture.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_content_picture.png Binary files differdeleted file mode 100644 index 289adf11a..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_content_picture.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_content_picture.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_content_picture.png Binary files differdeleted file mode 100644 index 073ad553e..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_content_picture.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Application/src/main/res/drawable/divider.xml b/samples/wearable/DataLayer/Application/src/main/res/drawable/divider.xml deleted file mode 100644 index 95c4d33c6..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/drawable/divider.xml +++ /dev/null @@ -1,20 +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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android"> - <size android:height="2dip"/> - <solid android:color="#ffffffff"/> -</shape> diff --git a/samples/wearable/DataLayer/Application/src/main/res/layout/main_activity.xml b/samples/wearable/DataLayer/Application/src/main/res/layout/main_activity.xml deleted file mode 100644 index 0412023d6..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/layout/main_activity.xml +++ /dev/null @@ -1,86 +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" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <RelativeLayout - android:id="@+id/top" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_alignParentTop="true" - android:layout_marginTop="10dp"> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/take_photo" - android:id="@+id/takePhoto" - android:onClick="onTakePhotoClick" - android:layout_marginLeft="39dp" - android:layout_alignParentStart="true" - android:layout_alignParentTop="true" /> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/send_photo" - android:id="@+id/sendPhoto" - android:layout_alignRight="@+id/takePhoto" - android:layout_marginLeft="39dp" - android:enabled="false" - android:onClick="onSendPhotoClick" - android:layout_alignParentStart="true" - android:layout_below="@+id/takePhoto" /> - - <ImageView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/imageView" - android:layout_marginLeft="29dp" - android:layout_centerVertical="true" - android:layout_alignParentRight="true" - android:src="@drawable/ic_content_picture" /> - </RelativeLayout> - - <View - style="@style/Divider" - android:id="@+id/divider" - android:layout_below="@+id/top" - android:layout_marginTop="5dp" - android:layout_marginLeft="20dp" - android:layout_marginRight="20dp" /> - - <Button - android:id="@+id/start_wearable_activity" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginRight="10dp" - android:onClick="onStartWearableActivityClick" - android:text="@string/start_wearable_activity" - android:enabled="false" - android:layout_below="@+id/divider" - android:layout_centerHorizontal="true" - android:layout_marginTop="10dp" /> - - <ListView - android:id="@+id/data_item_list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_below="@+id/start_wearable_activity" - android:transcriptMode="alwaysScroll" /> -</RelativeLayout> diff --git a/samples/wearable/DataLayer/Application/src/main/res/values/strings.xml b/samples/wearable/DataLayer/Application/src/main/res/values/strings.xml deleted file mode 100644 index 06dc3bca3..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,23 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="app_name">Data Layer Sample App</string> - <string name="start_wearable_activity">Start Wearable Activity</string> - <string name="start">Start</string> - <string name="take_photo">Take a Photo</string> - <string name="send_photo">Send Photo</string> -</resources> diff --git a/samples/wearable/DataLayer/Application/src/main/res/values/style.xml b/samples/wearable/DataLayer/Application/src/main/res/values/style.xml deleted file mode 100644 index 81d6799f2..000000000 --- a/samples/wearable/DataLayer/Application/src/main/res/values/style.xml +++ /dev/null @@ -1,23 +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. ---> - -<resources> - <style name="Divider"> - <item name="android:layout_width">match_parent</item> - <item name="android:layout_height">3dp</item> - <item name="android:background">?android:attr/listDivider</item> - </style> -</resources> diff --git a/samples/wearable/DataLayer/Wearable/build.gradle b/samples/wearable/DataLayer/Wearable/build.gradle deleted file mode 100644 index f26a79136..000000000 --- a/samples/wearable/DataLayer/Wearable/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile 'com.google.android.gms:play-services-wearable:+' -}
\ No newline at end of file diff --git a/samples/wearable/DataLayer/Wearable/proguard-rules.txt b/samples/wearable/DataLayer/Wearable/proguard-rules.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/samples/wearable/DataLayer/Wearable/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml b/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 0b3491779..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,52 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.datalayer" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <service - android:name=".DataLayerListenerService" > - <intent-filter> - <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - </service> - - <activity - android:name=".MainActivity" - android:label="@string/app_name"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - <intent-filter> - <action android:name="com.example.android.wearable.datalayer.EXAMPLE"/> - <category android:name="android.intent.category.DEFAULT"/> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/DataLayerListenerService.java b/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/DataLayerListenerService.java deleted file mode 100644 index 64abaf54d..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/DataLayerListenerService.java +++ /dev/null @@ -1,120 +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.datalayer; - -import android.content.Intent; -import android.net.Uri; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.data.FreezableUtils; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.WearableListenerService; - -import java.util.List; -import java.util.concurrent.TimeUnit; - -/** - * Listens to DataItems and Messages from the local node. - */ -public class DataLayerListenerService extends WearableListenerService { - - private static final String TAG = "DataLayerListenerServic"; - - private static final String START_ACTIVITY_PATH = "/start-activity"; - private static final String DATA_ITEM_RECEIVED_PATH = "/data-item-received"; - public static final String COUNT_PATH = "/count"; - public static final String IMAGE_PATH = "/image"; - public static final String IMAGE_KEY = "photo"; - private static final String COUNT_KEY = "count"; - private static final int MAX_LOG_TAG_LENGTH = 23; - GoogleApiClient mGoogleApiClient; - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .build(); - mGoogleApiClient.connect(); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - LOGD(TAG, "onDataChanged: " + dataEvents); - final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents); - dataEvents.close(); - if(!mGoogleApiClient.isConnected()) { - ConnectionResult connectionResult = mGoogleApiClient - .blockingConnect(30, TimeUnit.SECONDS); - if (!connectionResult.isSuccess()) { - Log.e(TAG, "DataLayerListenerService failed to connect to GoogleApiClient."); - return; - } - } - - // Loop through the events and send a message back to the node that created the data item. - for (DataEvent event : events) { - Uri uri = event.getDataItem().getUri(); - String path = uri.getPath(); - if (COUNT_PATH.equals(path)) { - // Get the node id of the node that created the data item from the host portion of - // the uri. - String nodeId = uri.getHost(); - // Set the data of the message to be the bytes of the Uri. - byte[] payload = uri.toString().getBytes(); - - // Send the rpc - Wearable.MessageApi.sendMessage(mGoogleApiClient, nodeId, DATA_ITEM_RECEIVED_PATH, - payload); - } - } - } - - @Override - public void onMessageReceived(MessageEvent messageEvent) { - LOGD(TAG, "onMessageReceived: " + messageEvent); - - // Check to see if the message is to start an activity - if (messageEvent.getPath().equals(START_ACTIVITY_PATH)) { - Intent startIntent = new Intent(this, MainActivity.class); - startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(startIntent); - } - } - - @Override - public void onPeerConnected(Node peer) { - LOGD(TAG, "onPeerConnected: " + peer); - } - - @Override - public void onPeerDisconnected(Node peer) { - LOGD(TAG, "onPeerDisconnected: " + peer); - } - - public static void LOGD(final String tag, String message) { - if (Log.isLoggable(tag, Log.DEBUG)) { - Log.d(tag, message); - } - } -} diff --git a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/MainActivity.java b/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/MainActivity.java deleted file mode 100644 index b3121352e..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/java/com/example/android/wearable/datalayer/MainActivity.java +++ /dev/null @@ -1,255 +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.datalayer; - -import static com.example.android.wearable.datalayer.DataLayerListenerService.LOGD; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.drawable.BitmapDrawable; -import android.os.Bundle; -import android.os.Handler; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.view.WindowManager; -import android.widget.ArrayAdapter; -import android.widget.ListView; -import android.widget.TextView; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; -import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; -import com.google.android.gms.common.data.FreezableUtils; -import com.google.android.gms.wearable.Asset; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.DataMapItem; -import com.google.android.gms.wearable.MessageApi; -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.NodeApi; -import com.google.android.gms.wearable.Wearable; - -import java.io.InputStream; -import java.util.List; - -/** - * Shows events and photo from the Wearable APIs. - */ -public class MainActivity extends Activity implements ConnectionCallbacks, - OnConnectionFailedListener, DataApi.DataListener, MessageApi.MessageListener, - NodeApi.NodeListener { - - private static final String TAG = "MainActivity"; - - private GoogleApiClient mGoogleApiClient; - private ListView mDataItemList; - private TextView mIntroText; - private DataItemAdapter mDataItemListAdapter; - private View mLayout; - private Handler mHandler; - - @Override - public void onCreate(Bundle b) { - super.onCreate(b); - mHandler = new Handler(); - LOGD(TAG, "onCreate"); - setContentView(R.layout.main_activity); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - mDataItemList = (ListView) findViewById(R.id.dataItem_list); - mIntroText = (TextView) findViewById(R.id.intro); - mLayout = findViewById(R.id.layout); - - // Stores data events received by the local broadcaster. - mDataItemListAdapter = new DataItemAdapter(this, android.R.layout.simple_list_item_1); - mDataItemList.setAdapter(mDataItemListAdapter); - - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onResume() { - super.onResume(); - mGoogleApiClient.connect(); - } - - @Override - protected void onPause() { - super.onPause(); - Wearable.DataApi.removeListener(mGoogleApiClient, this); - Wearable.MessageApi.removeListener(mGoogleApiClient, this); - Wearable.NodeApi.removeListener(mGoogleApiClient, this); - mGoogleApiClient.disconnect(); - } - - @Override - public void onConnected(Bundle connectionHint) { - LOGD(TAG, "onConnected(): Successfully connected to Google API client"); - Wearable.DataApi.addListener(mGoogleApiClient, this); - Wearable.MessageApi.addListener(mGoogleApiClient, this); - Wearable.NodeApi.addListener(mGoogleApiClient, this); - } - - @Override - public void onConnectionSuspended(int cause) { - LOGD(TAG, "onConnectionSuspended(): Connection to Google API client was suspended"); - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - Log.e(TAG, "onConnectionFailed(): Failed to connect, with result: " + result); - } - - private void generateEvent(final String title, final String text) { - runOnUiThread(new Runnable() { - @Override - public void run() { - mIntroText.setVisibility(View.INVISIBLE); - mDataItemListAdapter.add(new Event(title, text)); - } - }); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - LOGD(TAG, "onDataChanged(): " + dataEvents); - - final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents); - dataEvents.close(); - for (DataEvent event : events) { - if (event.getType() == DataEvent.TYPE_CHANGED) { - String path = event.getDataItem().getUri().getPath(); - if (DataLayerListenerService.IMAGE_PATH.equals(path)) { - DataMapItem dataMapItem = DataMapItem.fromDataItem(event.getDataItem()); - Asset photo = dataMapItem.getDataMap() - .getAsset(DataLayerListenerService.IMAGE_KEY); - final Bitmap bitmap = loadBitmapFromAsset(mGoogleApiClient, photo); - mHandler.post(new Runnable() { - @Override - public void run() { - Log.d(TAG, "Setting background image.."); - mLayout.setBackground(new BitmapDrawable(getResources(), bitmap)); - } - }); - - } else if (DataLayerListenerService.COUNT_PATH.equals(path)) { - LOGD(TAG, "Data Changed for COUNT_PATH"); - generateEvent("DataItem Changed", event.getDataItem().toString()); - } else { - LOGD(TAG, "Unrecognized path: " + path); - } - - } else if (event.getType() == DataEvent.TYPE_DELETED) { - generateEvent("DataItem Deleted", event.getDataItem().toString()); - } else { - generateEvent("Unknown data event type", "Type = " + event.getType()); - } - } - } - - /** - * Extracts {@link android.graphics.Bitmap} data from the - * {@link com.google.android.gms.wearable.Asset} - */ - private Bitmap loadBitmapFromAsset(GoogleApiClient apiClient, Asset asset) { - if (asset == null) { - throw new IllegalArgumentException("Asset must be non-null"); - } - - InputStream assetInputStream = Wearable.DataApi.getFdForAsset( - apiClient, asset).await().getInputStream(); - - if (assetInputStream == null) { - Log.w(TAG, "Requested an unknown Asset."); - return null; - } - return BitmapFactory.decodeStream(assetInputStream); - } - - @Override - public void onMessageReceived(MessageEvent event) { - LOGD(TAG, "onMessageReceived: " + event); - generateEvent("Message", event.toString()); - } - - @Override - public void onPeerConnected(Node node) { - generateEvent("Node Connected", node.getId()); - } - - @Override - public void onPeerDisconnected(Node node) { - generateEvent("Node Disconnected", node.getId()); - } - - private static class DataItemAdapter extends ArrayAdapter<Event> { - - private final Context mContext; - - public DataItemAdapter(Context context, int unusedResource) { - super(context, unusedResource); - mContext = context; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - ViewHolder holder; - if (convertView == null) { - holder = new ViewHolder(); - LayoutInflater inflater = (LayoutInflater) mContext.getSystemService( - Context.LAYOUT_INFLATER_SERVICE); - convertView = inflater.inflate(android.R.layout.two_line_list_item, null); - convertView.setTag(holder); - holder.text1 = (TextView) convertView.findViewById(android.R.id.text1); - holder.text2 = (TextView) convertView.findViewById(android.R.id.text2); - } else { - holder = (ViewHolder) convertView.getTag(); - } - Event event = getItem(position); - holder.text1.setText(event.title); - holder.text2.setText(event.text); - return convertView; - } - - private class ViewHolder { - - TextView text1; - TextView text2; - } - } - - private class Event { - - String title; - String text; - - public Event(String title, String text) { - this.title = title; - this.text = text; - } - } -} diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/DataLayer/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/DataLayer/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/layout/main_activity.xml b/samples/wearable/DataLayer/Wearable/src/main/res/layout/main_activity.xml deleted file mode 100644 index f98e6672a..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/res/layout/main_activity.xml +++ /dev/null @@ -1,39 +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" - android:id="@+id/layout" - android:layout_width="fill_parent" - android:layout_height="fill_parent"> - - <ListView - android:id="@+id/dataItem_list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:transcriptMode="alwaysScroll"/> - - <TextView - android:id="@+id/intro" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_centerInParent="true" - android:textSize="20sp" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" - android:gravity="center" - android:fontFamily="sans-serif-condensed-light" - android:text="@string/intro" /> -</RelativeLayout> diff --git a/samples/wearable/DataLayer/Wearable/src/main/res/values/strings.xml b/samples/wearable/DataLayer/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 331e73604..000000000 --- a/samples/wearable/DataLayer/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,20 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="app_name">Data Layer Sample Wearable App</string> - <string name="intro">Waiting for data to arrive\u2026</string> -</resources> diff --git a/samples/wearable/DataLayer/_index.html b/samples/wearable/DataLayer/_index.html deleted file mode 100644 index 2b9a3fa37..000000000 --- a/samples/wearable/DataLayer/_index.html +++ /dev/null @@ -1,15 +0,0 @@ -<p><b>About:</b> You can cause the wearable to start an activity by pressing a button in the -companion app UI. You can also take a picture on the companion device, which will be transmitted as -an Asset for display on the wearable.</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. Start the sample by running the DataLayer application on the companion.</p> -<p><b>Wearable APIs used:</b> DataApi, MessageApi, NodeApi, WearableListenerService</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/phone_image.png" alt="Phone Image" width="216" height="384"> - <img src="screenshots/wearable_background_image.png" alt="Wearable Background Image" - width="140" height="140"> - <figcaption>Image captured on the phone, followed by the same image on the wearable. - </figcaption> - </figure> -</p> diff --git a/samples/wearable/DataLayer/build.gradle b/samples/wearable/DataLayer/build.gradle deleted file mode 100644 index d3c8c5971..000000000 --- a/samples/wearable/DataLayer/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -}
\ No newline at end of file diff --git a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/DataLayer/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/DataLayer/gradlew b/samples/wearable/DataLayer/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/DataLayer/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/DataLayer/gradlew.bat b/samples/wearable/DataLayer/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/DataLayer/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/DataLayer/screenshots/phone_image.png b/samples/wearable/DataLayer/screenshots/phone_image.png Binary files differdeleted file mode 100644 index e045b6543..000000000 --- a/samples/wearable/DataLayer/screenshots/phone_image.png +++ /dev/null diff --git a/samples/wearable/DataLayer/screenshots/wearable_background_image.png b/samples/wearable/DataLayer/screenshots/wearable_background_image.png Binary files differdeleted file mode 100644 index 78261808d..000000000 --- a/samples/wearable/DataLayer/screenshots/wearable_background_image.png +++ /dev/null diff --git a/samples/wearable/DataLayer/settings.gradle b/samples/wearable/DataLayer/settings.gradle deleted file mode 100644 index 68726d456..000000000 --- a/samples/wearable/DataLayer/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Application', 'Wearable'
\ No newline at end of file diff --git a/samples/wearable/DelayedConfirmation/Application/build.gradle b/samples/wearable/DelayedConfirmation/Application/build.gradle deleted file mode 100644 index f04fad5a0..000000000 --- a/samples/wearable/DelayedConfirmation/Application/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -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.google.android.gms:play-services:5.0.+' - wearApp project(':Wearable') -} diff --git a/samples/wearable/DelayedConfirmation/Application/proguard-rules.txt b/samples/wearable/DelayedConfirmation/Application/proguard-rules.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/samples/wearable/DelayedConfirmation/Application/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/AndroidManifest.xml b/samples/wearable/DelayedConfirmation/Application/src/main/AndroidManifest.xml deleted file mode 100644 index b682ef200..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,39 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.delayedconfirmation" > - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <activity - android:name=".MainActivity" - android:label="@string/app_name" - android:launchMode="singleTask" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java b/samples/wearable/DelayedConfirmation/Application/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java deleted file mode 100644 index 3ffda5374..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java +++ /dev/null @@ -1,134 +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.delayedconfirmation; - -import android.app.Activity; -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.Toast; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.wearable.MessageApi; -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.NodeApi; -import com.google.android.gms.wearable.Wearable; - -/** - * Has a single button, used to start the Wearable MainActivity. - */ -public class MainActivity extends Activity implements MessageApi.MessageListener, - GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { - - private static final String TAG = "DelayedConfirmation"; - private static final String START_ACTIVITY_PATH = "/start-activity"; - private static final String TIMER_SELECTED_PATH = "/timer_selected"; - private static final String TIMER_FINISHED_PATH = "/timer_finished"; - private GoogleApiClient mGoogleApiClient; - - @Override - public void onCreate(Bundle b) { - super.onCreate(b); - setContentView(R.layout.main_activity); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onResume() { - super.onResume(); - if (!mGoogleApiClient.isConnected()) { - mGoogleApiClient.connect(); - } - } - - @Override - protected void onDestroy() { - if (mGoogleApiClient.isConnected()) { - mGoogleApiClient.disconnect(); - } - super.onDestroy(); - } - - @Override - public void onConnected(Bundle bundle) { - Wearable.MessageApi.addListener(mGoogleApiClient, this); - } - - @Override - public void onConnectionSuspended(int i) { - Wearable.MessageApi.removeListener(mGoogleApiClient, this); - } - - @Override - public void onMessageReceived(final MessageEvent messageEvent) { - runOnUiThread(new Runnable() { - @Override - public void run() { - if (messageEvent.getPath().equals(TIMER_SELECTED_PATH)) { - Toast.makeText(getApplicationContext(), R.string.toast_timer_selected, - Toast.LENGTH_SHORT).show(); - } else if (messageEvent.getPath().equals(TIMER_FINISHED_PATH)) { - Toast.makeText(getApplicationContext(), R.string.toast_timer_finished, - Toast.LENGTH_SHORT).show(); - } - } - }); - - } - - @Override - public void onConnectionFailed(ConnectionResult connectionResult) { - Log.e(TAG, "Failed to connect to Google Api Client with error code " - + connectionResult.getErrorCode()); - } - - /** - * Sends a message to Wearable MainActivity when button is pressed. - */ - public void onStartWearableActivityClick(View view) { - Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback( - new ResultCallback<NodeApi.GetConnectedNodesResult>() { - @Override - public void onResult(NodeApi.GetConnectedNodesResult getConnectedNodesResult) { - for (final Node node : getConnectedNodesResult.getNodes()) { - Wearable.MessageApi.sendMessage( - mGoogleApiClient, node.getId(), START_ACTIVITY_PATH, new byte[0]) - .setResultCallback(getSendMessageResultCallback()); - } - } - }); - } - - private ResultCallback<MessageApi.SendMessageResult> getSendMessageResultCallback() { - return new ResultCallback<MessageApi.SendMessageResult>() { - @Override - public void onResult(MessageApi.SendMessageResult sendMessageResult) { - if (!sendMessageResult.getStatus().isSuccess()) { - Log.e(TAG, "Failed to connect to Google Api Client with status " - + sendMessageResult.getStatus()); - } - } - }; - } -} diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/layout/main_activity.xml b/samples/wearable/DelayedConfirmation/Application/src/main/res/layout/main_activity.xml deleted file mode 100644 index cbc1874fe..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/res/layout/main_activity.xml +++ /dev/null @@ -1,34 +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. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="horizontal"> - <TextView - android:id="@+id/text_start_wearable_activity" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="20sp" - android:text="@string/start_wearable_activity" /> - <Button - android:id="@+id/start_wearable_activity" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:minWidth="150dp" - android:onClick="onStartWearableActivityClick" - android:text="@string/start"/> -</LinearLayout> diff --git a/samples/wearable/DelayedConfirmation/Application/src/main/res/values/strings.xml b/samples/wearable/DelayedConfirmation/Application/src/main/res/values/strings.xml deleted file mode 100644 index 3b2d9d6e5..000000000 --- a/samples/wearable/DelayedConfirmation/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,24 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="app_name">Delayed Confirmation Sample App</string> - <string name="start_wearable_activity">Start Wearable Activity</string> - <string name="start">Start</string> - - <string name="toast_timer_selected">Timer Selected</string> - <string name="toast_timer_finished">Timer Finished</string> -</resources> diff --git a/samples/wearable/DelayedConfirmation/Wearable/build.gradle b/samples/wearable/DelayedConfirmation/Wearable/build.gradle deleted file mode 100644 index 0e23b4d56..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile 'com.google.android.gms:play-services-wearable:+' - compile "com.google.android.support:wearable:1.0.+" -}
\ No newline at end of file diff --git a/samples/wearable/DelayedConfirmation/Wearable/proguard-rules.txt b/samples/wearable/DelayedConfirmation/Wearable/proguard-rules.txt deleted file mode 100644 index 2ddbcfcdd..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/proguard-rules.txt +++ /dev/null @@ -1,21 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/AndroidManifest.xml b/samples/wearable/DelayedConfirmation/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 239be9fd3..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,44 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.delayedconfirmation" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <service - android:name=".WearableMessageListenerService" > - <intent-filter> - <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - </service> - - <activity - android:name=".MainActivity" - android:label="@string/app_name"> - </activity> - </application> -</manifest> diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java b/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java deleted file mode 100644 index f9b126db3..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/MainActivity.java +++ /dev/null @@ -1,143 +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.delayedconfirmation; - -import android.app.Activity; -import android.app.Notification; -import android.app.NotificationManager; -import android.os.Bundle; -import android.support.wearable.view.DelayedConfirmationView; -import android.util.Log; -import android.view.View; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.wearable.MessageApi; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.NodeApi; -import com.google.android.gms.wearable.Wearable; - - -public class MainActivity extends Activity implements - DelayedConfirmationView.DelayedConfirmationListener, - GoogleApiClient.OnConnectionFailedListener { - - private static final String TAG = "DelayedConfirmation"; - private static final int NUM_SECONDS = 5; - - private static final String TIMER_SELECTED_PATH = "/timer_selected"; - private static final String TIMER_FINISHED_PATH = "/timer_finished"; - - private DelayedConfirmationView delayedConfirmationView; - private GoogleApiClient mGoogleApiClient; - - @Override - public void onCreate(Bundle b) { - super.onCreate(b); - setContentView(R.layout.main_activity); - delayedConfirmationView = (DelayedConfirmationView) findViewById(R.id.delayed_confirmation); - delayedConfirmationView.setTotalTimeMs(NUM_SECONDS * 1000); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onResume() { - super.onResume(); - if (!mGoogleApiClient.isConnected()) { - mGoogleApiClient.connect(); - } - } - - @Override - protected void onDestroy() { - if (mGoogleApiClient.isConnected()) { - mGoogleApiClient.disconnect(); - } - super.onDestroy(); - } - - /** - * Starts the DelayedConfirmationView when user presses "Start Timer" button. - */ - public void onStartTimer(View view) { - delayedConfirmationView.start(); - delayedConfirmationView.setListener(this); - } - - @Override - public void onTimerSelected(View v) { - v.setPressed(true); - Notification notification = new Notification.Builder(this) - .setSmallIcon(R.drawable.ic_launcher) - .setContentTitle(getString(R.string.notification_title)) - .setContentText(getString(R.string.notification_timer_selected)) - .build(); - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).notify(0, notification); - sendMessageToCompanion(TIMER_SELECTED_PATH); - // Prevent onTimerFinished from being heard. - ((DelayedConfirmationView) v).setListener(null); - finish(); - } - - @Override - public void onTimerFinished(View v) { - Notification notification = new Notification.Builder(this) - .setSmallIcon(R.drawable.ic_launcher) - .setContentTitle(getString(R.string.notification_title)) - .setContentText(getString(R.string.notification_timer_finished)) - .build(); - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).notify(0, notification); - sendMessageToCompanion(TIMER_FINISHED_PATH); - finish(); - } - - @Override - public void onConnectionFailed(ConnectionResult connectionResult) { - Log.e(TAG, "Failed to connect to Google Api Client"); - } - - private void sendMessageToCompanion(final String path) { - Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback( - new ResultCallback<NodeApi.GetConnectedNodesResult>() { - @Override - public void onResult(NodeApi.GetConnectedNodesResult getConnectedNodesResult) { - for (final Node node : getConnectedNodesResult.getNodes()) { - Wearable.MessageApi.sendMessage(mGoogleApiClient, node.getId(), path, - new byte[0]).setResultCallback(getSendMessageResultCallback()); - } - } - } - ); - - } - - private ResultCallback<MessageApi.SendMessageResult> getSendMessageResultCallback() { - return new ResultCallback<MessageApi.SendMessageResult>() { - @Override - public void onResult(MessageApi.SendMessageResult sendMessageResult) { - if (!sendMessageResult.getStatus().isSuccess()) { - Log.e(TAG, "Failed to connect to Google Api Client with status " - + sendMessageResult.getStatus()); - } - } - }; - } -} diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/WearableMessageListenerService.java b/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/WearableMessageListenerService.java deleted file mode 100644 index bb2ec9193..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/java/com/example/android/wearable/delayedconfirmation/WearableMessageListenerService.java +++ /dev/null @@ -1,38 +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.delayedconfirmation; - -import android.content.Intent; - -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.WearableListenerService; - -/** - * Listens for a message telling it to start the Wearable MainActivity. - */ -public class WearableMessageListenerService extends WearableListenerService { - private static final String START_ACTIVITY_PATH = "/start-activity"; - - @Override - public void onMessageReceived(MessageEvent event) { - if (event.getPath().equals(START_ACTIVITY_PATH)) { - Intent startIntent = new Intent(this, MainActivity.class); - startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(startIntent); - } - } -} diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/layout/main_activity.xml b/samples/wearable/DelayedConfirmation/Wearable/src/main/res/layout/main_activity.xml deleted file mode 100644 index 1b9bcb3eb..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/layout/main_activity.xml +++ /dev/null @@ -1,50 +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. ---> - -<android.support.wearable.view.BoxInsetLayout - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_height="match_parent" - android:layout_width="match_parent"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:background="@color/grey" - app:layout_box="top"> - - <Button - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:onClick="onStartTimer" - android:text="@string/start_timer"/> - - <android.support.wearable.view.DelayedConfirmationView - android:id="@+id/delayed_confirmation" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:src="@drawable/ic_launcher" - app:circle_color="@color/blue" - app:circle_radius="@dimen/circle_radius" - app:circle_radius_pressed="@dimen/circle_radius_pressed" - app:circle_padding="@dimen/circle_padding" - app:circle_border_width="@dimen/circle_border_normal_width" - app:circle_border_color="@color/white"/> - - </LinearLayout> -</android.support.wearable.view.BoxInsetLayout> diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/dimens.xml b/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/dimens.xml deleted file mode 100644 index 677a0f167..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/dimens.xml +++ /dev/null @@ -1,22 +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. ---> - -<resources> - <dimen name="circle_border_normal_width">10dp</dimen> - <dimen name="circle_padding">5dp</dimen> - <dimen name="circle_radius">60dp</dimen> - <dimen name="circle_radius_pressed">55dp</dimen> -</resources> diff --git a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/strings.xml b/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 46f5326bc..000000000 --- a/samples/wearable/DelayedConfirmation/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,25 +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. ---> - -<resources> - - <string name="app_name">Delayed Confirmation</string> - <string name="start_timer">Start Timer (5 seconds)</string> - - <string name="notification_title">DelayedConfirmation</string> - <string name="notification_timer_selected">Timer Selected</string> - <string name="notification_timer_finished">Timer Finished</string> -</resources> diff --git a/samples/wearable/DelayedConfirmation/_index.html b/samples/wearable/DelayedConfirmation/_index.html deleted file mode 100644 index 2dd5cdbfb..000000000 --- a/samples/wearable/DelayedConfirmation/_index.html +++ /dev/null @@ -1,28 +0,0 @@ -<p><b>About:</b> Demonstrates how to create a DelayedConfirmationView in your wearable app. In this -sample, pressing a button on the phone app sends a message to the wearable to start a simple -activity. This activity displays a DelayedConfirmationView that starts when the user presses "Start -Timer." Then, callbacks are implemented on both the wearable and phone to show when the timer is -selected or finishes. The activity on the wearable uses BoxInsetLayout to automatically apply -appropriate margins based on whether the display is square or circular.</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. Start the sample by running the DelayedConfirmation application on the companion and -pressing "Start".</p> -<p><b>Wearable APIs used:</b> MessageApi, NodeApi, WearableListenerService, BoxInsetLayout, -DelayedConfirmationView</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/delayed_confirmation_box_inset_top.png" alt='DelayedConfirmation view - in BoxInsetLayout with layout_box="top"' width="160" height="160"> - <img src="screenshots/delayed_confirmation_box_inset_all.png" alt='DelayedConfirmation view - in BoxInsetLayout with layout_box="all"' width="160" height="160"> - <img src="screenshots/delayed_confirmation_notification.png" alt="DelayedConfirmationView - selected notification" width="140" height="140"> - <img src="screenshots/companion_delayed_confirmation.png" alt="Timer Selected toast on - companion" width="216" height="384"> - <figcaption>From left to right: DelayedConfirmationView in a BoxInsetLayout with - layout_box="top", the same view but with layout_box="all", the notification that shows - up on the wearable when you select the timer before it finishes, and the toast generated - on the phone at the same time. Note: normally you would make the circle's background the - same color as the box background so users won't see the box's edges.</figcaption> - </figure> -</p> diff --git a/samples/wearable/DelayedConfirmation/build.gradle b/samples/wearable/DelayedConfirmation/build.gradle deleted file mode 100644 index d3c8c5971..000000000 --- a/samples/wearable/DelayedConfirmation/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -}
\ No newline at end of file diff --git a/samples/wearable/DelayedConfirmation/gradle.properties b/samples/wearable/DelayedConfirmation/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/DelayedConfirmation/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/DelayedConfirmation/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/DelayedConfirmation/gradlew b/samples/wearable/DelayedConfirmation/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/DelayedConfirmation/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/DelayedConfirmation/gradlew.bat b/samples/wearable/DelayedConfirmation/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/DelayedConfirmation/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/DelayedConfirmation/screenshots/companion_delayed_confirmation.png b/samples/wearable/DelayedConfirmation/screenshots/companion_delayed_confirmation.png Binary files differdeleted file mode 100644 index b1b61a4af..000000000 --- a/samples/wearable/DelayedConfirmation/screenshots/companion_delayed_confirmation.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_all.png b/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_all.png Binary files differdeleted file mode 100644 index 9119dd38e..000000000 --- a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_all.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_top.png b/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_top.png Binary files differdeleted file mode 100644 index 6d2da705d..000000000 --- a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_box_inset_top.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_notification.png b/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_notification.png Binary files differdeleted file mode 100644 index 936bcaf0f..000000000 --- a/samples/wearable/DelayedConfirmation/screenshots/delayed_confirmation_notification.png +++ /dev/null diff --git a/samples/wearable/DelayedConfirmation/settings.gradle b/samples/wearable/DelayedConfirmation/settings.gradle deleted file mode 100644 index 68726d456..000000000 --- a/samples/wearable/DelayedConfirmation/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Application', 'Wearable'
\ No newline at end of file diff --git a/samples/wearable/ElizaChat/Application/build.gradle b/samples/wearable/ElizaChat/Application/build.gradle deleted file mode 100644 index 7abc52428..000000000 --- a/samples/wearable/ElizaChat/Application/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -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.+" -} diff --git a/samples/wearable/ElizaChat/Application/proguard-rules.txt b/samples/wearable/ElizaChat/Application/proguard-rules.txt deleted file mode 100644 index 5b89420db..000000000 --- a/samples/wearable/ElizaChat/Application/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#}
\ No newline at end of file diff --git a/samples/wearable/ElizaChat/Application/project.properties b/samples/wearable/ElizaChat/Application/project.properties deleted file mode 100644 index 4ab125693..000000000 --- a/samples/wearable/ElizaChat/Application/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/samples/wearable/ElizaChat/Application/src/main/AndroidManifest.xml b/samples/wearable/ElizaChat/Application/src/main/AndroidManifest.xml deleted file mode 100644 index dc06b5160..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,42 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.elizachat" > - - <application - android:allowBackup="true" - android:icon="@mipmap/ic_app_eliza" - android:label="@string/app_name" - android:theme="@style/AppTheme" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - <service - android:name=".ResponderService"> - <intent-filter> - <action android:name="com.example.android.wearable.elizachat.REPLY" /> - <action android:name="com.example.android.wearable.elizachat.CONVERSATION" /> - </intent-filter> - </service> - </application> - -</manifest> diff --git a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ElizaResponder.java b/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ElizaResponder.java deleted file mode 100644 index e6c054251..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ElizaResponder.java +++ /dev/null @@ -1,168 +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.elizachat; - -import android.text.TextUtils; - -/** - * A basic chat bot based on ELIZA, one of the earliest programs to employ primitive natural - * language processing. Like ELIZA, this bot can simulate a Rogerian psychotherapist using a - * collection of vague and generic responses. - */ -public class ElizaResponder { - - private static final String[] CONVERSATION_KEYWORDS = { - "CAN YOU", "CAN I", "YOU ARE", "YOURE", "I DONT", "I FEEL", "WHY DONT YOU", "WHY CANT I", - "ARE YOU", "I CANT", "I AM", " IM ", "YOU", "I WANT", "WHAT", "HOW", "WHO", "WHERE", - "WHEN", "WHY", "NAME", "CAUSE", "SORRY", "DREAM", "HELLO", "HI", "MAYBE", "NO", "YOUR", - "ALWAYS", "THINK", "ALIKE", "YES", "FRIEND", "COMPUTER", "NOKEYFOUND" }; - - private static String[] WORDS_TO_REPLACE = {"ARE","AM","WERE","WAS","YOU","I","YOUR","MY", - "IVE","YOUVE","IM","YOURE", "YOU", "ME"}; - - private static String[] QUESTIONS = { - "DON'T YOU BELIEVE THAT I CAN.", "PERHAPS YOU WOULD LIKE TO BE ABLE TO.", - "YOU WANT ME TO BE ABLE TO*", "PERHAPS YOU DON'T WANT TO*", - "DO YOU WANT TO BE ABLE TO*", "WHAT MAKES YOU THINK I AM*", - "DOES IT PLEASE YOU TO BELIEVE I AM*", "PERHAPS YOU WOULD LIKE TO BE*", - "DO YOU SOMETIMES WISH YOU WERE*", "DON'T YOU REALLY*", "WHY DON'T YOU*", - "DO YOU WISH TO BE ABLE TO*", "DOES THAT TROUBLE YOU?", - "TELL ME MORE ABOUT SUCH FEELINGS*", "DO YOU OFTEN FEEL*", - "DO YOU ENJOY FEELING*", "DO YOU REALLY BELIEVE I DON'T*", - "PERHAPS IN TIME I WILL*", "DO YOU WANT ME TO*", - "DO YOU THINK YOU SHOULD BE ABLE TO*", "WHY CAN'T YOU*", - "WHAT MAKES YOU WONDER WHETHER OR NOT I AM*", - "WOULD YOU PREFER IF I WERE NOT*", "PERHAPS IN YOUR FANTASIES I AM*", - "HOW DO YOU KNOW YOU CAN'T*", "HAVE YOU TRIED?", "PERHAPS YOU CAN NOW*", - "DID YOU COME TO ME BECAUSE YOU ARE*", "HOW LONG HAVE YOU BEEN*", - "DO YOU BELIEVE IT IS NORMAL TO BE*", "DO YOU ENJOY BEING*", - "I AM MORE INTERESTED IN TALKING ABOUT YOU.", "OH, I*", - "ARE YOU REALLY SO INTERESTED IN SOMEONE LIKE ME?", - "WHAT WOULD IT MEAN TO YOU IF YOU GOT*", "WHY DO YOU WANT*", - "SUPPOSE YOU SOON GOT*", "WHAT IF YOU NEVER GOT*", "I SOMETIMES ALSO WANT*", - "WHY DO YOU ASK?", "DOES THAT QUESTION INTEREST YOU?", - "WHAT ANSWER WOULD PLEASE YOU THE MOST?", "WHAT DO YOU THINK?", - "ARE SUCH QUESTIONS ON YOUR MIND OFTEN?", - "WHAT IS IT THAT YOU REALLY WANT TO KNOW?", "HAVE YOU ASKED ANYONE ELSE?", - "HAVE YOU ASKED SUCH QUESTIONS BEFORE?", - "WHAT ELSE COMES TO MIND WHEN YOU ASK THAT?", "WE CAN KEEP THIS ANONYMOUS.", - "NO NEED TO SPECIFY ANY NAMES-- PLEASE GO ON.", "IS THAT THE REAL REASON?", - "DON'T ANY OTHER REASONS COME TO MIND?", - "DOES THAT REASON EXPLAIN ANYTHING ELSE?", "WHAT OTHER REASONS MIGHT THERE BE?", - "PLEASE DON'T APOLOGIZE.", "APOLOGIES ARE NOT NECESSARY.", - "WHAT FEELINGS DO YOU HAVE WHEN YOU APOLOGIZE?", "NO NEED TO BE DEFENSIVE!", - "WHAT DOES THAT DREAM SUGGEST TO YOU?", "DO YOU DREAM OFTEN?", - "WHAT PERSONS APPEAR IN YOUR DREAMS?", "DO YOU HAVE PLEASANT DREAMS?", - "HOW DO YOU DO ... PLEASE STATE YOUR PROBLEM.", "YOU DON'T SEEM QUITE CERTAIN.", - "WHY THE UNCERTAIN TONE?", "LET'S TRY TO KEEP THIS POSITIVE.", "YOU AREN'T SURE?", - "DON'T YOU KNOW?", "IS THAT A DEFINITE NO OR MIGHT YOU CHANGE YOUR MIND?", - "I AM SENSING SOME NEGATIVITY.", "WHY NOT?", "ARE YOU SURE?", "WHY NO?", - "WHY ARE YOU CONCERNED ABOUT MY*", "WHAT ABOUT YOUR OWN*", - "CAN'T YOU THINK OF A SPECIFIC EXAMPLE?", "WHEN?", "WHAT ARE YOU THINKING OF?", - "REALLY. ALWAYS?", "DO YOU REALLY THINK SO?", "BUT YOU ARE NOT SURE YOU.", - "BELIEVE IN YOURSELF.", "IN WHAT WAY?", "WHAT RESEMBLANCE DO YOU SEE?", - "WHAT DOES THE SIMILARITY SUGGEST TO YOU?", - "WHAT OTHER CONNECTIONS DO YOU SEE?", "COULD THERE REALLY BE SOME CONNECTION?", - "HOW?", "YOU SEEM QUITE POSITIVE.", "ARE YOU SURE?", "I SEE.", "I UNDERSTAND.", - "TELL ME ABOUT YOUR FRIENDS.", "ARE YOU WORRIED ABOUT YOUR FRIENDS?", - "DO YOUR FRIENDS EVER GIVE YOU A HARD TIME?", "WHAT DO YOU LIKE ABOUT YOUR FRIENDS?", - "DO YOU LOVE YOUR FRIENDS?", "PERHAPS YOUR LOVE FOR FRIENDS WORRIES YOU.", - "DO COMPUTERS EXCITE YOU?", "ARE YOU TALKING ABOUT ME IN PARTICULAR?", - "HOW DO YOU LIKE YOUR WATCH?", "WHY DO YOU MENTION COMPUTERS?", - "DO YOU FIND MACHINES AS FASCINATING AS I DO?", - "DON'T YOU THINK COMPUTERS CAN HELP PEOPLE?", - "WHAT ABOUT MACHINES EXCITES YOU THE MOST?", - "HEY THERE, HOW CAN I HELP YOU?", - "WHAT DOES THAT SUGGEST TO YOU?", "I SEE.", - "I'M NOT SURE I UNDERSTAND YOU FULLY.", "COME COME ELUCIDATE YOUR THOUGHTS.", - "CAN YOU ELABORATE ON THAT?", "THAT IS QUITE INTERESTING."}; - - private static char[] CONVERSATION_TO_RESPONSES_MAP = { - 1,3,4,2,6,4,6,4,10,4,14,3,17,3,20,2,22,3,25,3, - 28,4,28,4,32,3,35,5,40,9,40,9,40,9,40,9,40,9,40,9, - 49,2,51,4,55,4,59,4,63,1,63,1,64,5,69,5,74,2,76,4, - 80,3,83,7,90,3,93,6,99,7,106,6}; - - private int[] responseStarts = new int[36]; - private int[] responseCurrentIndices = new int[36]; - private int[] responseEnds = new int[36]; - private String previousInput = null; - - public ElizaResponder() { - for (int i = 0; i < CONVERSATION_TO_RESPONSES_MAP.length / 2; i++) { - responseStarts[i] = CONVERSATION_TO_RESPONSES_MAP[2 * i]; - responseCurrentIndices[i] = CONVERSATION_TO_RESPONSES_MAP[2 * i]; - responseEnds[i] = responseStarts[i] + CONVERSATION_TO_RESPONSES_MAP[2 * i + 1]; - } - } - - public String elzTalk(String input) { - if (null == input) { - input = ""; - } - String result = ""; - - input = " " + input.toUpperCase().replace("\'", "") + " "; - - if (previousInput != null && input.equals(previousInput)) { - return "DIDN'T YOU JUST SAY THAT?\n"; - } - previousInput = input; - - int keywordIndex = 0; - for (; keywordIndex < CONVERSATION_KEYWORDS.length; ++keywordIndex) { - int index = input.indexOf(CONVERSATION_KEYWORDS[keywordIndex]); - if (index != -1) { - break; - } - } - - String afterKeyword = ""; - if (keywordIndex == CONVERSATION_KEYWORDS.length) { - keywordIndex = 35; - } else { - int index = input.indexOf(CONVERSATION_KEYWORDS[keywordIndex]); - afterKeyword = input.substring(index + CONVERSATION_KEYWORDS[keywordIndex].length()); - String[] parts = afterKeyword.split("\\s+"); - for (int i = 0; i < WORDS_TO_REPLACE.length / 2; i++) { - String first = WORDS_TO_REPLACE[i * 2]; - String second = WORDS_TO_REPLACE[i * 2 + 1]; - for (int j = 0; j < parts.length; ++j) { - if (parts[j].equals(first)) { - parts[j] = second; - } else if (parts[j].equals(second)) { - parts[j] = first; - } - } - } - afterKeyword = TextUtils.join(" ", parts); - } - - String question = QUESTIONS[responseCurrentIndices[keywordIndex] - 1]; - responseCurrentIndices[keywordIndex] = responseCurrentIndices[keywordIndex] + 1; - if (responseCurrentIndices[keywordIndex] > responseEnds[keywordIndex]) { - responseCurrentIndices[keywordIndex] = responseStarts[keywordIndex]; - } - result += question; - if (result.endsWith("*")) { - result = result.substring(0, result.length() - 1); - result += " " + afterKeyword; - } - - return result; - } -} diff --git a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java b/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java deleted file mode 100644 index ef08e987a..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/MainActivity.java +++ /dev/null @@ -1,107 +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.elizachat; - -import android.app.Activity; -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.os.Bundle; -import android.support.v4.content.LocalBroadcastManager; -import android.text.TextUtils; -import android.view.Menu; -import android.view.MenuItem; -import android.widget.TextView; - -public class MainActivity extends Activity { - - @SuppressWarnings("unused") - private static final String TAG = "MainActivity"; - - public static final String EXTRA_MESSAGE = "message"; - - public static final String ACTION_NOTIFY = "com.example.android.wearable.elizachat.NOTIFY"; - - public static final String ACTION_GET_CONVERSATION - = "com.example.android.wearable.elizachat.CONVERSATION"; - - private BroadcastReceiver mReceiver; - - private TextView mHistoryView; - - @Override - protected void onCreate(Bundle saved) { - super.onCreate(saved); - setContentView(R.layout.activity_main); - mReceiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - processMessage(intent); - } - }; - mHistoryView = (TextView) findViewById(R.id.history); - startResponderService(); - } - - private void startResponderService() { - Intent serviceIntent = new Intent(ResponderService.ACTION_INCOMING); - startService(serviceIntent); - } - - @Override - protected void onResume() { - super.onResume(); - LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, - new IntentFilter(ACTION_NOTIFY)); - mHistoryView.setText(""); - Intent serviceIntent = new Intent(ACTION_GET_CONVERSATION); - startService(serviceIntent); - - } - - @Override - protected void onPause() { - LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver); - super.onPause(); - } - - private void processMessage(Intent intent) { - String text = intent.getStringExtra(EXTRA_MESSAGE); - if (!TextUtils.isEmpty(text)) { - mHistoryView.append("\n" + text); - } - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - super.onCreateOptionsMenu(menu); - getMenuInflater().inflate(R.menu.main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch (item.getItemId()) { - case R.id.action_stop_service: - stopService(new Intent(this, ResponderService.class)); - finish(); - break; - } - return true; - } -} diff --git a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ResponderService.java b/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ResponderService.java deleted file mode 100644 index 3bef19c6b..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/java/com/example/android/wearable/elizachat/ResponderService.java +++ /dev/null @@ -1,148 +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.elizachat; - -import android.app.Notification; -import android.app.PendingIntent; -import android.app.Service; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.os.Bundle; -import android.os.IBinder; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.RemoteInput; -import android.support.v4.content.LocalBroadcastManager; -import android.support.v4.app.NotificationManagerCompat; -import android.text.TextUtils; -import android.util.Log; - -/** - * A service that runs in the background and provides responses to the incoming messages from the - * wearable. It also keeps a record of the chat session history, which it can provide upon request. - */ -public class ResponderService extends Service { - - public static final String ACTION_INCOMING = "com.example.android.wearable.elizachat.INCOMING"; - - public static final String ACTION_RESPONSE = "com.example.android.wearable.elizachat.REPLY"; - - public static final String EXTRA_REPLY = "reply"; - - private static final String TAG = "ResponderService"; - - private ElizaResponder mResponder; - - private String mLastResponse = null; - - private StringBuffer mCompleteConversation = new StringBuffer(); - - private LocalBroadcastManager mBroadcastManager; - - @Override - public void onCreate() { - super.onCreate(); - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Chat Service started"); - } - mResponder = new ElizaResponder(); - mBroadcastManager = LocalBroadcastManager.getInstance(this); - processIncoming(null); - } - - @Override - public IBinder onBind(Intent intent) { - return null; - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - if (null == intent || null == intent.getAction()) { - return Service.START_STICKY; - } - String action = intent.getAction(); - if (action.equals(ACTION_RESPONSE)) { - Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent); - CharSequence replyMessage = ""; - if (remoteInputResults != null) { - replyMessage = remoteInputResults.getCharSequence(EXTRA_REPLY); - } - processIncoming(replyMessage.toString()); - } else if (action.equals(MainActivity.ACTION_GET_CONVERSATION)) { - broadcastMessage(mCompleteConversation.toString()); - } - return Service.START_STICKY; - } - - private void showNotification() { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Sent: " + mLastResponse); - } - NotificationCompat.Builder builder = new NotificationCompat.Builder(this) - .setContentTitle(getString(R.string.eliza)) - .setContentText(mLastResponse) - .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.bg_eliza)) - .setSmallIcon(R.drawable.bg_eliza) - .setPriority(NotificationCompat.PRIORITY_MIN); - - Intent intent = new Intent(ACTION_RESPONSE); - PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent, - PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_CANCEL_CURRENT); - Notification notification = builder - .extend(new NotificationCompat.WearableExtender() - .addAction(new NotificationCompat.Action.Builder( - R.drawable.ic_full_reply, getString(R.string.reply), pendingIntent) - .addRemoteInput(new RemoteInput.Builder(EXTRA_REPLY) - .setLabel(getString(R.string.reply)) - .build()) - .build())) - .build(); - NotificationManagerCompat.from(this).notify(0, notification); - } - - private void processIncoming(String text) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Received: " + text); - } - mLastResponse = mResponder.elzTalk(text); - String line = TextUtils.isEmpty(text) ? mLastResponse : text + "\n" + mLastResponse; - - // Send a new line of conversation to update the Activity, unless the incoming text was - // empty. - if (!TextUtils.isEmpty(text)) { - broadcastMessage(line); - } - NotificationManagerCompat.from(this).cancelAll(); - showNotification(); - mCompleteConversation.append("\n" + line); - } - - private void broadcastMessage(String message) { - Intent intent = new Intent(MainActivity.ACTION_NOTIFY); - intent.putExtra(MainActivity.EXTRA_MESSAGE, message); - mBroadcastManager.sendBroadcast(intent); - } - - @Override - public void onDestroy() { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Chat Service stopped"); - } - NotificationManagerCompat.from(this).cancel(0); - mBroadcastManager = null; - super.onDestroy(); - } -} diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-hdpi/ic_full_reply.png b/samples/wearable/ElizaChat/Application/src/main/res/drawable-hdpi/ic_full_reply.png Binary files differdeleted file mode 100644 index 66388d5fa..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-hdpi/ic_full_reply.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-mdpi/ic_full_reply.png b/samples/wearable/ElizaChat/Application/src/main/res/drawable-mdpi/ic_full_reply.png Binary files differdeleted file mode 100644 index 60ce9f9c5..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-mdpi/ic_full_reply.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-nodpi/bg_eliza.png b/samples/wearable/ElizaChat/Application/src/main/res/drawable-nodpi/bg_eliza.png Binary files differdeleted file mode 100644 index 3bbdf48a8..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-nodpi/bg_eliza.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/drawable-xhdpi/ic_full_reply.png b/samples/wearable/ElizaChat/Application/src/main/res/drawable-xhdpi/ic_full_reply.png Binary files differdeleted file mode 100644 index dba6fa7b0..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/drawable-xhdpi/ic_full_reply.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/layout/activity_main.xml b/samples/wearable/ElizaChat/Application/src/main/res/layout/activity_main.xml deleted file mode 100644 index 6ffed8ea2..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,17 +0,0 @@ -<ScrollView 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:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingBottom="@dimen/activity_vertical_margin" - tools:context="com.example.android.wearable.elizachat.MainActivity$PlaceholderFragment" - android:orientation="vertical" > - - <TextView - android:id="@+id/history" - android:layout_width="match_parent" - android:layout_height="match_parent"/> - -</ScrollView> diff --git a/samples/wearable/ElizaChat/Application/src/main/res/menu/main.xml b/samples/wearable/ElizaChat/Application/src/main/res/menu/main.xml deleted file mode 100644 index b8e1ef2a5..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/menu/main.xml +++ /dev/null @@ -1,24 +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. ---> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_stop_service" - android:orderInCategory="100" - android:showAsAction="always|withText" - android:title="@string/stop_service" /> - -</menu> diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-hdpi/ic_app_eliza.png b/samples/wearable/ElizaChat/Application/src/main/res/mipmap-hdpi/ic_app_eliza.png Binary files differdeleted file mode 100644 index 1bdb14751..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-hdpi/ic_app_eliza.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-mdpi/ic_app_eliza.png b/samples/wearable/ElizaChat/Application/src/main/res/mipmap-mdpi/ic_app_eliza.png Binary files differdeleted file mode 100644 index 2e0e1980c..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-mdpi/ic_app_eliza.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xhdpi/ic_app_eliza.png b/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xhdpi/ic_app_eliza.png Binary files differdeleted file mode 100644 index 8d0f43642..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xhdpi/ic_app_eliza.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxhdpi/ic_app_eliza.png b/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxhdpi/ic_app_eliza.png Binary files differdeleted file mode 100644 index e72b96752..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxhdpi/ic_app_eliza.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxxhdpi/ic_app_eliza.png b/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxxhdpi/ic_app_eliza.png Binary files differdeleted file mode 100644 index 06ea0793c..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/mipmap-xxxhdpi/ic_app_eliza.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/Application/src/main/res/values/dimens.xml b/samples/wearable/ElizaChat/Application/src/main/res/values/dimens.xml deleted file mode 100644 index a1e9cfe8a..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/values/dimens.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> -</resources> diff --git a/samples/wearable/ElizaChat/Application/src/main/res/values/strings.xml b/samples/wearable/ElizaChat/Application/src/main/res/values/strings.xml deleted file mode 100644 index 29130e61c..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,26 +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. ---> - -<resources> - - <string name="app_name">ElizaChat</string> - <string name="send_notification">Send notification!</string> - <string name="eliza">Eliza</string> - <string name="answer_eliza">Answer Eliza</string> - <string name="reply">Reply</string> - <string name="stop_service">End Chat Session</string> - -</resources> diff --git a/samples/wearable/ElizaChat/Application/src/main/res/values/styles.xml b/samples/wearable/ElizaChat/Application/src/main/res/values/styles.xml deleted file mode 100644 index e1edbe8d5..000000000 --- a/samples/wearable/ElizaChat/Application/src/main/res/values/styles.xml +++ /dev/null @@ -1,24 +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. ---> - -<resources> - - <!-- Base application theme. --> - <style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"> - <!-- Customize your theme here. --> - </style> - -</resources> diff --git a/samples/wearable/ElizaChat/_index.html b/samples/wearable/ElizaChat/_index.html deleted file mode 100644 index 0bc94336d..000000000 --- a/samples/wearable/ElizaChat/_index.html +++ /dev/null @@ -1,33 +0,0 @@ -<p><b>About: </b> -This sample is a phone application that provides a chat experience in which users can respond to -messages with a quick voice response. New messages create a notification with a "Reply" action. -The notification is bridged from phone to wearable, and selecting the "Reply" action on the -wearable opens the voice transcription UI allowing the user to speak a response.</p> - -<p>To keep the example simple and self-contained, instead of a real chat application (which would -require a server or a peer-to-peer connection), the conversation is conducted with an chat bot on -the phone. Each time the bot responds, the phone app updates the notification and allows the user -to write back. This sample is primarily intended to demonstrate the voice-reply capabilities -provided by the Android Wear notification API.</p> - -<p>When using the emulator you can type a response instead of speaking it aloud. To allow typed -responses, ensure that your emulator image has the "hardware keyboard present" option enabled. -After typing your message into the emulator window, hit the enter key and wait a few seconds for -your message to be sent.</p> - - -<p><b>How to run:</b> Install the Application APK on the companion and run it. A notification will -automatically be bridged onto the wearable, with a "Reply" action.</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/companion_eliza_chat.png" alt="Eliza chat when opened on companion" - width="216" height="384"> - <img src="screenshots/wearable_eliza_notification.png" alt="Initial notification on - wearable" width="140" height="140"> - <img src="screenshots/wearable_voice_reply.png" alt="Initial notification on - wearable" width="140" height="140"> - <img src="screenshots/companion_eliza_chat_response.png" alt="Response received on - companion" width="216" height="384"> - <figcaption>The progressing stages of a chat with Eliza.</figcaption> - </figure> -</p> diff --git a/samples/wearable/ElizaChat/build.gradle b/samples/wearable/ElizaChat/build.gradle deleted file mode 100644 index d3c8c5971..000000000 --- a/samples/wearable/ElizaChat/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -}
\ No newline at end of file diff --git a/samples/wearable/ElizaChat/gradle.properties b/samples/wearable/ElizaChat/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/ElizaChat/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/ElizaChat/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/ElizaChat/gradlew b/samples/wearable/ElizaChat/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/ElizaChat/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/ElizaChat/gradlew.bat b/samples/wearable/ElizaChat/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/ElizaChat/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat.png b/samples/wearable/ElizaChat/screenshots/companion_eliza_chat.png Binary files differdeleted file mode 100644 index b7fd26663..000000000 --- a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat_response.png b/samples/wearable/ElizaChat/screenshots/companion_eliza_chat_response.png Binary files differdeleted file mode 100644 index cea063c35..000000000 --- a/samples/wearable/ElizaChat/screenshots/companion_eliza_chat_response.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/screenshots/wearable_eliza_notification.png b/samples/wearable/ElizaChat/screenshots/wearable_eliza_notification.png Binary files differdeleted file mode 100644 index c5ced4963..000000000 --- a/samples/wearable/ElizaChat/screenshots/wearable_eliza_notification.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/screenshots/wearable_voice_reply.png b/samples/wearable/ElizaChat/screenshots/wearable_voice_reply.png Binary files differdeleted file mode 100644 index 032e03752..000000000 --- a/samples/wearable/ElizaChat/screenshots/wearable_voice_reply.png +++ /dev/null diff --git a/samples/wearable/ElizaChat/settings.gradle b/samples/wearable/ElizaChat/settings.gradle deleted file mode 100644 index 9464a3593..000000000 --- a/samples/wearable/ElizaChat/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Application' diff --git a/samples/wearable/EmbeddedApp/Application/build.gradle b/samples/wearable/EmbeddedApp/Application/build.gradle deleted file mode 100644 index 1ce5b265e..000000000 --- a/samples/wearable/EmbeddedApp/Application/build.gradle +++ /dev/null @@ -1,34 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 18 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 18 - targetSdkVersion 19 - versionCode 1 - versionName '1.0' - } - - signingConfigs { - release { - keyAlias 'androiddebugkey' - keyPassword 'android' - storeFile file('$rootDir/../../debug.keystore') - storePassword 'android' - } - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - signingConfig signingConfigs.release - } - } -} - -dependencies { - wearApp project(':Wearable') -} diff --git a/samples/wearable/EmbeddedApp/Application/proguard-rules.txt b/samples/wearable/EmbeddedApp/Application/proguard-rules.txt deleted file mode 100644 index 5b86c0858..000000000 --- a/samples/wearable/EmbeddedApp/Application/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/EmbeddedApp/Application/src/main/AndroidManifest.xml b/samples/wearable/EmbeddedApp/Application/src/main/AndroidManifest.xml deleted file mode 100644 index aac2df8c5..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,35 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.embeddedapp" > - <uses-sdk android:minSdkVersion="18" android:targetSdkVersion="19" /> - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light" > - <activity - android:name=".PhoneActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/samples/wearable/EmbeddedApp/Application/src/main/java/com/example/android/wearable/embeddedapp/PhoneActivity.java b/samples/wearable/EmbeddedApp/Application/src/main/java/com/example/android/wearable/embeddedapp/PhoneActivity.java deleted file mode 100644 index 5a2f5ca3a..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/java/com/example/android/wearable/embeddedapp/PhoneActivity.java +++ /dev/null @@ -1,29 +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.embeddedapp; - -import android.app.Activity; -import android.os.Bundle; - -public class PhoneActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_phone); - } -} diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/layout/activity_phone.xml b/samples/wearable/EmbeddedApp/Application/src/main/res/layout/activity_phone.xml deleted file mode 100644 index 54ca57e56..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/res/layout/activity_phone.xml +++ /dev/null @@ -1,34 +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:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingBottom="@dimen/activity_vertical_margin" - tools:context=".PhoneActivity"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceLarge" - android:text="@string/welcome_message" - android:layout_alignParentTop="true" - android:layout_alignParentStart="true" /> -</RelativeLayout> diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/values/dimens.xml b/samples/wearable/EmbeddedApp/Application/src/main/res/values/dimens.xml deleted file mode 100644 index a1e9cfe8a..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/res/values/dimens.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> -</resources> diff --git a/samples/wearable/EmbeddedApp/Application/src/main/res/values/strings.xml b/samples/wearable/EmbeddedApp/Application/src/main/res/values/strings.xml deleted file mode 100644 index 0babff04d..000000000 --- a/samples/wearable/EmbeddedApp/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,25 +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. ---> - -<resources> - - <string name="app_name">EmbeddedApp Sample</string> - <string name="welcome_message"> - By installing the release build of this application, the corresponding wearable app should - automatically be installed on any connected wearable devices. - </string> - -</resources> diff --git a/samples/wearable/EmbeddedApp/Wearable/build.gradle b/samples/wearable/EmbeddedApp/Wearable/build.gradle deleted file mode 100644 index 92ac19e85..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName '1.0' - } - - signingConfigs { - release { - keyAlias 'androiddebugkey' - keyPassword 'android' - storeFile file('$rootDir/../../debug.keystore') - storePassword 'android' - } - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - signingConfig signingConfigs.release - } - } -} diff --git a/samples/wearable/EmbeddedApp/Wearable/proguard-rules.txt b/samples/wearable/EmbeddedApp/Wearable/proguard-rules.txt deleted file mode 100644 index 5b86c0858..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/AndroidManifest.xml b/samples/wearable/EmbeddedApp/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 8c9ef4ece..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,37 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.embeddedapp" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light" > - <activity - android:name=".WearableActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/java/com/example/android/wearable/embeddedapp/WearableActivity.java b/samples/wearable/EmbeddedApp/Wearable/src/main/java/com/example/android/wearable/embeddedapp/WearableActivity.java deleted file mode 100644 index 3703f3425..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/java/com/example/android/wearable/embeddedapp/WearableActivity.java +++ /dev/null @@ -1,29 +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.embeddedapp; - -import android.app.Activity; -import android.os.Bundle; - -public class WearableActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_wearable); - } -} diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/layout/activity_wearable.xml b/samples/wearable/EmbeddedApp/Wearable/src/main/res/layout/activity_wearable.xml deleted file mode 100644 index 1f6a78a97..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/layout/activity_wearable.xml +++ /dev/null @@ -1,30 +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" - tools:context=".WearableActivity"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceMedium" - android:text="@string/welcome_message" - android:layout_centerVertical="true" - android:layout_centerHorizontal="true" /> -</RelativeLayout> diff --git a/samples/wearable/EmbeddedApp/Wearable/src/main/res/values/strings.xml b/samples/wearable/EmbeddedApp/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 1823c573d..000000000 --- a/samples/wearable/EmbeddedApp/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,25 +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. ---> - -<resources> - - <string name="app_name">EmbeddedApp Sample</string> - <string name="welcome_message"> - This wearable app should be automatically installed on wearable devices whenever the - release build of the corresponding phone app is installed. - </string> - -</resources> diff --git a/samples/wearable/EmbeddedApp/_index.html b/samples/wearable/EmbeddedApp/_index.html deleted file mode 100644 index 5b5cdc5e4..000000000 --- a/samples/wearable/EmbeddedApp/_index.html +++ /dev/null @@ -1,11 +0,0 @@ -<p><b>About:</b> This simple app demonstrates how to embed a wearable app into a phone app.</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. Start the sample by running the EmbeddedApp Sample application on the companion.</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/phone_app.png" alt="Phone app" width="216" height="384"> - <img src="screenshots/embedded_wearable_app.png" alt="Embedded wearable app" width="140" - height="140"> - <figcaption>The sample phone app and embedded wearable app.</figcaption> - </figure> -</p>
\ No newline at end of file diff --git a/samples/wearable/EmbeddedApp/build.gradle b/samples/wearable/EmbeddedApp/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/EmbeddedApp/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/EmbeddedApp/debug.keystore b/samples/wearable/EmbeddedApp/debug.keystore Binary files differdeleted file mode 100644 index 617a6846c..000000000 --- a/samples/wearable/EmbeddedApp/debug.keystore +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/EmbeddedApp/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/EmbeddedApp/gradlew b/samples/wearable/EmbeddedApp/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/EmbeddedApp/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/EmbeddedApp/gradlew.bat b/samples/wearable/EmbeddedApp/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/EmbeddedApp/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/EmbeddedApp/screenshots/embedded_wearable_app.png b/samples/wearable/EmbeddedApp/screenshots/embedded_wearable_app.png Binary files differdeleted file mode 100644 index 414afe519..000000000 --- a/samples/wearable/EmbeddedApp/screenshots/embedded_wearable_app.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/screenshots/phone_app.png b/samples/wearable/EmbeddedApp/screenshots/phone_app.png Binary files differdeleted file mode 100644 index 46c3d89c3..000000000 --- a/samples/wearable/EmbeddedApp/screenshots/phone_app.png +++ /dev/null diff --git a/samples/wearable/EmbeddedApp/settings.gradle b/samples/wearable/EmbeddedApp/settings.gradle deleted file mode 100644 index 19d00acb1..000000000 --- a/samples/wearable/EmbeddedApp/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':Application', ':Wearable' diff --git a/samples/wearable/FindMyPhone/Application/build.gradle b/samples/wearable/FindMyPhone/Application/build.gradle deleted file mode 100644 index 8d1d61958..000000000 --- a/samples/wearable/FindMyPhone/Application/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -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.google.android.gms:play-services:5.0.+' - compile "com.android.support:support-v4:20.0.+" - wearApp project(':Wearable') -} diff --git a/samples/wearable/FindMyPhone/Application/proguard-rules.txt b/samples/wearable/FindMyPhone/Application/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/FindMyPhone/Application/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/FindMyPhone/Application/project.properties b/samples/wearable/FindMyPhone/Application/project.properties deleted file mode 100644 index 4ab125693..000000000 --- a/samples/wearable/FindMyPhone/Application/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml b/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml deleted file mode 100644 index 79999bab8..000000000 --- a/samples/wearable/FindMyPhone/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,39 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.findphone"> - - <uses-permission android:name="android.permission.VIBRATE" /> - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.Holo.Light" - android:allowBackup="true"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <service - android:name="com.example.android.wearable.findphone.SoundAlarmListenerService" > - <intent-filter> - <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - </service> - - </application> -</manifest> diff --git a/samples/wearable/FindMyPhone/Application/src/main/java/com/example/android/wearable/findphone/SoundAlarmListenerService.java b/samples/wearable/FindMyPhone/Application/src/main/java/com/example/android/wearable/findphone/SoundAlarmListenerService.java deleted file mode 100644 index c89db9d3c..000000000 --- a/samples/wearable/FindMyPhone/Application/src/main/java/com/example/android/wearable/findphone/SoundAlarmListenerService.java +++ /dev/null @@ -1,101 +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.findphone; - -import android.media.AudioManager; -import android.media.MediaPlayer; -import android.media.RingtoneManager; -import android.net.Uri; -import android.util.Log; - -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.WearableListenerService; - -import java.io.IOException; - -/** - * Listens for disconnection from home device. - */ -public class SoundAlarmListenerService extends WearableListenerService { - - private static final String TAG = "ExampleFindPhoneApp"; - - private static final String FIELD_ALARM_ON = "alarm_on"; - - private AudioManager mAudioManager; - private static int mOrigVolume; - private int mMaxVolume; - private Uri mAlarmSound; - private MediaPlayer mMediaPlayer; - - @Override - public void onCreate() { - super.onCreate(); - mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE); - mOrigVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_ALARM); - mMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM); - mAlarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); - mMediaPlayer = new MediaPlayer(); - } - - @Override - public void onDestroy() { - // Reset the alarm volume to the user's original setting. - mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, mOrigVolume, 0); - mMediaPlayer.release(); - super.onDestroy(); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "onDataChanged: " + dataEvents + " for " + getPackageName()); - } - for (DataEvent event : dataEvents) { - if (event.getType() == DataEvent.TYPE_DELETED) { - Log.i(TAG, event + " deleted"); - } else if (event.getType() == DataEvent.TYPE_CHANGED) { - Boolean alarmOn = - DataMap.fromByteArray(event.getDataItem().getData()).get(FIELD_ALARM_ON); - if (alarmOn) { - mOrigVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_ALARM); - mMediaPlayer.reset(); - // Sound alarm at max volume. - mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, mMaxVolume, 0); - mMediaPlayer.setAudioStreamType(AudioManager.STREAM_ALARM); - try { - mMediaPlayer.setDataSource(getApplicationContext(), mAlarmSound); - mMediaPlayer.prepare(); - } catch (IOException e) { - Log.e(TAG, "Failed to prepare media player to play alarm.", e); - } - mMediaPlayer.start(); - } else { - // Reset the alarm volume to the user's original setting. - mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, mOrigVolume, 0); - if (mMediaPlayer.isPlaying()) { - mMediaPlayer.stop(); - } - } - } - } - dataEvents.close(); - } - -} diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 43254bd67..000000000 --- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index de255d6bb..000000000 --- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 5a849da2e..000000000 --- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 96a7cb8e1..000000000 --- a/samples/wearable/FindMyPhone/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Application/src/main/res/values/strings.xml b/samples/wearable/FindMyPhone/Application/src/main/res/values/strings.xml deleted file mode 100644 index 8db7cedcb..000000000 --- a/samples/wearable/FindMyPhone/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - - <string name="app_name">Find My Phone</string> - -</resources> diff --git a/samples/wearable/FindMyPhone/Wearable/build.gradle b/samples/wearable/FindMyPhone/Wearable/build.gradle deleted file mode 100644 index 0e23b4d56..000000000 --- a/samples/wearable/FindMyPhone/Wearable/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile 'com.google.android.gms:play-services-wearable:+' - compile "com.google.android.support:wearable:1.0.+" -}
\ No newline at end of file diff --git a/samples/wearable/FindMyPhone/Wearable/proguard-rules.txt b/samples/wearable/FindMyPhone/Wearable/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/FindMyPhone/Wearable/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/FindMyPhone/Wearable/project.properties b/samples/wearable/FindMyPhone/Wearable/project.properties deleted file mode 100644 index 4ab125693..000000000 --- a/samples/wearable/FindMyPhone/Wearable/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/AndroidManifest.xml b/samples/wearable/FindMyPhone/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 81ef5897f..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,51 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.findphone" > - - <uses-permission android:name="android.permission.VIBRATE" /> - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault" > - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <service android:name=".DisconnectListenerService" > - <intent-filter> - <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - </service> - - <service android:name="com.example.android.wearable.findphone.FindPhoneService"/> - - <activity - android:name=".FindPhoneActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/DisconnectListenerService.java b/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/DisconnectListenerService.java deleted file mode 100644 index 42237de3e..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/DisconnectListenerService.java +++ /dev/null @@ -1,55 +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.findphone; - -import android.app.Notification; -import android.app.NotificationManager; - -import com.google.android.gms.wearable.WearableListenerService; - -/** - * Listens for disconnection from home device. - */ -public class DisconnectListenerService extends WearableListenerService { - - private static final String TAG = "ExampleFindPhoneApp"; - - private static final int FORGOT_PHONE_NOTIFICATION_ID = 1; - - @Override - public void onPeerDisconnected(com.google.android.gms.wearable.Node peer) { - // Create a "forgot phone" notification when phone connection is broken. - Notification.Builder notificationBuilder = new Notification.Builder(this) - .setContentTitle(getString(R.string.left_phone_title)) - .setContentText(getString(R.string.left_phone_content)) - .setVibrate(new long[] {0, 200}) // Vibrate for 200 milliseconds. - .setSmallIcon(R.drawable.ic_launcher) - .setLocalOnly(true) - .setPriority(Notification.PRIORITY_MAX); - Notification card = notificationBuilder.build(); - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(FORGOT_PHONE_NOTIFICATION_ID, card); - } - - @Override - public void onPeerConnected(com.google.android.gms.wearable.Node peer) { - // Remove the "forgot phone" notification when connection is restored. - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .cancel(FORGOT_PHONE_NOTIFICATION_ID); - } - -} diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneActivity.java b/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneActivity.java deleted file mode 100644 index d4eb18bf4..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneActivity.java +++ /dev/null @@ -1,87 +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.findphone; - -import android.app.Activity; -import android.app.Notification; -import android.app.Notification.Action; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.RelativeSizeSpan; - - -public class FindPhoneActivity extends Activity { - - private static final int FIND_PHONE_NOTIFICATION_ID = 2; - private static Notification.Builder notification; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Create a notification with an action to toggle an alarm on the phone. - Intent toggleAlarmOperation = new Intent(this, FindPhoneService.class); - toggleAlarmOperation.setAction(FindPhoneService.ACTION_TOGGLE_ALARM); - PendingIntent toggleAlarmIntent = PendingIntent.getService(this, 0, toggleAlarmOperation, - PendingIntent.FLAG_CANCEL_CURRENT); - Action alarmAction = new Action(R.drawable.alarm_action_icon, "", toggleAlarmIntent); - // This intent turns off the alarm if the user dismisses the card from the wearable. - Intent cancelAlarmOperation = new Intent(this, FindPhoneService.class); - cancelAlarmOperation.setAction(FindPhoneService.ACTION_CANCEL_ALARM); - PendingIntent cancelAlarmIntent = PendingIntent.getService(this, 0, cancelAlarmOperation, - PendingIntent.FLAG_CANCEL_CURRENT); - // Use a spannable string for the notification title to resize it. - SpannableString title = new SpannableString(getString(R.string.app_name)); - title.setSpan(new RelativeSizeSpan(0.85f), 0, title.length(), Spannable.SPAN_POINT_MARK); - notification = new Notification.Builder(this) - .setContentTitle(title) - .setContentText(getString(R.string.turn_alarm_on)) - .setSmallIcon(R.drawable.ic_launcher) - .setVibrate(new long[] {0, 50}) // Vibrate to bring card to top of stream. - .setDeleteIntent(cancelAlarmIntent) - .extend(new Notification.WearableExtender() - .addAction(alarmAction) - .setContentAction(0) - .setHintHideIcon(true)) - .setLocalOnly(true) - .setPriority(Notification.PRIORITY_MAX); - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(FIND_PHONE_NOTIFICATION_ID, notification.build()); - - finish(); - } - - /** - * Updates the text on the wearable notification. This is used so the notification reflects the - * current state of the alarm on the phone. For instance, if the alarm is turned on, the - * notification text indicates that the user can tap it to turn it off, and vice-versa. - * - * @param context - * @param notificationText The new text to display on the wearable notification. - */ - public static void updateNotification(Context context, String notificationText) { - notification.setContentText(notificationText); - ((NotificationManager) context.getSystemService(NOTIFICATION_SERVICE)) - .notify(FIND_PHONE_NOTIFICATION_ID, notification.build()); - } - -} diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneService.java b/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneService.java deleted file mode 100644 index e5fa6c0ca..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/java/com/example/android/wearable/findphone/FindPhoneService.java +++ /dev/null @@ -1,121 +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.findphone; - -import android.app.IntentService; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.DataItemBuffer; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.Wearable; - -import java.util.concurrent.TimeUnit; - -/** - * Creates a sound on the paired phone to find it. - */ -public class FindPhoneService extends IntentService implements GoogleApiClient.ConnectionCallbacks, - GoogleApiClient.OnConnectionFailedListener { - - private static final String TAG = "ExampleFindPhoneApp"; - - private static final String FIELD_ALARM_ON = "alarm_on"; - private static final String PATH_SOUND_ALARM = "/sound_alarm"; - public static final String ACTION_TOGGLE_ALARM = "action_toggle_alarm"; - public static final String ACTION_CANCEL_ALARM = "action_alarm_off"; - - // Timeout for making a connection to GoogleApiClient (in milliseconds). - private static final long CONNECTION_TIME_OUT_MS = 100; - private GoogleApiClient mGoogleApiClient; - - public FindPhoneService() { - super(FindPhoneService.class.getSimpleName()); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onHandleIntent(Intent intent) { - mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "FindPhoneService.onHandleIntent"); - } - if (mGoogleApiClient.isConnected()) { - // Set the alarm off by default. - boolean alarmOn = false; - if (intent.getAction().equals(ACTION_TOGGLE_ALARM)) { - // Get current state of the alarm. - DataItemBuffer result = Wearable.DataApi.getDataItems(mGoogleApiClient).await(); - if (result.getStatus().isSuccess()) { - if (result.getCount() == 1) { - alarmOn = DataMap.fromByteArray(result.get(0).getData()) - .getBoolean(FIELD_ALARM_ON, false); - } else { - Log.e(TAG, "Unexpected number of DataItems found.\n" - + "\tExpected: 1\n" - + "\tActual: " + result.getCount()); - } - } else if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "onHandleIntent: failed to get current alarm state"); - } - result.close(); - // Toggle alarm. - alarmOn = !alarmOn; - // Change notification text based on new value of alarmOn. - String notificationText = alarmOn ? getString(R.string.turn_alarm_off) - : getString(R.string.turn_alarm_on); - FindPhoneActivity.updateNotification(this, notificationText); - } - // Use alarmOn boolean to update the DataItem - phone will respond accordingly - // when it receives the change. - PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(PATH_SOUND_ALARM); - putDataMapRequest.getDataMap().putBoolean(FIELD_ALARM_ON, alarmOn); - Wearable.DataApi.putDataItem(mGoogleApiClient, putDataMapRequest.asPutDataRequest()) - .await(); - } else { - Log.e(TAG, "Failed to toggle alarm on phone - Client disconnected from Google Play " - + "Services"); - } - mGoogleApiClient.disconnect(); - } - - @Override - public void onConnected(Bundle connectionHint) { - } - - @Override - public void onConnectionSuspended(int cause) { - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - } - -} diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/alarm_action_icon.png b/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/alarm_action_icon.png Binary files differdeleted file mode 100644 index 4331a5121..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/alarm_action_icon.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 43254bd67..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index de255d6bb..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 5a849da2e..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 96a7cb8e1..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/Wearable/src/main/res/values/strings.xml b/samples/wearable/FindMyPhone/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 5c6debe44..000000000 --- a/samples/wearable/FindMyPhone/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,25 +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. ---> - -<resources> - - <string name="app_name">Find My Phone</string> - <string name="left_phone_title">Forgetting something?</string> - <string name="left_phone_content">You may have left your phone behind.</string> - <string name="turn_alarm_on">Tap to sound an alarm on phone.</string> - <string name="turn_alarm_off">Tap to stop the alarm.</string> - -</resources> diff --git a/samples/wearable/FindMyPhone/_index.html b/samples/wearable/FindMyPhone/_index.html deleted file mode 100644 index 9d19f5bed..000000000 --- a/samples/wearable/FindMyPhone/_index.html +++ /dev/null @@ -1,21 +0,0 @@ -<p><b>About:</b> This sample application notifies you when you may have left your phone behind -(specifically, when your companion and wearable disconnect). If you have misplaced your phone, but -it is still connected to your wearable, you can also start an activity on the wearable to sound an -alarm on your phone.</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. A notification will automatically appear on the wearable when the wearable and companion -disconnect. To start the FindMyPhone activity on the wearable, go to the voice menu (either by -saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select -"Find My Phone" from the submenu.</p> -<p><b>Wearable APIs used:</b> DataApi, WearableListenerService</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/find_my_phone_notification.png" alt="Forgetting something?" - width="140" height="140"> - <img src="screenshots/find_my_phone_activity.png" alt="Tap to sound an alarm on phone" - width="140" height="140"> - <figcaption>The notification that appears when your wearable and companion disconnect, - followed by the wearable FindMyPhone activity (which just creates a notification). - </figcaption> - </figure> -</p> diff --git a/samples/wearable/FindMyPhone/build.gradle b/samples/wearable/FindMyPhone/build.gradle deleted file mode 100644 index d3c8c5971..000000000 --- a/samples/wearable/FindMyPhone/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -}
\ No newline at end of file diff --git a/samples/wearable/FindMyPhone/gradle.properties b/samples/wearable/FindMyPhone/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/FindMyPhone/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/FindMyPhone/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/FindMyPhone/gradlew b/samples/wearable/FindMyPhone/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/FindMyPhone/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/FindMyPhone/gradlew.bat b/samples/wearable/FindMyPhone/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/FindMyPhone/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/FindMyPhone/screenshots/find_my_phone_activity.png b/samples/wearable/FindMyPhone/screenshots/find_my_phone_activity.png Binary files differdeleted file mode 100644 index 8cff992c3..000000000 --- a/samples/wearable/FindMyPhone/screenshots/find_my_phone_activity.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/screenshots/find_my_phone_notification.png b/samples/wearable/FindMyPhone/screenshots/find_my_phone_notification.png Binary files differdeleted file mode 100644 index a8ed8679a..000000000 --- a/samples/wearable/FindMyPhone/screenshots/find_my_phone_notification.png +++ /dev/null diff --git a/samples/wearable/FindMyPhone/settings.gradle b/samples/wearable/FindMyPhone/settings.gradle deleted file mode 100644 index f3f25a547..000000000 --- a/samples/wearable/FindMyPhone/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Wearable', 'Application' diff --git a/samples/wearable/Flashlight/Wearable/build.gradle b/samples/wearable/Flashlight/Wearable/build.gradle deleted file mode 100644 index b9450ca9a..000000000 --- a/samples/wearable/Flashlight/Wearable/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile "com.google.android.support:wearable:1.0.+" -} diff --git a/samples/wearable/Flashlight/Wearable/proguard-rules.txt b/samples/wearable/Flashlight/Wearable/proguard-rules.txt deleted file mode 100644 index 2267fe6a9..000000000 --- a/samples/wearable/Flashlight/Wearable/proguard-rules.txt +++ /dev/null @@ -1,44 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add classes here when necessary. - --keep class android.support.wearable.view.WearableListView { - private void setScrollAnimator(int); - protected void setScrollVertically(int); -} --keep class android.support.wearable.view.WearableListView.ViewHolder { - private void setFocusPaddingTop(int); - private void setFocusPaddingBottom(int); -} - -# GmsCore Proguard rules. -# See: https://developer.android.com/google/play-services/setup.html --keep class * extends java.util.ListResourceBundle { - protected Object[][] getContents(); -} - -# Keep SafeParcelable value, needed for reflection. This is required to support backwards -# compatibility of some classes. --keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable { - public static final *** NULL; -} - -# Keep the names of classes/members we need for client functionality. --keepnames @com.google.android.gms.common.annotation.KeepName class * --keepclassmembernames class * { - @com.google.android.gms.common.annotation.KeepName *; -} - -# Needed for Parcelable/SafeParcelable Creators to not get stripped --keepnames class * implements android.os.Parcelable { - public static final ** CREATOR; -} - -# End GmsCore Proguard rules. diff --git a/samples/wearable/Flashlight/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Flashlight/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index bd240dd34..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,37 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.flashlight" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:label="@string/app_name" - android:icon="@drawable/ic_launcher" - android:theme="@android:style/Theme.DeviceDefault" > - <activity android:name=".MainActivity" - android:label="@string/app_name" - android:launchMode="singleTop" - android:configChanges="orientation|keyboardHidden"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - <category android:name="android.intent.category.DEFAULT" /> - </intent-filter> - </activity> - </application> -</manifest> diff --git a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/MainActivity.java b/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/MainActivity.java deleted file mode 100644 index f87cae878..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/MainActivity.java +++ /dev/null @@ -1,125 +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.flashlight; - -import android.app.Activity; -import android.app.Fragment; -import android.app.FragmentManager; -import android.os.Bundle; -import android.support.v13.app.FragmentPagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v4.view.ViewPager.OnPageChangeListener; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; - -import java.util.ArrayList; - -/** - * Let there be light. - */ -public class MainActivity extends Activity { - - private ViewPager mViewPager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - setContentView(R.layout.main); - mViewPager = (ViewPager) findViewById(R.id.pager); - final LightFragmentAdapter adapter = new LightFragmentAdapter(getFragmentManager()); - adapter.addFragment(new WhiteLightFragment()); - final PartyLightFragment partyFragment = new PartyLightFragment(); - adapter.addFragment(partyFragment); - mViewPager.setAdapter(adapter); - mViewPager.setOnPageChangeListener(new OnPageChangeListener() { - - @Override - public void onPageSelected(int position) { - if (position == 1) { - partyFragment.startCycling(); - } else { - partyFragment.stopCycling(); - } - } - - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - } - - @Override - public void onPageScrollStateChanged(int state) { - } - }); - } - - static class LightFragmentAdapter extends FragmentPagerAdapter { - private ArrayList<Fragment> mFragments; - - public LightFragmentAdapter(FragmentManager fm) { - super(fm); - mFragments = new ArrayList<Fragment>(); - } - - @Override - public Fragment getItem(int position) { - return mFragments.get(position); - } - - @Override - public int getCount() { - return mFragments.size(); - } - - public void addFragment(Fragment fragment) { - mFragments.add(fragment); - // Update the pager when adding a fragment. - notifyDataSetChanged(); - } - } - - public static class WhiteLightFragment extends Fragment { - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - return inflater.inflate(R.layout.white_light, container, false); - } - } - - public static class PartyLightFragment extends Fragment { - - private PartyLightView mView; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - mView = (PartyLightView) inflater.inflate(R.layout.party_light, container, false); - return mView; - } - - public void startCycling() { - mView.startCycling(); - } - - public void stopCycling() { - mView.stopCycling(); - } - - } -} diff --git a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/PartyLightView.java b/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/PartyLightView.java deleted file mode 100644 index 33f061e15..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/java/com/example/android/wearable/flashlight/PartyLightView.java +++ /dev/null @@ -1,120 +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.flashlight; - -import android.animation.ArgbEvaluator; -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Color; -import android.os.Handler; -import android.os.Message; -import android.util.AttributeSet; -import android.view.View; - -/** - * Flashing party lights! - */ -public class PartyLightView extends View { - - private int[] mColors = new int[] { - Color.RED, - Color.GREEN, - Color.BLUE, - Color.CYAN, - Color.MAGENTA - }; - - private int mFromColorIndex; - private int mToColorIndex; - - /** - * Value b/t 0 and 1. - */ - private float mProgress; - - private ArgbEvaluator mEvaluator; - - private int mCurrentColor; - - private Handler mHandler; - - public PartyLightView(Context context) { - super(context); - init(); - } - - public PartyLightView(Context context, AttributeSet attrs) { - super(context, attrs); - init(); - } - - @Override - protected void onDraw(Canvas canvas) { - canvas.drawColor(mCurrentColor); - super.onDraw(canvas); - } - - public void startCycling() { - mHandler.sendEmptyMessage(0); - } - - public void stopCycling() { - mHandler.removeMessages(0); - } - - private void init() { - mEvaluator = new ArgbEvaluator(); - mHandler = new Handler() { - - @Override - public void handleMessage(Message msg) { - mCurrentColor = getColor(mProgress, mColors[mFromColorIndex], - mColors[mToColorIndex]); - postInvalidate(); - mProgress += 0.1; - if (mProgress > 1.0) { - mFromColorIndex = mToColorIndex; - // Find a new color. - mToColorIndex++; - if (mToColorIndex >= mColors.length) { - mToColorIndex = 0; - } - } - mHandler.sendEmptyMessageDelayed(0, 100); - } - }; - } - - private int getColor(float fraction, int colorStart, int colorEnd) { - int startInt = colorStart; - int startA = (startInt >> 24) & 0xff; - int startR = (startInt >> 16) & 0xff; - int startG = (startInt >> 8) & 0xff; - int startB = startInt & 0xff; - - int endInt = colorEnd; - int endA = (endInt >> 24) & 0xff; - int endR = (endInt >> 16) & 0xff; - int endG = (endInt >> 8) & 0xff; - int endB = endInt & 0xff; - - return (startA + (int)(fraction * (endA - startA))) << 24 | - (startR + (int)(fraction * (endR - startR))) << 16 | - (startG + (int)(fraction * (endG - startG))) << 8 | - ((startB + (int)(fraction * (endB - startB)))); - } -} diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/Flashlight/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/Flashlight/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/layout/main.xml b/samples/wearable/Flashlight/Wearable/src/main/res/layout/main.xml deleted file mode 100644 index 1e10f5a4a..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/layout/main.xml +++ /dev/null @@ -1,24 +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. ---> - -<android.support.v4.view.ViewPager - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/pager" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#000" - android:keepScreenOn="true" - /> diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/layout/party_light.xml b/samples/wearable/Flashlight/Wearable/src/main/res/layout/party_light.xml deleted file mode 100644 index b29ef9491..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/layout/party_light.xml +++ /dev/null @@ -1,21 +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. ---> - -<com.example.android.wearable.flashlight.PartyLightView - xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - /> diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/layout/white_light.xml b/samples/wearable/Flashlight/Wearable/src/main/res/layout/white_light.xml deleted file mode 100644 index 94353a2b0..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/layout/white_light.xml +++ /dev/null @@ -1,21 +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. ---> - -<View xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#fff" - /> diff --git a/samples/wearable/Flashlight/Wearable/src/main/res/values/strings.xml b/samples/wearable/Flashlight/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 6790e2d61..000000000 --- a/samples/wearable/Flashlight/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <!-- Name of the wearable app [CHAR LIMIT=NONE] --> - <string name="app_name">Flashlight</string> - -</resources> diff --git a/samples/wearable/Flashlight/_index.html b/samples/wearable/Flashlight/_index.html deleted file mode 100644 index 358148a21..000000000 --- a/samples/wearable/Flashlight/_index.html +++ /dev/null @@ -1,12 +0,0 @@ -<p><b>About:</b> Wearable activity that uses your wearable screen as a flashlight. There is also -a party-mode option, if you want to make things interesting.</p> -<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by -saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select -"Flashlight" from the submenu.</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/flashlight.png" alt="Flashlight" width="140" height="140"> - <img src="screenshots/party_mode.gif" alt="Party mode!" width="140" height="140"> - <figcaption>Plain flashlight, followed by party-mode.</figcaption> - </figure> -</p> diff --git a/samples/wearable/Flashlight/build.gradle b/samples/wearable/Flashlight/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/Flashlight/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/Flashlight/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/Flashlight/gradlew b/samples/wearable/Flashlight/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/Flashlight/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/Flashlight/gradlew.bat b/samples/wearable/Flashlight/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/Flashlight/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Flashlight/screenshots/flashlight.png b/samples/wearable/Flashlight/screenshots/flashlight.png Binary files differdeleted file mode 100644 index 02fca20d6..000000000 --- a/samples/wearable/Flashlight/screenshots/flashlight.png +++ /dev/null diff --git a/samples/wearable/Flashlight/screenshots/party_mode.gif b/samples/wearable/Flashlight/screenshots/party_mode.gif Binary files differdeleted file mode 100644 index 8258b7dd6..000000000 --- a/samples/wearable/Flashlight/screenshots/party_mode.gif +++ /dev/null diff --git a/samples/wearable/Flashlight/settings.gradle b/samples/wearable/Flashlight/settings.gradle deleted file mode 100644 index 1d97d30e1..000000000 --- a/samples/wearable/Flashlight/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':Wearable' diff --git a/samples/wearable/Geofencing/Application/build.gradle b/samples/wearable/Geofencing/Application/build.gradle deleted file mode 100644 index 8d1d61958..000000000 --- a/samples/wearable/Geofencing/Application/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -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.google.android.gms:play-services:5.0.+' - compile "com.android.support:support-v4:20.0.+" - wearApp project(':Wearable') -} diff --git a/samples/wearable/Geofencing/Application/proguard-rules.txt b/samples/wearable/Geofencing/Application/proguard-rules.txt deleted file mode 100644 index 5b89420db..000000000 --- a/samples/wearable/Geofencing/Application/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#}
\ No newline at end of file diff --git a/samples/wearable/Geofencing/Application/project.properties b/samples/wearable/Geofencing/Application/project.properties deleted file mode 100644 index 4ab125693..000000000 --- a/samples/wearable/Geofencing/Application/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/samples/wearable/Geofencing/Application/src/main/AndroidManifest.xml b/samples/wearable/Geofencing/Application/src/main/AndroidManifest.xml deleted file mode 100644 index 094134eb9..000000000 --- a/samples/wearable/Geofencing/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,48 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.geofencing"> - - <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> - - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.Holo.Light" - android:allowBackup="true"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version"/> - - <activity - android:name=".MainActivity" - android:label="@string/app_name" - android:theme="@android:style/Theme.Translucent.NoTitleBar" - android:excludeFromRecents="true"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - - <service - android:name=".GeofenceTransitionsIntentService" - android:exported="false"> - </service> - </application> -</manifest> diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/Constants.java b/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/Constants.java deleted file mode 100644 index 6da9151dc..000000000 --- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/Constants.java +++ /dev/null @@ -1,77 +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.geofencing; - -import android.net.Uri; - -import com.google.android.gms.location.Geofence; - -/** Constants used in companion app. */ -public final class Constants { - - private Constants() { - } - - public static final String TAG = "ExampleGeofencingApp"; - - // Request code to attempt to resolve Google Play services connection failures. - public final static int CONNECTION_FAILURE_RESOLUTION_REQUEST = 9000; - // Timeout for making a connection to GoogleApiClient (in milliseconds). - public static final long CONNECTION_TIME_OUT_MS = 100; - - // For the purposes of this demo, the geofences are hard-coded and should not expire. - // An app with dynamically-created geofences would want to include a reasonable expiration time. - public static final long GEOFENCE_EXPIRATION_TIME = Geofence.NEVER_EXPIRE; - - // Geofence parameters for the Android building on Google's main campus in Mountain View. - public static final String ANDROID_BUILDING_ID = "1"; - public static final double ANDROID_BUILDING_LATITUDE = 37.420092; - public static final double ANDROID_BUILDING_LONGITUDE = -122.083648; - public static final float ANDROID_BUILDING_RADIUS_METERS = 60.0f; - - // Geofence parameters for the Yerba Buena Gardens near the Moscone Center in San Francisco. - public static final String YERBA_BUENA_ID = "2"; - public static final double YERBA_BUENA_LATITUDE = 37.784886; - public static final double YERBA_BUENA_LONGITUDE = -122.402671; - public static final float YERBA_BUENA_RADIUS_METERS = 72.0f; - - - // The constants below are less interesting than those above. - - // Path for the DataItem containing the last geofence id entered. - public static final String GEOFENCE_DATA_ITEM_PATH = "/geofenceid"; - public static final Uri GEOFENCE_DATA_ITEM_URI = - new Uri.Builder().scheme("wear").path(GEOFENCE_DATA_ITEM_PATH).build(); - public static final String KEY_GEOFENCE_ID = "geofence_id"; - - // Keys for flattened geofences stored in SharedPreferences. - public static final String KEY_LATITUDE = "com.example.wearable.geofencing.KEY_LATITUDE"; - public static final String KEY_LONGITUDE = "com.example.wearable.geofencing.KEY_LONGITUDE"; - public static final String KEY_RADIUS = "com.example.wearable.geofencing.KEY_RADIUS"; - public static final String KEY_EXPIRATION_DURATION = - "com.example.wearable.geofencing.KEY_EXPIRATION_DURATION"; - public static final String KEY_TRANSITION_TYPE = - "com.example.wearable.geofencing.KEY_TRANSITION_TYPE"; - // The prefix for flattened geofence keys. - public static final String KEY_PREFIX = "com.example.wearable.geofencing.KEY"; - - // Invalid values, used to test geofence storage when retrieving geofences. - public static final long INVALID_LONG_VALUE = -999l; - public static final float INVALID_FLOAT_VALUE = -999.0f; - public static final int INVALID_INT_VALUE = -999; - -} diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java b/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java deleted file mode 100644 index 5d1ea48e0..000000000 --- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/GeofenceTransitionsIntentService.java +++ /dev/null @@ -1,119 +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.geofencing; - -import static com.example.android.wearable.geofencing.Constants.CONNECTION_TIME_OUT_MS; -import static com.example.android.wearable.geofencing.Constants.GEOFENCE_DATA_ITEM_PATH; -import static com.example.android.wearable.geofencing.Constants.GEOFENCE_DATA_ITEM_URI; -import static com.example.android.wearable.geofencing.Constants.KEY_GEOFENCE_ID; -import static com.example.android.wearable.geofencing.Constants.TAG; - -import android.app.IntentService; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.location.Geofence; -import com.google.android.gms.location.LocationClient; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.Wearable; - -import java.util.concurrent.TimeUnit; - -/** - * Listens for geofence transition changes. - */ -public class GeofenceTransitionsIntentService extends IntentService - implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { - - private GoogleApiClient mGoogleApiClient; - - public GeofenceTransitionsIntentService() { - super(GeofenceTransitionsIntentService.class.getSimpleName()); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - /** - * Handles incoming intents. - * @param intent The Intent sent by Location Services. This Intent is provided to Location - * Services (inside a PendingIntent) when addGeofences() is called. - */ - @Override - protected void onHandleIntent(Intent intent) { - // First check for errors. - if (LocationClient.hasError(intent)) { - int errorCode = LocationClient.getErrorCode(intent); - Log.e(TAG, "Location Services error: " + errorCode); - } else { - // Get the type of geofence transition (i.e. enter or exit in this sample). - int transitionType = LocationClient.getGeofenceTransition(intent); - // Create a DataItem when a user enters one of the geofences. The wearable app will - // receive this and create a notification to prompt him/her to check in. - if (Geofence.GEOFENCE_TRANSITION_ENTER == transitionType) { - // Connect to the Google Api service in preparation for sending a DataItem. - mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); - // Get the geofence id triggered. Note that only one geofence can be triggered at a - // time in this example, but in some cases you might want to consider the full list - // of geofences triggered. - String triggeredGeofenceId = LocationClient.getTriggeringGeofences(intent).get(0) - .getRequestId(); - // Create a DataItem with this geofence's id. The wearable can use this to create - // a notification. - final PutDataMapRequest putDataMapRequest = - PutDataMapRequest.create(GEOFENCE_DATA_ITEM_PATH); - putDataMapRequest.getDataMap().putString(KEY_GEOFENCE_ID, triggeredGeofenceId); - if (mGoogleApiClient.isConnected()) { - Wearable.DataApi.putDataItem( - mGoogleApiClient, putDataMapRequest.asPutDataRequest()).await(); - } else { - Log.e(TAG, "Failed to send data item: " + putDataMapRequest - + " - Client disconnected from Google Play Services"); - } - mGoogleApiClient.disconnect(); - } else if (Geofence.GEOFENCE_TRANSITION_EXIT == transitionType) { - // Delete the data item when leaving a geofence region. - mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); - Wearable.DataApi.deleteDataItems(mGoogleApiClient, GEOFENCE_DATA_ITEM_URI).await(); - mGoogleApiClient.disconnect(); - } - } - } - - @Override - public void onConnected(Bundle connectionHint) { - } - - @Override - public void onConnectionSuspended(int cause) { - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - } - -} diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/MainActivity.java b/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/MainActivity.java deleted file mode 100644 index baef21755..000000000 --- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/MainActivity.java +++ /dev/null @@ -1,240 +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.geofencing; - -import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_ID; -import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_LATITUDE; -import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_LONGITUDE; -import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_RADIUS_METERS; -import static com.example.android.wearable.geofencing.Constants.CONNECTION_FAILURE_RESOLUTION_REQUEST; -import static com.example.android.wearable.geofencing.Constants.GEOFENCE_EXPIRATION_TIME; -import static com.example.android.wearable.geofencing.Constants.TAG; -import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_ID; -import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_LATITUDE; -import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_LONGITUDE; -import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_RADIUS_METERS; - -import android.app.Activity; -import android.app.PendingIntent; -import android.content.Intent; -import android.content.IntentSender; -import android.os.Bundle; -import android.util.Log; -import android.widget.Toast; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.GooglePlayServicesClient.ConnectionCallbacks; -import com.google.android.gms.common.GooglePlayServicesUtil; -import com.google.android.gms.common.api.GoogleApiClient.OnConnectionFailedListener; -import com.google.android.gms.location.Geofence; -import com.google.android.gms.location.LocationClient; -import com.google.android.gms.location.LocationClient.OnAddGeofencesResultListener; -import com.google.android.gms.location.LocationStatusCodes; - -import java.util.ArrayList; -import java.util.List; - -public class MainActivity extends Activity implements ConnectionCallbacks, - OnConnectionFailedListener, OnAddGeofencesResultListener { - - // Internal List of Geofence objects. In a real app, these might be provided by an API based on - // locations within the user's proximity. - List<Geofence> mGeofenceList; - - // These will store hard-coded geofences in this sample app. - private SimpleGeofence mAndroidBuildingGeofence; - private SimpleGeofence mYerbaBuenaGeofence; - - // Persistent storage for geofences. - private SimpleGeofenceStore mGeofenceStorage; - - private LocationClient mLocationClient; - // Stores the PendingIntent used to request geofence monitoring. - private PendingIntent mGeofenceRequestIntent; - - // Defines the allowable request types (in this example, we only add geofences). - private enum REQUEST_TYPE {ADD} - private REQUEST_TYPE mRequestType; - // Flag that indicates if a request is underway. - private boolean mInProgress; - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - // Rather than displayng this activity, simply display a toast indicating that the geofence - // service is being created. This should happen in less than a second. - Toast.makeText(this, getString(R.string.start_geofence_service), Toast.LENGTH_SHORT).show(); - - // Instantiate a new geofence storage area. - mGeofenceStorage = new SimpleGeofenceStore(this); - // Instantiate the current List of geofences. - mGeofenceList = new ArrayList<Geofence>(); - // Start with the request flag set to false. - mInProgress = false; - - createGeofences(); - addGeofences(); - - finish(); - } - - /** - * In this sample, the geofences are predetermined and are hard-coded here. A real app might - * dynamically create geofences based on the user's location. - */ - public void createGeofences() { - // Create internal "flattened" objects containing the geofence data. - mAndroidBuildingGeofence = new SimpleGeofence( - ANDROID_BUILDING_ID, // geofenceId. - ANDROID_BUILDING_LATITUDE, - ANDROID_BUILDING_LONGITUDE, - ANDROID_BUILDING_RADIUS_METERS, - GEOFENCE_EXPIRATION_TIME, - Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT - ); - mYerbaBuenaGeofence = new SimpleGeofence( - YERBA_BUENA_ID, // geofenceId. - YERBA_BUENA_LATITUDE, - YERBA_BUENA_LONGITUDE, - YERBA_BUENA_RADIUS_METERS, - GEOFENCE_EXPIRATION_TIME, - Geofence.GEOFENCE_TRANSITION_ENTER | Geofence.GEOFENCE_TRANSITION_EXIT - ); - - // Store these flat versions in SharedPreferences and add them to the geofence list. - mGeofenceStorage.setGeofence(ANDROID_BUILDING_ID, mAndroidBuildingGeofence); - mGeofenceStorage.setGeofence(YERBA_BUENA_ID, mYerbaBuenaGeofence); - mGeofenceList.add(mAndroidBuildingGeofence.toGeofence()); - mGeofenceList.add(mYerbaBuenaGeofence.toGeofence()); - } - - /** - * Start a request for geofence monitoring by calling LocationClient.connect(). - */ - public void addGeofences() { - // Start a request to add geofences. - mRequestType = REQUEST_TYPE.ADD; - // Test for Google Play services after setting the request type. - if (!isGooglePlayServicesAvailable()) { - Log.e(TAG, "Unable to add geofences - Google Play services unavailable."); - return; - } - // Create a new location client object. Since this activity class implements - // ConnectionCallbacks and OnConnectionFailedListener, it can be used as the listener for - // both parameters. - mLocationClient = new LocationClient(this, this, this); - // If a request is not already underway. - if (!mInProgress) { - // Indicate that a request is underway. - mInProgress = true; - // Request a connection from the client to Location Services. - mLocationClient.connect(); - // A request is already underway, so disconnect the client and retry the request. - } else { - mLocationClient.disconnect(); - mLocationClient.connect(); - } - } - - @Override - public void onConnectionFailed(ConnectionResult connectionResult) { - mInProgress = false; - // If the error has a resolution, start a Google Play services activity to resolve it. - if (connectionResult.hasResolution()) { - try { - connectionResult.startResolutionForResult(this, - CONNECTION_FAILURE_RESOLUTION_REQUEST); - } catch (IntentSender.SendIntentException e) { - Log.e(TAG, "Exception while resolving connection error.", e); - } - } else { - int errorCode = connectionResult.getErrorCode(); - Log.e(TAG, "Connection to Google Play services failed with error code " + errorCode); - } - } - - /** - * Called by Location Services if the location client disconnects. - */ - @Override - public void onDisconnected() { - // Turn off the request flag. - mInProgress = false; - // Destroy the current location client. - mLocationClient = null; - } - - /** - * Once the connection is available, send a request to add the Geofences. - */ - @Override - public void onConnected(Bundle connectionHint) { - // Use mRequestType to determine what action to take. Only ADD is used in this sample. - if (REQUEST_TYPE.ADD == mRequestType) { - // Get the PendingIntent for the geofence monitoring request. - mGeofenceRequestIntent = getGeofenceTransitionPendingIntent(); - // Send a request to add the current geofences. - mLocationClient.addGeofences(mGeofenceList, mGeofenceRequestIntent, this); - } - } - - /** - * Called when request to add geofences is complete, with a result status code. - */ - @Override - public void onAddGeofencesResult(int statusCode, String[] geofenceRequestIds) { - // Log if adding the geofences was successful. - if (LocationStatusCodes.SUCCESS == statusCode) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Added geofences successfully."); - } - } else { - Log.e(TAG, "Failed to add geofences. Status code: " + statusCode); - } - // Turn off the in progress flag and disconnect the client. - mInProgress = false; - mLocationClient.disconnect(); - } - - /** - * Checks if Google Play services is available. - * @return true if it is. - */ - private boolean isGooglePlayServicesAvailable() { - int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this); - if (ConnectionResult.SUCCESS == resultCode) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Google Play services is available."); - } - return true; - } else { - Log.e(TAG, "Google Play services is unavailable."); - return false; - } - } - - /** - * Create a PendingIntent that triggers GeofenceTransitionIntentService when a geofence - * transition occurs. - */ - private PendingIntent getGeofenceTransitionPendingIntent() { - Intent intent = new Intent(this, GeofenceTransitionsIntentService.class); - return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); - } - -} diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofence.java b/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofence.java deleted file mode 100644 index 50f02c371..000000000 --- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofence.java +++ /dev/null @@ -1,87 +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.geofencing; - -import com.google.android.gms.location.Geofence; - -/** - * A single Geofence object, defined by its center and radius. - */ -public class SimpleGeofence { - - // Instance variables - private final String mId; - private final double mLatitude; - private final double mLongitude; - private final float mRadius; - private long mExpirationDuration; - private int mTransitionType; - - /** - * @param geofenceId The Geofence's request ID. - * @param latitude Latitude of the Geofence's center in degrees. - * @param longitude Longitude of the Geofence's center in degrees. - * @param radius Radius of the geofence circle in meters. - * @param expiration Geofence expiration duration. - * @param transition Type of Geofence transition. - */ - public SimpleGeofence(String geofenceId, double latitude, double longitude, float radius, - long expiration, int transition) { - // Set the instance fields from the constructor. - this.mId = geofenceId; - this.mLatitude = latitude; - this.mLongitude = longitude; - this.mRadius = radius; - this.mExpirationDuration = expiration; - this.mTransitionType = transition; - } - - // Instance field getters. - public String getId() { - return mId; - } - public double getLatitude() { - return mLatitude; - } - public double getLongitude() { - return mLongitude; - } - public float getRadius() { - return mRadius; - } - public long getExpirationDuration() { - return mExpirationDuration; - } - public int getTransitionType() { - return mTransitionType; - } - - /** - * Creates a Location Services Geofence object from a SimpleGeofence. - * @return A Geofence object. - */ - public Geofence toGeofence() { - // Build a new Geofence object. - return new Geofence.Builder() - .setRequestId(mId) - .setTransitionTypes(mTransitionType) - .setCircularRegion(mLatitude, mLongitude, mRadius) - .setExpirationDuration(mExpirationDuration) - .build(); - } - -} diff --git a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofenceStore.java b/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofenceStore.java deleted file mode 100644 index 47584f5a3..000000000 --- a/samples/wearable/Geofencing/Application/src/main/java/com/example/android/wearable/geofencing/SimpleGeofenceStore.java +++ /dev/null @@ -1,124 +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.geofencing; - -import static com.example.android.wearable.geofencing.Constants.INVALID_FLOAT_VALUE; -import static com.example.android.wearable.geofencing.Constants.INVALID_INT_VALUE; -import static com.example.android.wearable.geofencing.Constants.INVALID_LONG_VALUE; -import static com.example.android.wearable.geofencing.Constants.KEY_EXPIRATION_DURATION; -import static com.example.android.wearable.geofencing.Constants.KEY_LATITUDE; -import static com.example.android.wearable.geofencing.Constants.KEY_LONGITUDE; -import static com.example.android.wearable.geofencing.Constants.KEY_PREFIX; -import static com.example.android.wearable.geofencing.Constants.KEY_RADIUS; -import static com.example.android.wearable.geofencing.Constants.KEY_TRANSITION_TYPE; - -import android.content.Context; -import android.content.SharedPreferences; - -/** - * Storage for geofence values, implemented in SharedPreferences. - */ -public class SimpleGeofenceStore { - - // The SharedPreferences object in which geofences are stored. - private final SharedPreferences mPrefs; - // The name of the SharedPreferences. - private static final String SHARED_PREFERENCES = "SharedPreferences"; - - /** - * Create the SharedPreferences storage with private access only. - */ - public SimpleGeofenceStore(Context context) { - mPrefs = context.getSharedPreferences(SHARED_PREFERENCES, Context.MODE_PRIVATE); - } - - /** - * Returns a stored geofence by its id, or returns null if it's not found. - * @param id The ID of a stored geofence. - * @return A SimpleGeofence defined by its center and radius, or null if the ID is invalid. - */ - public SimpleGeofence getGeofence(String id) { - // Get the latitude for the geofence identified by id, or INVALID_FLOAT_VALUE if it doesn't - // exist (similarly for the other values that follow). - double lat = mPrefs.getFloat(getGeofenceFieldKey(id, KEY_LATITUDE), - INVALID_FLOAT_VALUE); - double lng = mPrefs.getFloat(getGeofenceFieldKey(id, KEY_LONGITUDE), - INVALID_FLOAT_VALUE); - float radius = mPrefs.getFloat(getGeofenceFieldKey(id, KEY_RADIUS), - INVALID_FLOAT_VALUE); - long expirationDuration = - mPrefs.getLong(getGeofenceFieldKey(id, KEY_EXPIRATION_DURATION), - INVALID_LONG_VALUE); - int transitionType = mPrefs.getInt(getGeofenceFieldKey(id, KEY_TRANSITION_TYPE), - INVALID_INT_VALUE); - // If none of the values is incorrect, return the object. - if (lat != INVALID_FLOAT_VALUE - && lng != INVALID_FLOAT_VALUE - && radius != INVALID_FLOAT_VALUE - && expirationDuration != INVALID_LONG_VALUE - && transitionType != INVALID_INT_VALUE) { - return new SimpleGeofence(id, lat, lng, radius, expirationDuration, transitionType); - } - // Otherwise, return null. - return null; - } - - /** - * Save a geofence. - * @param geofence The SimpleGeofence with the values you want to save in SharedPreferences. - */ - public void setGeofence(String id, SimpleGeofence geofence) { - // Get a SharedPreferences editor instance. Among other things, SharedPreferences - // ensures that updates are atomic and non-concurrent. - SharedPreferences.Editor prefs = mPrefs.edit(); - // Write the Geofence values to SharedPreferences. - prefs.putFloat(getGeofenceFieldKey(id, KEY_LATITUDE), (float) geofence.getLatitude()); - prefs.putFloat(getGeofenceFieldKey(id, KEY_LONGITUDE), (float) geofence.getLongitude()); - prefs.putFloat(getGeofenceFieldKey(id, KEY_RADIUS), geofence.getRadius()); - prefs.putLong(getGeofenceFieldKey(id, KEY_EXPIRATION_DURATION), - geofence.getExpirationDuration()); - prefs.putInt(getGeofenceFieldKey(id, KEY_TRANSITION_TYPE), - geofence.getTransitionType()); - // Commit the changes. - prefs.commit(); - } - - /** - * Remove a flattened geofence object from storage by removing all of its keys. - */ - public void clearGeofence(String id) { - SharedPreferences.Editor prefs = mPrefs.edit(); - prefs.remove(getGeofenceFieldKey(id, KEY_LATITUDE)); - prefs.remove(getGeofenceFieldKey(id, KEY_LONGITUDE)); - prefs.remove(getGeofenceFieldKey(id, KEY_RADIUS)); - prefs.remove(getGeofenceFieldKey(id, KEY_EXPIRATION_DURATION)); - prefs.remove(getGeofenceFieldKey(id, KEY_TRANSITION_TYPE)); - prefs.commit(); - } - - /** - * Given a Geofence object's ID and the name of a field (for example, KEY_LATITUDE), return - * the key name of the object's values in SharedPreferences. - * @param id The ID of a Geofence object. - * @param fieldName The field represented by the key. - * @return The full key name of a value in SharedPreferences. - */ - private String getGeofenceFieldKey(String id, String fieldName) { - return KEY_PREFIX + "_" + id + "_" + fieldName; - } - -} diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/Geofencing/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 4e3e000b0..000000000 --- a/samples/wearable/Geofencing/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/Geofencing/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index b405cb2e8..000000000 --- a/samples/wearable/Geofencing/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/Geofencing/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 61f9d889c..000000000 --- a/samples/wearable/Geofencing/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/Geofencing/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 81c10085a..000000000 --- a/samples/wearable/Geofencing/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Application/src/main/res/values/strings.xml b/samples/wearable/Geofencing/Application/src/main/res/values/strings.xml deleted file mode 100644 index 92ec84899..000000000 --- a/samples/wearable/Geofencing/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,20 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="app_name">Android Wear Geofencing Example Application</string> - <string name="start_geofence_service">Starting geofence transition service</string> -</resources> diff --git a/samples/wearable/Geofencing/Wearable/build.gradle b/samples/wearable/Geofencing/Wearable/build.gradle deleted file mode 100644 index 0e23b4d56..000000000 --- a/samples/wearable/Geofencing/Wearable/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile 'com.google.android.gms:play-services-wearable:+' - compile "com.google.android.support:wearable:1.0.+" -}
\ No newline at end of file diff --git a/samples/wearable/Geofencing/Wearable/proguard-rules.txt b/samples/wearable/Geofencing/Wearable/proguard-rules.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/samples/wearable/Geofencing/Wearable/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/Geofencing/Wearable/project.properties b/samples/wearable/Geofencing/Wearable/project.properties deleted file mode 100644 index 4ab125693..000000000 --- a/samples/wearable/Geofencing/Wearable/project.properties +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/samples/wearable/Geofencing/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Geofencing/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 2446c386c..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,41 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.geofencing" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:allowBackup="true"> - - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <service - android:name="com.example.android.wearable.geofencing.HomeListenerService" > - <intent-filter> - <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - </service> - <service android:name=".CheckInAndDeleteDataItemsService"/> - - <activity android:name="android.support.wearable.activity.ConfirmationActivity"/> - </application> -</manifest> diff --git a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/CheckInAndDeleteDataItemsService.java b/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/CheckInAndDeleteDataItemsService.java deleted file mode 100644 index 7b8ba1150..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/CheckInAndDeleteDataItemsService.java +++ /dev/null @@ -1,124 +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.geofencing; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.Wearable; - -import android.app.IntentService; -import android.app.NotificationManager; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.support.wearable.activity.ConfirmationActivity; -import android.util.Log; - -import java.util.concurrent.TimeUnit; - -import static com.example.android.wearable.geofencing.Constants.ACTION_CHECK_IN; -import static com.example.android.wearable.geofencing.Constants.ACTION_DELETE_DATA_ITEM; -import static com.example.android.wearable.geofencing.Constants.CONNECTION_TIME_OUT_MS; -import static com.example.android.wearable.geofencing.Constants.NOTIFICATION_ID; -import static com.example.android.wearable.geofencing.Constants.TAG; - -/** - * Handles "Check In" action on the location-based notification. Also deletes orphan DataItems - * when a notification is dismissed from the wearable. - */ -public class CheckInAndDeleteDataItemsService extends IntentService - implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { - - private GoogleApiClient mGoogleApiClient; - - public CheckInAndDeleteDataItemsService() { - super(CheckInAndDeleteDataItemsService.class.getSimpleName()); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onHandleIntent(Intent intent) { - if (ACTION_CHECK_IN.equals(intent.getAction())) { - // In a real app, code for checking in would go here. For this sample, we will simply - // display a success animation. - startConfirmationActivity(ConfirmationActivity.SUCCESS_ANIMATION, - getString(R.string.check_in_success)); - // Dismiss the check-in notification. - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(NOTIFICATION_ID); - } else if (!ACTION_DELETE_DATA_ITEM.equals(intent.getAction())) { - // The only possible actions should be checking in or dismissing the notification - // (which causes an intent with ACTION_DELETE_DATA_ITEM). - Log.e(TAG, "Unrecognized action: " + intent.getAction()); - return; - } - // Regardless of the action, delete the DataItem (we are only be handling intents - // if the notification is dismissed or if the user has chosen to check in, either of which - // would be completed at this point). - mGoogleApiClient.blockingConnect(CONNECTION_TIME_OUT_MS, TimeUnit.MILLISECONDS); - Uri dataItemUri = intent.getData(); - if (mGoogleApiClient.isConnected()) { - DataApi.DeleteDataItemsResult result = Wearable.DataApi - .deleteDataItems(mGoogleApiClient, dataItemUri).await(); - if (!result.getStatus().isSuccess()) { - Log.e(TAG, "CheckInAndDeleteDataItemsService.onHandleIntent: " - + "Failed to delete dataItem: " + dataItemUri); - } else if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Successfully deleted data item: " + dataItemUri); - } - } else { - Log.e(TAG, "Failed to delete data item: " + dataItemUri - + " - Client disconnected from Google Play Services"); - } - mGoogleApiClient.disconnect(); - } - - /** - * Helper method to create confirmation animations on the wearable. - * @param animationType Defined by constants in ConfirmationActivity. - * @param message The message to display with the animation. - */ - private void startConfirmationActivity(int animationType, String message) { - Intent confirmationActivity = new Intent(this, ConfirmationActivity.class) - .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION) - .putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, animationType) - .putExtra(ConfirmationActivity.EXTRA_MESSAGE, message); - startActivity(confirmationActivity); - } - - @Override - public void onConnected(Bundle connectionHint) { - } - - @Override - public void onConnectionSuspended(int cause) { - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - } - -} diff --git a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/Constants.java b/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/Constants.java deleted file mode 100644 index ef6e8c6ed..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/Constants.java +++ /dev/null @@ -1,38 +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.geofencing; - -/** Constants used in wearable app. */ -public final class Constants { - - private Constants() { - } - - public static final String TAG = "ExampleGeofencingApp"; - - // Timeout for making a connection to GoogleApiClient (in milliseconds). - public static final long CONNECTION_TIME_OUT_MS = 100; - - public static final int NOTIFICATION_ID = 1; - public static final String ANDROID_BUILDING_ID = "1"; - public static final String YERBA_BUENA_ID = "2"; - - public static final String ACTION_CHECK_IN = "check_in"; - public static final String ACTION_DELETE_DATA_ITEM = "delete_data_item"; - public static final String KEY_GEOFENCE_ID = "geofence_id"; - -} diff --git a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/HomeListenerService.java b/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/HomeListenerService.java deleted file mode 100644 index 415fc46aa..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/java/com/example/android/wearable/geofencing/HomeListenerService.java +++ /dev/null @@ -1,152 +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.geofencing; - -import static com.example.android.wearable.geofencing.Constants.ACTION_CHECK_IN; -import static com.example.android.wearable.geofencing.Constants.ACTION_DELETE_DATA_ITEM; -import static com.example.android.wearable.geofencing.Constants.ANDROID_BUILDING_ID; -import static com.example.android.wearable.geofencing.Constants.KEY_GEOFENCE_ID; -import static com.example.android.wearable.geofencing.Constants.NOTIFICATION_ID; -import static com.example.android.wearable.geofencing.Constants.TAG; -import static com.example.android.wearable.geofencing.Constants.YERBA_BUENA_ID; - -import android.app.Notification; -import android.app.Notification.Action; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Intent; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.net.Uri; -import android.text.Spannable; -import android.text.SpannableString; -import android.text.style.RelativeSizeSpan; -import android.util.Log; - -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.DataItem; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.WearableListenerService; - -/** - * Listens to DataItem events on the wearable device. - */ -public class HomeListenerService extends WearableListenerService { - - private GoogleApiClient mGoogleApiClient; - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this.getApplicationContext()) - .addApi(Wearable.API) - .build(); - mGoogleApiClient.connect(); - } - - /** - * Listen for DataItems added/deleted from the geofence service running on the companion. - */ - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "onDataChanged: " + dataEvents + " for " + getPackageName()); - } - for (DataEvent event : dataEvents) { - if (event.getType() == DataEvent.TYPE_DELETED) { - cancelNotificationForDataItem(event.getDataItem()); - } else if (event.getType() == DataEvent.TYPE_CHANGED) { - // The user has entered a geofence - post a notification! - String geofenceId = DataMap.fromByteArray(event.getDataItem().getData()) - .getString(KEY_GEOFENCE_ID); - postNotificationForGeofenceId(geofenceId, event.getDataItem().getUri()); - } - } - dataEvents.close(); - } - - /** - * Deletes the check-in notification when the DataItem is deleted. - * @param dataItem Used only for logging in this sample, but could be used to identify which - * notification to cancel (in this case, there is at most 1 notification). - */ - private void cancelNotificationForDataItem(DataItem dataItem) { - if (Log.isLoggable(TAG, Log.VERBOSE)) { - Log.v(TAG, "onDataItemDeleted:DataItem=" + dataItem.getUri()); - } - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(NOTIFICATION_ID); - } - - /** - * Posts a local notification for the given geofence id, with an option to check in. - * @param geofenceId The geofence id that the user has triggered. - * @param dataItemUri The Uri for the DataItem that triggered this notification. Used to delete - * this DataItem when the notification is dismissed. - */ - private void postNotificationForGeofenceId(String geofenceId, Uri dataItemUri) { - // Use the geofenceId to determine the title and background of the check-in notification. - // A SpannableString is used for the notification title for resizing capabilities. - SpannableString checkInTitle; - Bitmap notificationBackground; - if (ANDROID_BUILDING_ID.equals(geofenceId)) { - checkInTitle = new SpannableString(getText(R.string.android_building_title)); - notificationBackground = - BitmapFactory.decodeResource(getResources(), R.drawable.android_building); - } else if (YERBA_BUENA_ID.equals(geofenceId)) { - checkInTitle = new SpannableString(getText(R.string.yerba_buena_title)); - notificationBackground = - BitmapFactory.decodeResource(getResources(), R.drawable.yerba_buena); - } else { - Log.e(TAG, "Unrecognized geofence id: " + geofenceId); - return; - } - // Resize the title to avoid truncation. - checkInTitle.setSpan(new RelativeSizeSpan(0.8f), 0, checkInTitle.length(), - Spannable.SPAN_POINT_MARK); - - Intent checkInOperation = - new Intent(this, CheckInAndDeleteDataItemsService.class).setData(dataItemUri); - PendingIntent checkInIntent = PendingIntent.getService(this, 0, - checkInOperation.setAction(ACTION_CHECK_IN), PendingIntent.FLAG_CANCEL_CURRENT); - PendingIntent deleteDataItemIntent = PendingIntent.getService(this, 1, - checkInOperation.setAction(ACTION_DELETE_DATA_ITEM), - PendingIntent.FLAG_CANCEL_CURRENT); - // This action will be embedded into the notification. - Action checkInAction = new Action(R.drawable.ic_action_check_in, - getText(R.string.check_in_prompt), checkInIntent); - - Notification notification = new Notification.Builder(this) - .setContentTitle(checkInTitle) - .setContentText(getText(R.string.check_in_prompt)) - .setSmallIcon(R.drawable.ic_launcher) - .setDeleteIntent(deleteDataItemIntent) - .extend(new Notification.WearableExtender() - .setBackground(notificationBackground) - .addAction(checkInAction) - .setContentAction(0) - .setHintHideIcon(true)) - .setLocalOnly(true) - .build(); - - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(NOTIFICATION_ID, notification); - } - -} diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_action_check_in.png b/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_action_check_in.png Binary files differdeleted file mode 100644 index f94a1c4c9..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_action_check_in.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 4e3e000b0..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/Geofencing/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index b405cb2e8..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/android_building.png b/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/android_building.png Binary files differdeleted file mode 100644 index 2a28bd425..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/android_building.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/yerba_buena.png b/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/yerba_buena.png Binary files differdeleted file mode 100644 index 04f39f87f..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-nodpi/yerba_buena.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 61f9d889c..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 81c10085a..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Geofencing/Wearable/src/main/res/values/strings.xml b/samples/wearable/Geofencing/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 49fb2b324..000000000 --- a/samples/wearable/Geofencing/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,23 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - <string name="app_name">Android Wear Geofencing Example Application</string> - <string name="android_building_title">Android Building</string> - <string name="yerba_buena_title">Yerba Buena Gardens</string> - <string name="check_in_prompt">Check in here?</string> - <string name="check_in_success">Checked In</string> -</resources> diff --git a/samples/wearable/Geofencing/_index.html b/samples/wearable/Geofencing/_index.html deleted file mode 100644 index 220fc55b3..000000000 --- a/samples/wearable/Geofencing/_index.html +++ /dev/null @@ -1,17 +0,0 @@ -<p><b>About:</b> When a user enters the vicinity of the Android building (B44) or the Yerba Buena -Gardens near the Moscone center in San Francisco, a notification silently appears on his/her -wearable with an option to check in. This notification automatically disappears when he/she leaves -the area, and reappears the next time he/she is at one of these locations.</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. Then, start "Android Wear Geofencing Example Application" on the companion. You will -automatically be notified on the wearable if you enter one of the two specified areas, assuming -you have your phone on you.</p> -<p><b>Wearable APIs used:</b> DataApi, WearableListenerService</p> -<p><b>Other APIs used:</b> Play Services API used for Geofencing (Geofence and LocationClient)</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/android_building_check_in.png" alt="Check in?" width="160" - height="160"> - <figcaption>Notification that appears when you arrive at the Android building.</figcaption> - </figure> -</p> diff --git a/samples/wearable/Geofencing/build.gradle b/samples/wearable/Geofencing/build.gradle deleted file mode 100644 index d3c8c5971..000000000 --- a/samples/wearable/Geofencing/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -}
\ No newline at end of file diff --git a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/Geofencing/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/Geofencing/gradlew b/samples/wearable/Geofencing/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/Geofencing/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/Geofencing/gradlew.bat b/samples/wearable/Geofencing/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/Geofencing/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Geofencing/screenshots/android_building_check_in.png b/samples/wearable/Geofencing/screenshots/android_building_check_in.png Binary files differdeleted file mode 100644 index 5101e772c..000000000 --- a/samples/wearable/Geofencing/screenshots/android_building_check_in.png +++ /dev/null diff --git a/samples/wearable/Geofencing/settings.gradle b/samples/wearable/Geofencing/settings.gradle deleted file mode 100644 index f3f25a547..000000000 --- a/samples/wearable/Geofencing/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Wearable', 'Application' diff --git a/samples/wearable/GridViewPager/Wearable/build.gradle b/samples/wearable/GridViewPager/Wearable/build.gradle deleted file mode 100644 index b9450ca9a..000000000 --- a/samples/wearable/GridViewPager/Wearable/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile "com.google.android.support:wearable:1.0.+" -} diff --git a/samples/wearable/GridViewPager/Wearable/proguard-rules.txt b/samples/wearable/GridViewPager/Wearable/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/GridViewPager/Wearable/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/GridViewPager/Wearable/src/main/AndroidManifest.xml b/samples/wearable/GridViewPager/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 12b8f3ba2..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,37 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.gridviewpager" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light" > - <activity - android:name="com.example.android.wearable.gridviewpager.MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/MainActivity.java b/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/MainActivity.java deleted file mode 100644 index 20751a309..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/MainActivity.java +++ /dev/null @@ -1,56 +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.gridviewpager; - -import android.app.Activity; -import android.content.res.Resources; -import android.os.Bundle; -import android.support.wearable.view.GridViewPager; -import android.view.View; -import android.view.View.OnApplyWindowInsetsListener; -import android.view.WindowInsets; - -public class MainActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - final Resources res = getResources(); - final GridViewPager pager = (GridViewPager) findViewById(R.id.pager); - pager.setOnApplyWindowInsetsListener(new OnApplyWindowInsetsListener() { - @Override - public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { - // Adjust page margins: - // A little extra horizontal spacing between pages looks a bit - // less crowded on a round display. - final boolean round = insets.isRound(); - int rowMargin = res.getDimensionPixelOffset(R.dimen.page_row_margin); - int colMargin = res.getDimensionPixelOffset(round ? - R.dimen.page_column_margin_round : R.dimen.page_column_margin); - pager.setPageMargins(rowMargin, colMargin); - - // GridViewPager relies on insets to properly handle - // layout for round displays. They must be explicitly - // applied since this listener has taken them over. - pager.onApplyWindowInsets(insets); - return insets; - } - }); - pager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager())); - } -} diff --git a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/SampleGridPagerAdapter.java b/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/SampleGridPagerAdapter.java deleted file mode 100644 index 8f9bcf961..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/java/com/example/android/wearable/gridviewpager/SampleGridPagerAdapter.java +++ /dev/null @@ -1,134 +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.gridviewpager; - -import android.app.Fragment; -import android.app.FragmentManager; -import android.content.Context; -import android.support.wearable.view.CardFragment; -import android.support.wearable.view.FragmentGridPagerAdapter; -import android.support.wearable.view.ImageReference; -import android.view.Gravity; - -/** - * Constructs fragments as requested by the GridViewPager. For each row a - * different background is provided. - */ -public class SampleGridPagerAdapter extends FragmentGridPagerAdapter { - - private final Context mContext; - - public SampleGridPagerAdapter(Context ctx, FragmentManager fm) { - super(fm); - mContext = ctx; - } - - static final int[] BG_IMAGES = new int[] { - R.drawable.debug_background_1, - R.drawable.debug_background_2, - R.drawable.debug_background_3, - R.drawable.debug_background_4, - R.drawable.debug_background_5 - }; - - /** A simple container for static data in each page */ - private static class Page { - int titleRes; - int textRes; - int iconRes; - int cardGravity = Gravity.BOTTOM; - boolean expansionEnabled = true; - float expansionFactor = 1.0f; - int expansionDirection = CardFragment.EXPAND_DOWN; - - public Page(int titleRes, int textRes, boolean expansion) { - this(titleRes, textRes, 0); - this.expansionEnabled = expansion; - } - - public Page(int titleRes, int textRes, boolean expansion, float expansionFactor) { - this(titleRes, textRes, 0); - this.expansionEnabled = expansion; - this.expansionFactor = expansionFactor; - } - - public Page(int titleRes, int textRes, int iconRes) { - this.titleRes = titleRes; - this.textRes = textRes; - this.iconRes = iconRes; - } - - public Page(int titleRes, int textRes, int iconRes, int gravity) { - this.titleRes = titleRes; - this.textRes = textRes; - this.iconRes = iconRes; - this.cardGravity = gravity; - } - } - - private final Page[][] PAGES = { - { - new Page(R.string.welcome_title, R.string.welcome_text, R.drawable.bugdroid, - Gravity.CENTER_VERTICAL), - }, - { - new Page(R.string.about_title, R.string.about_text, false), - }, - { - new Page(R.string.cards_title, R.string.cards_text, true, 2), - new Page(R.string.expansion_title, R.string.expansion_text, true, 10), - }, - { - new Page(R.string.backgrounds_title, R.string.backgrounds_text, true, 2), - new Page(R.string.columns_title, R.string.columns_text, true, 2) - }, - { - new Page(R.string.dismiss_title, R.string.dismiss_text, R.drawable.bugdroid, - Gravity.CENTER_VERTICAL), - }, - - }; - - @Override - public Fragment getFragment(int row, int col) { - Page page = PAGES[row][col]; - String title = page.titleRes != 0 ? mContext.getString(page.titleRes) : null; - String text = page.textRes != 0 ? mContext.getString(page.textRes) : null; - CardFragment fragment = CardFragment.create(title, text, page.iconRes); - // Advanced settings - fragment.setCardGravity(page.cardGravity); - fragment.setExpansionEnabled(page.expansionEnabled); - fragment.setExpansionDirection(page.expansionDirection); - fragment.setExpansionFactor(page.expansionFactor); - return fragment; - } - - @Override - public ImageReference getBackground(int row, int column) { - return ImageReference.forDrawable(BG_IMAGES[row % BG_IMAGES.length]); - } - - @Override - public int getRowCount() { - return PAGES.length; - } - - @Override - public int getColumnCount(int rowNum) { - return PAGES[rowNum].length; - } -} diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/bugdroid.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/bugdroid.png Binary files differdeleted file mode 100644 index 7cbe66153..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/bugdroid.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 589f229d1..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_left.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_left.png Binary files differdeleted file mode 100644 index 88a497f81..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_left.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_right.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_right.png Binary files differdeleted file mode 100644 index 5bf0e477e..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_right.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_up.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_up.png Binary files differdeleted file mode 100644 index 9a3256a67..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-hdpi/ic_swipe_arrow_up.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/bugdroid.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/bugdroid.png Binary files differdeleted file mode 100644 index 8bf759608..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/bugdroid.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 77dd57139..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_left.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_left.png Binary files differdeleted file mode 100644 index ba36d9dea..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_left.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_right.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_right.png Binary files differdeleted file mode 100644 index e5930ac8c..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_right.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_up.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_up.png Binary files differdeleted file mode 100644 index 5ded1c36b..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-mdpi/ic_swipe_arrow_up.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index fe34ebe13..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_left.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_left.png Binary files differdeleted file mode 100644 index f02901b6d..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_left.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_right.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_right.png Binary files differdeleted file mode 100644 index 154a87e0b..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_right.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_up.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_up.png Binary files differdeleted file mode 100644 index e99d98273..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xhdpi/ic_swipe_arrow_up.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_1.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_1.png Binary files differdeleted file mode 100644 index 7e6437bb4..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_1.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_2.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_2.png Binary files differdeleted file mode 100644 index 4fdc5c9a0..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_2.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_3.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_3.png Binary files differdeleted file mode 100644 index 20faf46a9..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_3.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_4.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_4.png Binary files differdeleted file mode 100644 index 1fd25c68d..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_4.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_5.png b/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_5.png Binary files differdeleted file mode 100644 index eecdb2cd7..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/drawable/debug_background_5.png +++ /dev/null diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/layout/activity_main.xml b/samples/wearable/GridViewPager/Wearable/src/main/res/layout/activity_main.xml deleted file mode 100644 index abc3b30e1..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,22 +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. ---> - -<android.support.wearable.view.GridViewPager - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/pager" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:keepScreenOn="true" /> diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/values/dimens.xml b/samples/wearable/GridViewPager/Wearable/src/main/res/values/dimens.xml deleted file mode 100644 index 47ab217e1..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/values/dimens.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <dimen name="page_row_margin">100dp</dimen> - <dimen name="page_column_margin">10dp</dimen> - <dimen name="page_column_margin_round">50dp</dimen> -</resources> diff --git a/samples/wearable/GridViewPager/Wearable/src/main/res/values/strings.xml b/samples/wearable/GridViewPager/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 404119bc3..000000000 --- a/samples/wearable/GridViewPager/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,56 +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. ---> - -<resources> - - <string name="app_name">GridViewPager Sample</string> - <string name="welcome_title">GridViewPager</string> - <string name="welcome_text">Welcome!</string> - - <string name="about_title">About</string> - <string name="about_text">Content is organized into multiple pages. Swipe - between cards to view other content.</string> - - <string name="cards_title">Cards</string> - <string name="cards_text">Each page is created using a CardFragment. A - layout is placed inside the card and the rest is handled - automatically.</string> - - <string name="expansion_title">Expansion</string> - <string name="expansion_text">By default, each card will grow taller to - accommodate extra content. Tall cards can be scrolled through - like any scrollable view. The maximum height is controlled by - setExpansionFactor() with a default of 10 pages. After that - you\'ll notice a faded edge to indicate there is more. Expansion - can be disabled completely using setExpansionEnabled(false). - With this, the content will be clipped if it\'s taller than one - page.</string> - - <string name="backgrounds_title">Backgrounds</string> - <string name="backgrounds_text">Backgrounds are supplied by the adapter\'s - getBackground method. Parallax and crossfade effects are applied - automatically.</string> - - <string name="columns_title">Columns</string> - <string name="columns_text">When moving between rows, the pager always - returns to column 0. This is adjustable in the adapter. See - method getCurrentColumnForRow().</string> - - <string name="dismiss_title">Dismiss</string> - <string name="dismiss_text">To exit the application, swipe from left to - right.</string> - -</resources> diff --git a/samples/wearable/GridViewPager/_index.html b/samples/wearable/GridViewPager/_index.html deleted file mode 100644 index 5f7aa63de..000000000 --- a/samples/wearable/GridViewPager/_index.html +++ /dev/null @@ -1,12 +0,0 @@ -<p><b>About:</b> Demonstrates how to implement a GridViewPager in your wearable app.</p> -<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by -saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select -"GridViewPager Sample" from the submenu.</p> -<p><b>Wearable APIs used:</b> GridViewPager, CardFragment, FragmentGridPagerAdapter, -ImageReference</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/grid_view_pager.gif" alt="GridViewPager" width="140" height="140"> - <figcaption>Part of the sample in action.</figcaption> - </figure> -</p> diff --git a/samples/wearable/GridViewPager/build.gradle b/samples/wearable/GridViewPager/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/GridViewPager/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/GridViewPager/gradle.properties b/samples/wearable/GridViewPager/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/GridViewPager/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/GridViewPager/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/GridViewPager/gradlew b/samples/wearable/GridViewPager/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/GridViewPager/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/GridViewPager/gradlew.bat b/samples/wearable/GridViewPager/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/GridViewPager/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/GridViewPager/screenshots/grid_view_pager.gif b/samples/wearable/GridViewPager/screenshots/grid_view_pager.gif Binary files differdeleted file mode 100644 index f70dafcec..000000000 --- a/samples/wearable/GridViewPager/screenshots/grid_view_pager.gif +++ /dev/null diff --git a/samples/wearable/GridViewPager/settings.gradle b/samples/wearable/GridViewPager/settings.gradle deleted file mode 100644 index d804d8be7..000000000 --- a/samples/wearable/GridViewPager/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Wearable' diff --git a/samples/wearable/JumpingJack/Wearable/build.gradle b/samples/wearable/JumpingJack/Wearable/build.gradle deleted file mode 100644 index 531f41a01..000000000 --- a/samples/wearable/JumpingJack/Wearable/build.gradle +++ /dev/null @@ -1,33 +0,0 @@ -apply plugin: 'android' - -repositories { - mavenCentral() -} - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } - - lintOptions { - abortOnError false - } -} - -dependencies { - compile 'com.google.android.gms:play-services-wearable:+' - compile "com.google.android.support:wearable:1.0.+" -} diff --git a/samples/wearable/JumpingJack/Wearable/proguard-rules.txt b/samples/wearable/JumpingJack/Wearable/proguard-rules.txt deleted file mode 100644 index 0cc65eeb3..000000000 --- a/samples/wearable/JumpingJack/Wearable/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#}
\ No newline at end of file diff --git a/samples/wearable/JumpingJack/Wearable/src/main/AndroidManifest.xml b/samples/wearable/JumpingJack/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index cf3ee0687..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,39 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.jumpingjack"> - - <uses-feature android:name="android.hardware.type.watch" /> - - <uses-permission android:name="android.permission.VIBRATE"/> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light"> - <activity - android:name=".MainActivity" - android:label="@string/app_name"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/MainActivity.java b/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/MainActivity.java deleted file mode 100644 index cdaaf6ec7..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/MainActivity.java +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2014 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.jumpingjack; - -import com.example.android.wearable.jumpingjack.fragments.CounterFragment; -import com.example.android.wearable.jumpingjack.fragments.SettingsFragment; - -import android.app.Activity; -import android.content.Context; -import android.hardware.Sensor; -import android.hardware.SensorEvent; -import android.hardware.SensorEventListener; -import android.hardware.SensorManager; -import android.os.Bundle; -import android.os.Handler; -import android.support.v4.view.ViewPager; -import android.util.Log; -import android.view.WindowManager; -import android.widget.ImageView; - -import java.util.Timer; -import java.util.TimerTask; - -/** - * The main activity for the Jumping Jack application. This activity registers itself to receive - * sensor values. Since on wearable devices a full screen activity is very short-lived, we set the - * FLAG_KEEP_SCREEN_ON to give user adequate time for taking actions but since we don't want to - * keep screen on for an extended period of time, there is a SCREEN_ON_TIMEOUT_MS that is enforced - * if no interaction is discovered. - * - * This activity includes a {@link android.support.v4.view.ViewPager} with two pages, one that - * shows the current count and one that allows user to reset the counter. the current value of the - * counter is persisted so that upon re-launch, the counter picks up from the last value. At any - * stage, user can set this counter to 0. - */ -public class MainActivity extends Activity - implements SensorEventListener { - - private static final String TAG = "JJMainActivity"; - - /** How long to keep the screen on when no activity is happening **/ - private static final long SCREEN_ON_TIMEOUT_MS = 20000; // in milliseconds - - /** an up-down movement that takes more than this will not be registered as such **/ - private static final long TIME_THRESHOLD_NS = 2000000000; // in nanoseconds (= 2sec) - - /** - * Earth gravity is around 9.8 m/s^2 but user may not completely direct his/her hand vertical - * during the exercise so we leave some room. Basically if the x-component of gravity, as - * measured by the Gravity sensor, changes with a variation (delta) > GRAVITY_THRESHOLD, - * we consider that a successful count. - */ - private static final float GRAVITY_THRESHOLD = 7.0f; - - private SensorManager mSensorManager; - private Sensor mSensor; - private long mLastTime = 0; - private boolean mUp = false; - private int mJumpCounter = 0; - private ViewPager mPager; - private CounterFragment mCounterPage; - private SettingsFragment mSettingPage; - private ImageView mSecondIndicator; - private ImageView mFirstIndicator; - private Timer mTimer; - private TimerTask mTimerTask; - private Handler mHandler; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.jj_layout); - setupViews(); - mHandler = new Handler(); - mJumpCounter = Utils.getCounterFromPreference(this); - getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - renewTimer(); - mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); - mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY); - } - - private void setupViews() { - mPager = (ViewPager) findViewById(R.id.pager); - mFirstIndicator = (ImageView) findViewById(R.id.indicator_0); - mSecondIndicator = (ImageView) findViewById(R.id.indicator_1); - final PagerAdapter adapter = new PagerAdapter(getFragmentManager()); - mCounterPage = new CounterFragment(); - mSettingPage = new SettingsFragment(this); - adapter.addFragment(mCounterPage); - adapter.addFragment(mSettingPage); - setIndicator(0); - mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int i, float v, int i2) { - } - - @Override - public void onPageSelected(int i) { - setIndicator(i); - renewTimer(); - } - - @Override - public void onPageScrollStateChanged(int i) { - } - }); - - mPager.setAdapter(adapter); - } - - @Override - protected void onResume() { - super.onResume(); - if (mSensorManager.registerListener(this, mSensor, - SensorManager.SENSOR_DELAY_NORMAL)) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Successfully registered for the sensor updates"); - } - } - } - - @Override - protected void onPause() { - super.onPause(); - mSensorManager.unregisterListener(this); - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Unregistered for sensor events"); - } - } - - @Override - public void onSensorChanged(SensorEvent event) { - detectJump(event.values[0], event.timestamp); - } - - @Override - public void onAccuracyChanged(Sensor sensor, int accuracy) { - } - - /** - * A simple algorithm to detect a successful up-down movement of hand(s). The algorithm is - * based on the assumption that when a person is wearing the watch, the x-component of gravity - * as measured by the Gravity Sensor is +9.8 when the hand is downward and -9.8 when the hand - * is upward (signs are reversed if the watch is worn on the right hand). Since the upward or - * downward may not be completely accurate, we leave some room and instead of 9.8, we use - * GRAVITY_THRESHOLD. We also consider the up <-> down movement successful if it takes less than - * TIME_THRESHOLD_NS. - */ - private void detectJump(float xValue, long timestamp) { - if ((Math.abs(xValue) > GRAVITY_THRESHOLD)) { - if(timestamp - mLastTime < TIME_THRESHOLD_NS && mUp != (xValue > 0)) { - onJumpDetected(!mUp); - } - mUp = xValue > 0; - mLastTime = timestamp; - } - } - - /** - * Called on detection of a successful down -> up or up -> down movement of hand. - */ - private void onJumpDetected(boolean up) { - // we only count a pair of up and down as one successful movement - if (up) { - return; - } - mJumpCounter++; - setCounter(mJumpCounter); - renewTimer(); - } - - /** - * Updates the counter on UI, saves it to preferences and vibrates the watch when counter - * reaches a multiple of 10. - */ - private void setCounter(int i) { - mCounterPage.setCounter(i); - Utils.saveCounterToPreference(this, i); - if (i > 0 && i % 10 == 0) { - Utils.vibrate(this, 0); - } - } - - public void resetCounter() { - setCounter(0); - renewTimer(); - } - - /** - * Starts a timer to clear the flag FLAG_KEEP_SCREEN_ON. - */ - private void renewTimer() { - if (null != mTimer) { - mTimer.cancel(); - } - mTimerTask = new TimerTask() { - @Override - public void run() { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, - "Removing the FLAG_KEEP_SCREEN_ON flag to allow going to background"); - } - resetFlag(); - } - }; - mTimer = new Timer(); - mTimer.schedule(mTimerTask, SCREEN_ON_TIMEOUT_MS); - } - - /** - * Resets the FLAG_KEEP_SCREEN_ON flag so activity can go into background. - */ - private void resetFlag() { - mHandler.post(new Runnable() { - @Override - public void run() { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Resetting FLAG_KEEP_SCREEN_ON flag to allow going to background"); - } - getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - finish(); - } - }); - } - - /** - * Sets the page indicator for the ViewPager. - */ - private void setIndicator(int i) { - switch (i) { - case 0: - mFirstIndicator.setImageResource(R.drawable.full_10); - mSecondIndicator.setImageResource(R.drawable.empty_10); - break; - case 1: - mFirstIndicator.setImageResource(R.drawable.empty_10); - mSecondIndicator.setImageResource(R.drawable.full_10); - break; - } - } - - -} diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/PagerAdapter.java b/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/PagerAdapter.java deleted file mode 100644 index f7ac2b010..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/PagerAdapter.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2014 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.jumpingjack; - -import android.app.Fragment; -import android.app.FragmentManager; -import android.support.v13.app.FragmentPagerAdapter; - -import java.util.ArrayList; -import java.util.List; - -/** - * A simple adapter for the {@link android.support.v4.view.ViewPager} - */ -public class PagerAdapter extends FragmentPagerAdapter { - - List<Fragment> mFragments = null; - - public PagerAdapter(FragmentManager fm) { - super(fm); - mFragments = new ArrayList<Fragment>(); - } - - @Override - public Fragment getItem(int position) { - return mFragments.get(position); - } - - @Override - public int getCount() { - return mFragments.size(); - } - - public void addFragment(Fragment fragment) { - mFragments.add(fragment); - notifyDataSetChanged(); - } -} diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/Utils.java b/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/Utils.java deleted file mode 100644 index 4db66c9a8..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/Utils.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2014 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.jumpingjack; - -import android.content.Context; -import android.content.SharedPreferences; -import android.os.Vibrator; -import android.preference.PreferenceManager; - -/** - * A utility class for some helper methods. - */ -public class Utils { - - private static final int DEFAULT_VIBRATION_DURATION_MS = 200; // in millis - private static final String PREF_KEY_COUNTER = "counter"; - - /** - * Causes device to vibrate for the given duration (in millis). If duration is set to 0, then it - * will use the <code>DEFAULT_VIBRATION_DURATION_MS</code>. - */ - public final static void vibrate(Context context, int duration) { - if (duration == 0) { - duration = DEFAULT_VIBRATION_DURATION_MS; - } - Vibrator v = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); - v.vibrate(duration); - } - - /** - * Saves the counter value in the preference storage. If <code>value</code> - * is negative, then the value will be removed from the preferences. - */ - public static void saveCounterToPreference(Context context, int value) { - SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); - if (value < 0) { - // we want to remove - pref.edit().remove(PREF_KEY_COUNTER).apply(); - } else { - pref.edit().putInt(PREF_KEY_COUNTER, value).apply(); - } - } - - /** - * Retrieves the value of counter from preference manager. If no value exists, it will return - * <code>0</code>. - */ - public static int getCounterFromPreference(Context context) { - SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(context); - return pref.getInt(PREF_KEY_COUNTER, 0); - } - -} diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/CounterFragment.java b/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/CounterFragment.java deleted file mode 100644 index c55eb9b04..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/CounterFragment.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2014 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.jumpingjack.fragments; - -import com.example.android.wearable.jumpingjack.R; -import com.example.android.wearable.jumpingjack.Utils; - -import android.app.Fragment; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.os.Handler; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.TextView; - -import java.util.Timer; -import java.util.TimerTask; - -/** - * A simple fragment for showing the count - */ -public class CounterFragment extends Fragment { - - private static final long ANIMATION_INTERVAL_MS = 500; // in milliseconds - private TextView mCounterText; - private Timer mAnimationTimer; - private Handler mHandler; - private TimerTask mAnimationTask; - private boolean up = false; - private Drawable mDownDrawable; - private Drawable mUpDrawable; - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.counter_layout, container, false); - mDownDrawable = getResources().getDrawable(R.drawable.jump_down_50); - mUpDrawable = getResources().getDrawable(R.drawable.jump_up_50); - mCounterText = (TextView) view.findViewById(R.id.counter); - mCounterText.setCompoundDrawablesWithIntrinsicBounds(mUpDrawable, null, null, null); - setCounter(Utils.getCounterFromPreference(getActivity())); - mHandler = new Handler(); - startAnimation(); - return view; - } - - private void startAnimation() { - mAnimationTask = new TimerTask() { - @Override - public void run() { - mHandler.post(new Runnable() { - @Override - public void run() { - mCounterText.setCompoundDrawablesWithIntrinsicBounds( - up ? mUpDrawable : mDownDrawable, null, null, null); - up = !up; - } - }); - } - }; - mAnimationTimer = new Timer(); - mAnimationTimer.scheduleAtFixedRate(mAnimationTask, ANIMATION_INTERVAL_MS, - ANIMATION_INTERVAL_MS); - } - - public void setCounter(String text) { - mCounterText.setText(text); - } - - public void setCounter(int i) { - setCounter(i < 0 ? "0" : String.valueOf(i)); - } - - @Override - public void onDetach() { - mAnimationTimer.cancel(); - super.onDetach(); - } -} diff --git a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/SettingsFragment.java b/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/SettingsFragment.java deleted file mode 100644 index fffe8fb71..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/java/com/example/android/wearable/jumpingjack/fragments/SettingsFragment.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2014 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.jumpingjack.fragments; - -import com.example.android.wearable.jumpingjack.MainActivity; -import com.example.android.wearable.jumpingjack.R; - -import android.app.Fragment; -import android.os.Bundle; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.Button; - -/** - * A simple fragment that shows a button to reset the counter - */ -public class SettingsFragment extends Fragment { - - private Button mButton; - private MainActivity mMainActivity; - - public SettingsFragment(MainActivity mainActivity) { - mMainActivity = mainActivity; - } - - @Override - public View onCreateView(LayoutInflater inflater, ViewGroup container, - Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.setting_layout, container, false); - mButton = (Button) view.findViewById(R.id.btn); - mButton.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mMainActivity.resetCounter(); - } - }); - return view; - } - -} diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_normal_200.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_normal_200.png Binary files differdeleted file mode 100644 index e58520274..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_normal_200.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_pressed_200.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_pressed_200.png Binary files differdeleted file mode 100644 index 0b83b6d66..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/btn_reset_pressed_200.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 2d0c37d0e..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 3211c9e8b..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 4ead8a29f..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 8b357e4d5..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxxhdpi/ic_launcher.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index da3c00a9a..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable-xxxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/empty_10.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/empty_10.png Binary files differdeleted file mode 100644 index 78ee76bb1..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/empty_10.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/full_10.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/full_10.png Binary files differdeleted file mode 100644 index 53b799ebc..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/full_10.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_down_50.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_down_50.png Binary files differdeleted file mode 100644 index 28980f808..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_down_50.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_up_50.png b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_up_50.png Binary files differdeleted file mode 100644 index 86dcef593..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/jump_up_50.png +++ /dev/null diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/submit_button.xml b/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/submit_button.xml deleted file mode 100644 index 2ab9ba565..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/drawable/submit_button.xml +++ /dev/null @@ -1,23 +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. ---> - -<selector xmlns:android="http://schemas.android.com/apk/res/android"> - <item android:drawable="@drawable/btn_reset_pressed_200" - android:state_pressed="true" /> - <item android:drawable="@drawable/btn_reset_pressed_200" - android:state_focused="true" /> - <item android:drawable="@drawable/btn_reset_normal_200" /> -</selector> diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/counter_layout.xml b/samples/wearable/JumpingJack/Wearable/src/main/res/layout/counter_layout.xml deleted file mode 100644 index e443e342b..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/counter_layout.xml +++ /dev/null @@ -1,29 +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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/white"> - - <TextView - android:id="@+id/counter" - android:layout_centerInParent="true" - android:textSize="50sp" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - -</RelativeLayout> diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/jj_layout.xml b/samples/wearable/JumpingJack/Wearable/src/main/res/layout/jj_layout.xml deleted file mode 100644 index 73af6e318..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/jj_layout.xml +++ /dev/null @@ -1,49 +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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/white"> - - <android.support.v4.view.ViewPager - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/pager" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="#000" - /> - - <LinearLayout - android:layout_alignParentBottom="true" - android:layout_centerHorizontal="true" - android:layout_marginBottom="10dp" - android:layout_width="wrap_content" - android:layout_height="wrap_content"> - <ImageView - android:id="@+id/indicator_0" - android:layout_marginRight="5dp" - android:src="@drawable/full_10" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - <ImageView - android:id="@+id/indicator_1" - android:src="@drawable/empty_10" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - </LinearLayout> - -</RelativeLayout> diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/setting_layout.xml b/samples/wearable/JumpingJack/Wearable/src/main/res/layout/setting_layout.xml deleted file mode 100644 index 129840958..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/layout/setting_layout.xml +++ /dev/null @@ -1,40 +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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/white"> - - <Button - android:id="@+id/btn" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" - android:layout_marginTop="40dp" - android:layout_width="75dp" - android:layout_height="75dp" - android:background="@drawable/submit_button"/> - - <TextView - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_below="@+id/btn" - android:layout_marginTop="5dp" - android:gravity="center" - android:textColor="@color/blue" - android:text="@string/reset_counter"/> - -</RelativeLayout> diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/values/colors.xml b/samples/wearable/JumpingJack/Wearable/src/main/res/values/colors.xml deleted file mode 100644 index eccbe6d75..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/values/colors.xml +++ /dev/null @@ -1,20 +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. ---> - -<resources> - <color name="white">#ffffff</color> - <color name="blue">#3f51b5</color> -</resources> diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/values/dimens.xml b/samples/wearable/JumpingJack/Wearable/src/main/res/values/dimens.xml deleted file mode 100644 index a1e9cfe8a..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/values/dimens.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> -</resources> diff --git a/samples/wearable/JumpingJack/Wearable/src/main/res/values/strings.xml b/samples/wearable/JumpingJack/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 8ab0f86aa..000000000 --- a/samples/wearable/JumpingJack/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,22 +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. ---> - -<resources> - - <string name="app_name">Jumping Jack</string> - <string name="reset_counter">Reset Counter</string> - -</resources> diff --git a/samples/wearable/JumpingJack/_index.html b/samples/wearable/JumpingJack/_index.html deleted file mode 100644 index 3f4c26a4e..000000000 --- a/samples/wearable/JumpingJack/_index.html +++ /dev/null @@ -1,10 +0,0 @@ -<p><b>About:</b> Uses the Gravity sensor to count how many jumping jacks you've performed.</p> -<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by -saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select - "Jumping Jack" from the submenu.</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/jumping_jack.gif" alt="JumpingJack" width="140" height="140"> - <figcaption>JumpingJack has a simple interface.</figcaption> - </figure> -</p> diff --git a/samples/wearable/JumpingJack/build.gradle b/samples/wearable/JumpingJack/build.gradle deleted file mode 100644 index 43dbcd071..000000000 --- a/samples/wearable/JumpingJack/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} - diff --git a/samples/wearable/JumpingJack/gradle.properties b/samples/wearable/JumpingJack/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/JumpingJack/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/JumpingJack/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/JumpingJack/gradlew b/samples/wearable/JumpingJack/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/JumpingJack/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/JumpingJack/gradlew.bat b/samples/wearable/JumpingJack/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/JumpingJack/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/JumpingJack/license.txt b/samples/wearable/JumpingJack/license.txt deleted file mode 100644 index 1555b526f..000000000 --- a/samples/wearable/JumpingJack/license.txt +++ /dev/null @@ -1,5 +0,0 @@ -The Jumping Jack icons used in this app have been created by Jasper Reyes -(http://thenounproject.com/term/jumping-jack/26440/) and Co-Effect Creative -(http://thenounproject.com/term/exercise/15085/) from The Noun Project and are used under the -Creative Commons (CC By 3.0) license - diff --git a/samples/wearable/JumpingJack/proguard-rules.txt b/samples/wearable/JumpingJack/proguard-rules.txt deleted file mode 100644 index 0cc65eeb3..000000000 --- a/samples/wearable/JumpingJack/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#}
\ No newline at end of file diff --git a/samples/wearable/JumpingJack/screenshots/jumping_jack.gif b/samples/wearable/JumpingJack/screenshots/jumping_jack.gif Binary files differdeleted file mode 100644 index 86c4faa71..000000000 --- a/samples/wearable/JumpingJack/screenshots/jumping_jack.gif +++ /dev/null diff --git a/samples/wearable/JumpingJack/settings.gradle b/samples/wearable/JumpingJack/settings.gradle deleted file mode 100644 index 1d97d30e1..000000000 --- a/samples/wearable/JumpingJack/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':Wearable' diff --git a/samples/wearable/Notifications/Application/build.gradle b/samples/wearable/Notifications/Application/build.gradle deleted file mode 100644 index b705deabc..000000000 --- a/samples/wearable/Notifications/Application/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -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.+" - wearApp project(':Wearable') -} diff --git a/samples/wearable/Notifications/Application/proguard-rules.txt b/samples/wearable/Notifications/Application/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/Notifications/Application/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/Notifications/Application/src/main/AndroidManifest.xml b/samples/wearable/Notifications/Application/src/main/AndroidManifest.xml deleted file mode 100644 index ecf00362b..000000000 --- a/samples/wearable/Notifications/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,47 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.support.wearable.notifications" > - - <application - android:allowBackup="true" - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme" > - - <activity - android:name=".MainActivity" - android:label="@string/app_name" - android:windowSoftInputMode="stateHidden" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - - <receiver android:name=".NotificationIntentReceiver" - android:exported="false"> - <intent-filter> - <action android:name="com.example.android.support.wearable.notifications.ACTION_EXAMPLE" /> - <action android:name="com.example.android.support.wearable.notifications.ACTION_ENABLE_MESSAGES" /> - <action android:name="com.example.android.support.wearable.notifications.ACTION_DISABLE_MESSAGES" /> - </intent-filter> - </receiver> - - </application> - -</manifest> diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPreset.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPreset.java deleted file mode 100644 index a550912df..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPreset.java +++ /dev/null @@ -1,33 +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.support.wearable.notifications; - -import android.content.Context; -import android.support.v4.app.NotificationCompat; - -/** - * Base class for notification actions presets. - */ -public abstract class ActionsPreset extends NamedPreset { - public ActionsPreset(int nameResId) { - super(nameResId); - } - - /** Apply the priority to a notification builder */ - public abstract void apply(Context context, NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions); -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPresets.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPresets.java deleted file mode 100644 index ff639dcb9..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/ActionsPresets.java +++ /dev/null @@ -1,158 +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.support.wearable.notifications; - -import android.content.Context; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.RemoteInput; - -/** - * Collection of notification actions presets. - */ -public class ActionsPresets { - public static final ActionsPreset NO_ACTIONS_PRESET = new NoActionsPreset(); - public static final ActionsPreset SINGLE_ACTION_PRESET = new SingleActionPreset(); - - public static final ActionsPreset[] PRESETS = new ActionsPreset[] { - NO_ACTIONS_PRESET, - SINGLE_ACTION_PRESET, - new ReplyActionPreset(), - new ReplyWithChoicesActionPreset(), - new DifferentActionsOnPhoneAndWearable(), - new LongTitleActionPreset() - }; - - private static class NoActionsPreset extends ActionsPreset { - public NoActionsPreset() { - super(R.string.no_actions); - } - - @Override - public void apply(Context context, NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions) { - } - } - - private static class SingleActionPreset extends ActionsPreset { - public SingleActionPreset() { - super(R.string.single_action); - } - - @Override - public void apply(Context context, NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions) { - builder.addAction(R.drawable.ic_full_action, - context.getString(R.string.example_action), - NotificationUtil.getExamplePendingIntent(context, - R.string.example_action_clicked)) - .build(); - } - } - - private static class LongTitleActionPreset extends ActionsPreset { - public LongTitleActionPreset() { - super(R.string.long_title_action); - } - - @Override - public void apply(Context context, NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions) { - builder.addAction(R.drawable.ic_full_action, - context.getString(R.string.example_action_long_title), - NotificationUtil.getExamplePendingIntent(context, - R.string.example_action_clicked)) - .build(); - } - } - - private static class ReplyActionPreset extends ActionsPreset { - public ReplyActionPreset() { - super(R.string.reply_action); - } - - @Override - public void apply(Context context, NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions) { - RemoteInput remoteInput = new RemoteInput.Builder(NotificationUtil.EXTRA_REPLY) - .setLabel(context.getString(R.string.example_reply_label)) - .build(); - NotificationCompat.Action action = new NotificationCompat.Action.Builder( - R.drawable.ic_full_reply, - context.getString(R.string.example_reply_action), - NotificationUtil.getExamplePendingIntent(context, - R.string.example_reply_action_clicked)) - .addRemoteInput(remoteInput) - .build(); - builder.addAction(action); - } - } - - private static class ReplyWithChoicesActionPreset extends ActionsPreset { - public ReplyWithChoicesActionPreset() { - super(R.string.reply_action_with_choices); - } - - @Override - public void apply(Context context, NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions) { - RemoteInput remoteInput = new RemoteInput.Builder(NotificationUtil.EXTRA_REPLY) - .setLabel(context.getString(R.string.example_reply_answer_label)) - .setChoices(new String[] { context.getString(R.string.yes), - context.getString(R.string.no), context.getString(R.string.maybe) }) - .build(); - NotificationCompat.Action action = new NotificationCompat.Action.Builder( - R.drawable.ic_full_reply, - context.getString(R.string.example_reply_action), - NotificationUtil.getExamplePendingIntent(context, - R.string.example_reply_action_clicked)) - .addRemoteInput(remoteInput) - .build(); - wearableOptions.addAction(action); - } - } - - private static class DifferentActionsOnPhoneAndWearable extends ActionsPreset { - public DifferentActionsOnPhoneAndWearable() { - super(R.string.different_actions_on_phone_and_wearable); - } - - @Override - public void apply(Context context, NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions) { - NotificationCompat.Action phoneAction = new NotificationCompat.Action.Builder( - R.drawable.ic_full_action, - context.getString(R.string.phone_action), - NotificationUtil.getExamplePendingIntent(context, - R.string.phone_action_clicked)) - .build(); - builder.addAction(phoneAction); - - RemoteInput remoteInput = new RemoteInput.Builder(NotificationUtil.EXTRA_REPLY) - .setLabel(context.getString(R.string.example_reply_label)) - .build(); - - NotificationCompat.Action wearableAction = new NotificationCompat.Action.Builder( - R.drawable.ic_full_reply, - context.getString(R.string.wearable_action), - NotificationUtil.getExamplePendingIntent(context, - R.string.wearable_action_clicked)) - .addRemoteInput(remoteInput) - .build(); - wearableOptions.addAction(wearableAction); - } - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/BackgroundPickers.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/BackgroundPickers.java deleted file mode 100644 index aedd548df..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/BackgroundPickers.java +++ /dev/null @@ -1,140 +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.support.wearable.notifications; - -import android.content.Context; -import android.content.res.Resources; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import java.util.ArrayList; -import java.util.List; - -/** - * Manages the background image pickers. - */ -public class BackgroundPickers { - - public interface OnBackgroundPickersChangedListener { - public void onBackgroundPickersChanged(BackgroundPickers pickers); - } - - private final ViewGroup mContainer; - private final OnPickedListener mOnPickedListener; - private final List<ViewGroup> mPickers; - private final OnBackgroundPickersChangedListener listener; - - public BackgroundPickers(ViewGroup container, OnBackgroundPickersChangedListener listener) { - this.mContainer = container; - this.mOnPickedListener = new OnPickedListener(); - this.mPickers = new ArrayList<ViewGroup>(); - this.listener = listener; - } - - /** - * Generates the pickers as necessary. - */ - public void generatePickers(int count) { - // Clear existing containers. - clear(); - - // Fill in new pickers. - LayoutInflater inflater = LayoutInflater.from(mContainer.getContext()); - Resources res = mContainer.getResources(); - for (int i = 0; i < count; i++) { - View picker = inflater.inflate(R.layout.background_picker, mContainer, false); - TextView label = (TextView) picker.findViewById(R.id.bg_picker_label); - label.setText(String.format(res.getString(R.string.bg_picker_label), i+1)); - ViewGroup pickerBox = (ViewGroup) picker.findViewById(R.id.bg_picker_container); - mPickers.add(pickerBox); - for (int j = 0; j < pickerBox.getChildCount(); j++) { - ImageView img = (ImageView) pickerBox.getChildAt(j); - img.setOnClickListener(mOnPickedListener); - } - mContainer.addView(picker); - } - } - - /** - * Returns the background resource for the picker at the given index. - * @param position Index of the background picker. - * @return Id of the background image resource. null if no image is picked. - */ - public Integer getRes(int position) { - String tag = (String) mPickers.get(position).getTag(); - if (tag == null) { - return null; - } - - Context context = mContainer.getContext(); - return context.getResources().getIdentifier(tag, "drawable", context.getPackageName()); - } - - /** - * Returns the all the background resources for the pickers managed by this object. Returns null - * if no pickers exist. - */ - public Integer[] getRes() { - if (mPickers.size() == 0) { - return null; - } - - Integer[] res = new Integer[mPickers.size()]; - for (int i = 0; i < mPickers.size(); i++) { - res[i] = getRes(i); - } - return res; - } - - /** - * Clears the pickers. - */ - public void clear() { - mContainer.removeAllViews(); - mPickers.clear(); - } - - public int getCount() { - return mPickers.size(); - } - - private class OnPickedListener implements View.OnClickListener { - - @Override - public void onClick(View view) { - ImageView pickedView = (ImageView) view; - ViewGroup pickerBox = (ViewGroup) view.getParent(); - - // Clear old selection. - for (int i = 0; i < pickerBox.getChildCount(); i++) { - ImageView childView = (ImageView) pickerBox.getChildAt(i); - childView.setBackgroundResource(R.drawable.unselected_background); - } - - // Set new selection. - pickedView.setBackgroundResource(R.drawable.selected_background); - pickerBox.setTag(pickedView.getTag()); - - if (listener != null) { - listener.onBackgroundPickersChanged(BackgroundPickers.this); - } - } - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java deleted file mode 100644 index 8543c7736..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java +++ /dev/null @@ -1,352 +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.support.wearable.notifications; - -import android.app.Activity; -import android.app.Notification; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.os.Handler; -import android.os.Message; -import android.support.v4.app.NotificationManagerCompat; -import android.text.Editable; -import android.text.TextWatcher; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ArrayAdapter; -import android.widget.CheckBox; -import android.widget.CompoundButton; -import android.widget.EditText; -import android.widget.Spinner; -import android.widget.TextView; - -import java.util.Arrays; - -/** - * Main activity which posts a notification when resumed, and allows customization - * of that notification via controls. - */ -public class MainActivity extends Activity implements Handler.Callback { - private static final int MSG_POST_NOTIFICATIONS = 0; - private static final long POST_NOTIFICATIONS_DELAY_MS = 200; - - private Handler mHandler; - private Spinner mPresetSpinner; - private EditText mTitleEditText; - private EditText mTextEditText; - private TextWatcher mTextChangedListener; - private Spinner mPrioritySpinner; - private Spinner mActionsSpinner; - private CheckBox mIncludeLargeIconCheckbox; - private CheckBox mLocalOnlyCheckbox; - private CheckBox mIncludeContentIntentCheckbox; - private CheckBox mVibrateCheckbox; - private BackgroundPickers mBackgroundPickers; - private int postedNotificationCount = 0; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - mHandler = new Handler(this); - mTextChangedListener = new UpdateNotificationsOnTextChangeListener(); - - initPresetSpinner(); - initTitleEditText(); - initTextEditText(); - initPrioritySpinner(); - initActionsSpinner(); - initIncludeLargeIconCheckbox(); - initLocalOnlyCheckbox(); - initIncludeContentIntentCheckbox(); - initVibrateCheckbox(); - initBackgroundPickers(); - - NotificationPreset preset = NotificationPresets.PRESETS[ - mPresetSpinner.getSelectedItemPosition()]; - updateTextEditors(preset); - } - - @Override - protected void onResume() { - super.onResume(); - updateNotifications(false /* cancelExisting */); - } - - private void initPresetSpinner() { - mPresetSpinner = (Spinner) findViewById(R.id.preset_spinner); - mPresetSpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this, - NotificationPresets.PRESETS)); - mPresetSpinner.post(new Runnable() { - @Override - public void run() { - mPresetSpinner.setOnItemSelectedListener(new PresetSpinnerListener()); - } - }); - } - - private void initTitleEditText() { - mTitleEditText = (EditText) findViewById(R.id.title_editor); - } - - private void initTextEditText() { - mTextEditText = (EditText) findViewById(R.id.text_editor); - } - - private void initPrioritySpinner() { - mPrioritySpinner = (Spinner) findViewById(R.id.priority_spinner); - mPrioritySpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this, - PriorityPresets.PRESETS)); - mPrioritySpinner.setSelection(Arrays.asList(PriorityPresets.PRESETS) - .indexOf(PriorityPresets.DEFAULT)); - mPrioritySpinner.post(new Runnable() { - @Override - public void run() { - mPrioritySpinner.setOnItemSelectedListener( - new UpdateNotificationsOnItemSelectedListener(true /* cancelExisting */)); - } - }); - } - - private void initActionsSpinner() { - mActionsSpinner = (Spinner) findViewById(R.id.actions_spinner); - mActionsSpinner.setAdapter(new NamedPresetSpinnerArrayAdapter(this, - ActionsPresets.PRESETS)); - mActionsSpinner.post(new Runnable() { - @Override - public void run() { - mActionsSpinner.setOnItemSelectedListener( - new UpdateNotificationsOnItemSelectedListener(false /* cancelExisting */)); - } - }); - } - - private void initIncludeLargeIconCheckbox() { - mIncludeLargeIconCheckbox = (CheckBox) findViewById(R.id.include_large_icon_checkbox); - mIncludeLargeIconCheckbox.setOnCheckedChangeListener( - new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */)); - } - - private void initLocalOnlyCheckbox() { - mLocalOnlyCheckbox = (CheckBox) findViewById(R.id.local_only_checkbox); - mLocalOnlyCheckbox.setOnCheckedChangeListener( - new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */)); - } - - private void initIncludeContentIntentCheckbox() { - mIncludeContentIntentCheckbox = (CheckBox) findViewById( - R.id.include_content_intent_checkbox); - mIncludeContentIntentCheckbox.setOnCheckedChangeListener( - new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */)); - } - - private void initVibrateCheckbox() { - mVibrateCheckbox = (CheckBox) findViewById(R.id.vibrate_checkbox); - mVibrateCheckbox.setOnCheckedChangeListener( - new UpdateNotificationsOnCheckedChangeListener(false /* cancelExisting */)); - } - - private void initBackgroundPickers() { - mBackgroundPickers = new BackgroundPickers( - (ViewGroup) findViewById(R.id.background_pickers), - new BackgroundPickerListener()); - } - - private void updateTextEditors(NotificationPreset preset) { - if (preset == NotificationPresets.BASIC) { - findViewById(R.id.title_edit_field).setVisibility(View.VISIBLE); - mTitleEditText.setText(getString(preset.titleResId)); - mTitleEditText.addTextChangedListener(mTextChangedListener); - findViewById(R.id.text_edit_field).setVisibility(View.VISIBLE); - mTextEditText.setText(getString(preset.textResId)); - mTextEditText.addTextChangedListener(mTextChangedListener); - } else { - findViewById(R.id.title_edit_field).setVisibility(View.GONE); - mTitleEditText.removeTextChangedListener(mTextChangedListener); - findViewById(R.id.text_edit_field).setVisibility(View.GONE); - mTextEditText.removeTextChangedListener(mTextChangedListener); - } - } - - /** - * Begin to re-post the sample notification(s). - */ - private void updateNotifications(boolean cancelExisting) { - // Disable messages to skip notification deleted messages during cancel. - sendBroadcast(new Intent(NotificationIntentReceiver.ACTION_DISABLE_MESSAGES) - .setClass(this, NotificationIntentReceiver.class)); - - if (cancelExisting) { - // Cancel all existing notifications to trigger fresh-posting behavior: For example, - // switching from HIGH to LOW priority does not cause a reordering in Notification Shade. - NotificationManagerCompat.from(this).cancelAll(); - postedNotificationCount = 0; - - // Post the updated notifications on a delay to avoid a cancel+post race condition - // with notification manager. - mHandler.removeMessages(MSG_POST_NOTIFICATIONS); - mHandler.sendEmptyMessageDelayed(MSG_POST_NOTIFICATIONS, POST_NOTIFICATIONS_DELAY_MS); - } else { - postNotifications(); - } - } - - /** - * Post the sample notification(s) using current options. - */ - private void postNotifications() { - sendBroadcast(new Intent(NotificationIntentReceiver.ACTION_ENABLE_MESSAGES) - .setClass(this, NotificationIntentReceiver.class)); - - NotificationPreset preset = NotificationPresets.PRESETS[ - mPresetSpinner.getSelectedItemPosition()]; - CharSequence titlePreset = mTitleEditText.getText(); - CharSequence textPreset = mTextEditText.getText(); - PriorityPreset priorityPreset = PriorityPresets.PRESETS[ - mPrioritySpinner.getSelectedItemPosition()]; - ActionsPreset actionsPreset = ActionsPresets.PRESETS[ - mActionsSpinner.getSelectedItemPosition()]; - if (preset.actionsRequired() && actionsPreset == ActionsPresets.NO_ACTIONS_PRESET) { - // If actions are required, but the no-actions preset was selected, change presets. - actionsPreset = ActionsPresets.SINGLE_ACTION_PRESET; - mActionsSpinner.setSelection(Arrays.asList(ActionsPresets.PRESETS).indexOf( - actionsPreset), true); - } - NotificationPreset.BuildOptions options = new NotificationPreset.BuildOptions( - titlePreset, - textPreset, - priorityPreset, - actionsPreset, - mIncludeLargeIconCheckbox.isChecked(), - mLocalOnlyCheckbox.isChecked(), - mIncludeContentIntentCheckbox.isChecked(), - mVibrateCheckbox.isChecked(), - mBackgroundPickers.getRes()); - Notification[] notifications = preset.buildNotifications(this, options); - - // Post new notifications - for (int i = 0; i < notifications.length; i++) { - NotificationManagerCompat.from(this).notify(i, notifications[i]); - } - // Cancel any that are beyond the current count. - for (int i = notifications.length; i < postedNotificationCount; i++) { - NotificationManagerCompat.from(this).cancel(i); - } - postedNotificationCount = notifications.length; - } - - @Override - public boolean handleMessage(Message message) { - switch (message.what) { - case MSG_POST_NOTIFICATIONS: - postNotifications(); - return true; - } - return false; - } - - private class PresetSpinnerListener implements AdapterView.OnItemSelectedListener { - @Override - public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { - NotificationPreset preset = NotificationPresets.PRESETS[position]; - mBackgroundPickers.generatePickers(preset.countBackgroundPickersRequired()); - updateTextEditors(preset); - updateNotifications(false /* cancelExisting */); - } - - @Override - public void onNothingSelected(AdapterView<?> adapterView) { - } - } - - private class UpdateNotificationsOnTextChangeListener implements TextWatcher { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - } - - public void onTextChanged(CharSequence s, int start, int before, int count) { - } - - @Override - public void afterTextChanged(Editable s) { - updateNotifications(false /* cancelExisting */); - } - } - - private class UpdateNotificationsOnItemSelectedListener - implements AdapterView.OnItemSelectedListener { - private final boolean mCancelExisting; - - public UpdateNotificationsOnItemSelectedListener(boolean cancelExisting) { - mCancelExisting = cancelExisting; - } - @Override - public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { - updateNotifications(mCancelExisting); - } - - @Override - public void onNothingSelected(AdapterView<?> adapterView) { - } - } - - private class UpdateNotificationsOnCheckedChangeListener - implements CompoundButton.OnCheckedChangeListener { - private final boolean mCancelExisting; - - public UpdateNotificationsOnCheckedChangeListener(boolean cancelExisting) { - mCancelExisting = cancelExisting; - } - - @Override - public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - updateNotifications(mCancelExisting); - } - } - - private class BackgroundPickerListener - implements BackgroundPickers.OnBackgroundPickersChangedListener { - @Override - public void onBackgroundPickersChanged(BackgroundPickers pickers) { - updateNotifications(false /* cancelExisting */); - } - } - - private class NamedPresetSpinnerArrayAdapter extends ArrayAdapter<NamedPreset> { - public NamedPresetSpinnerArrayAdapter(Context context, NamedPreset[] presets) { - super(context, R.layout.simple_spinner_item, presets); - } - - @Override - public View getDropDownView(int position, View convertView, ViewGroup parent) { - TextView view = (TextView) super.getDropDownView(position, convertView, parent); - view.setText(getString(getItem(position).nameResId)); - return view; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - TextView view = (TextView) getLayoutInflater().inflate( - android.R.layout.simple_spinner_item, parent, false); - view.setText(getString(getItem(position).nameResId)); - return view; - } - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NamedPreset.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NamedPreset.java deleted file mode 100644 index afc5f169d..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NamedPreset.java +++ /dev/null @@ -1,28 +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.support.wearable.notifications; - -/** - * Base class for presets that have a simple name to display. - */ -public abstract class NamedPreset { - public final int nameResId; - - public NamedPreset(int nameResId) { - this.nameResId = nameResId; - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationIntentReceiver.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationIntentReceiver.java deleted file mode 100644 index 39a1c7850..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationIntentReceiver.java +++ /dev/null @@ -1,60 +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.support.wearable.notifications; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; -import android.support.v4.app.RemoteInput; -import android.widget.Toast; - -/** - * Broadcast receiver to post toast messages in response to notification intents firing. - */ -public class NotificationIntentReceiver extends BroadcastReceiver { - public static final String ACTION_EXAMPLE = - "com.example.android.support.wearable.notifications.ACTION_EXAMPLE"; - public static final String ACTION_ENABLE_MESSAGES = - "com.example.android.support.wearable.notifications.ACTION_ENABLE_MESSAGES"; - public static final String ACTION_DISABLE_MESSAGES = - "com.example.android.support.wearable.notifications.ACTION_DISABLE_MESSAGES"; - - private boolean mEnableMessages = true; - - @Override - public void onReceive(Context context, Intent intent) { - if (intent.getAction().equals(ACTION_EXAMPLE)) { - if (mEnableMessages) { - String message = intent.getStringExtra(NotificationUtil.EXTRA_MESSAGE); - Bundle remoteInputResults = RemoteInput.getResultsFromIntent(intent); - CharSequence replyMessage = null; - if (remoteInputResults != null) { - replyMessage = remoteInputResults.getCharSequence(NotificationUtil.EXTRA_REPLY); - } - if (replyMessage != null) { - message = message + ": \"" + replyMessage + "\""; - } - Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); - } - } else if (intent.getAction().equals(ACTION_ENABLE_MESSAGES)) { - mEnableMessages = true; - } else if (intent.getAction().equals(ACTION_DISABLE_MESSAGES)) { - mEnableMessages = false; - } - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java deleted file mode 100644 index a0dff1874..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java +++ /dev/null @@ -1,74 +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.support.wearable.notifications; - -import android.app.Notification; -import android.content.Context; - -/** - * Base class for notification preset generators. - */ -public abstract class NotificationPreset extends NamedPreset { - public final int titleResId; - public final int textResId; - - public NotificationPreset(int nameResId, int titleResId, int textResId) { - super(nameResId); - this.titleResId = titleResId; - this.textResId = textResId; - } - - public static class BuildOptions { - public final CharSequence titlePreset; - public final CharSequence textPreset; - public final PriorityPreset priorityPreset; - public final ActionsPreset actionsPreset; - public final boolean includeLargeIcon; - public final boolean isLocalOnly; - public final boolean hasContentIntent; - public final boolean vibrate; - public final Integer[] backgroundIds; - - public BuildOptions(CharSequence titlePreset, CharSequence textPreset, - PriorityPreset priorityPreset, ActionsPreset actionsPreset, - boolean includeLargeIcon, boolean isLocalOnly, boolean hasContentIntent, - boolean vibrate, Integer[] backgroundIds) { - this.titlePreset = titlePreset; - this.textPreset = textPreset; - this.priorityPreset = priorityPreset; - this.actionsPreset = actionsPreset; - this.includeLargeIcon = includeLargeIcon; - this.isLocalOnly = isLocalOnly; - this.hasContentIntent = hasContentIntent; - this.vibrate = vibrate; - this.backgroundIds = backgroundIds; - } - } - - /** Build a notification with this preset and the provided options */ - public abstract Notification[] buildNotifications(Context context, BuildOptions options); - - /** Whether actions are required to use this preset. */ - public boolean actionsRequired() { - return false; - } - - /** Number of background pickers required */ - public int countBackgroundPickersRequired() { - return 0; - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java deleted file mode 100644 index e175d1120..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java +++ /dev/null @@ -1,479 +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.support.wearable.notifications; - -import android.app.Notification; -import android.content.Context; -import android.graphics.BitmapFactory; -import android.graphics.Color; -import android.graphics.Typeface; -import android.support.v4.app.NotificationCompat; -import android.text.SpannableStringBuilder; -import android.text.style.ForegroundColorSpan; -import android.text.style.RelativeSizeSpan; -import android.text.style.StrikethroughSpan; -import android.text.style.StyleSpan; -import android.text.style.SubscriptSpan; -import android.text.style.SuperscriptSpan; -import android.text.style.TypefaceSpan; -import android.text.style.UnderlineSpan; -import android.view.Gravity; - -/** - * Collection of notification builder presets. - */ -public class NotificationPresets { - private static final String EXAMPLE_GROUP_KEY = "example"; - - public static final NotificationPreset BASIC = new BasicNotificationPreset(); - public static final NotificationPreset STYLIZED_TEXT = new StylizedTextNotificationPreset(); - public static final NotificationPreset INBOX = new InboxNotificationPreset(); - public static final NotificationPreset BIG_PICTURE = new BigPictureNotificationPreset(); - public static final NotificationPreset BIG_TEXT = new BigTextNotificationPreset(); - public static final NotificationPreset BOTTOM_ALIGNED = new BottomAlignedNotificationPreset(); - public static final NotificationPreset GRAVITY = new GravityNotificationPreset(); - public static final NotificationPreset CONTENT_ACTION = new ContentActionNotificationPreset(); - public static final NotificationPreset CONTENT_ICON = new ContentIconNotificationPreset(); - public static final NotificationPreset MULTIPLE_PAGE = new MultiplePageNotificationPreset(); - public static final NotificationPreset BUNDLE = new NotificationBundlePreset(); - - public static final NotificationPreset[] PRESETS = new NotificationPreset[] { - BASIC, - STYLIZED_TEXT, - INBOX, - BIG_PICTURE, - BIG_TEXT, - BOTTOM_ALIGNED, - GRAVITY, - CONTENT_ACTION, - CONTENT_ICON, - MULTIPLE_PAGE, - BUNDLE - }; - - private static NotificationCompat.Builder applyBasicOptions(Context context, - NotificationCompat.Builder builder, NotificationCompat.WearableExtender wearableOptions, - NotificationPreset.BuildOptions options) { - builder.setContentTitle(options.titlePreset) - .setContentText(options.textPreset) - .setSmallIcon(R.mipmap.ic_launcher) - .setDeleteIntent(NotificationUtil.getExamplePendingIntent( - context, R.string.example_notification_deleted)); - options.actionsPreset.apply(context, builder, wearableOptions); - options.priorityPreset.apply(builder, wearableOptions); - if (options.includeLargeIcon) { - builder.setLargeIcon(BitmapFactory.decodeResource( - context.getResources(), R.drawable.example_large_icon)); - } - if (options.isLocalOnly) { - builder.setLocalOnly(true); - } - if (options.hasContentIntent) { - builder.setContentIntent(NotificationUtil.getExamplePendingIntent(context, - R.string.content_intent_clicked)); - } - if (options.vibrate) { - builder.setVibrate(new long[] {0, 100, 50, 100} ); - } - return builder; - } - - private static class BasicNotificationPreset extends NotificationPreset { - public BasicNotificationPreset() { - super(R.string.basic_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, builder, wearableOptions, options); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - } - - private static class StylizedTextNotificationPreset extends NotificationPreset { - public StylizedTextNotificationPreset() { - super(R.string.stylized_text_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle(); - - SpannableStringBuilder title = new SpannableStringBuilder(); - appendStyled(title, "Stylized", new StyleSpan(Typeface.BOLD_ITALIC)); - title.append(" title"); - SpannableStringBuilder text = new SpannableStringBuilder("Stylized text: "); - appendStyled(text, "C", new ForegroundColorSpan(Color.RED)); - appendStyled(text, "O", new ForegroundColorSpan(Color.GREEN)); - appendStyled(text, "L", new ForegroundColorSpan(Color.BLUE)); - appendStyled(text, "O", new ForegroundColorSpan(Color.YELLOW)); - appendStyled(text, "R", new ForegroundColorSpan(Color.MAGENTA)); - appendStyled(text, "S", new ForegroundColorSpan(Color.CYAN)); - text.append("; "); - appendStyled(text, "1.25x size", new RelativeSizeSpan(1.25f)); - text.append("; "); - appendStyled(text, "0.75x size", new RelativeSizeSpan(0.75f)); - text.append("; "); - appendStyled(text, "underline", new UnderlineSpan()); - text.append("; "); - appendStyled(text, "strikethrough", new StrikethroughSpan()); - text.append("; "); - appendStyled(text, "bold", new StyleSpan(Typeface.BOLD)); - text.append("; "); - appendStyled(text, "italic", new StyleSpan(Typeface.ITALIC)); - text.append("; "); - appendStyled(text, "sans-serif-thin", new TypefaceSpan("sans-serif-thin")); - text.append("; "); - appendStyled(text, "monospace", new TypefaceSpan("monospace")); - text.append("; "); - appendStyled(text, "sub", new SubscriptSpan()); - text.append("script"); - appendStyled(text, "super", new SuperscriptSpan()); - - style.setBigContentTitle(title); - style.bigText(text); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context) - .setStyle(style); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, builder, wearableOptions, options); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - - private void appendStyled(SpannableStringBuilder builder, String str, Object... spans) { - builder.append(str); - for (Object span : spans) { - builder.setSpan(span, builder.length() - str.length(), builder.length(), 0); - } - } - } - - private static class InboxNotificationPreset extends NotificationPreset { - public InboxNotificationPreset() { - super(R.string.inbox_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); - style.addLine(context.getString(R.string.inbox_style_example_line1)); - style.addLine(context.getString(R.string.inbox_style_example_line2)); - style.addLine(context.getString(R.string.inbox_style_example_line3)); - style.setBigContentTitle(context.getString(R.string.inbox_style_example_title)); - style.setSummaryText(context.getString(R.string.inbox_style_example_summary_text)); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context) - .setStyle(style); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, builder, wearableOptions, options); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - } - - private static class BigPictureNotificationPreset extends NotificationPreset { - public BigPictureNotificationPreset() { - super(R.string.big_picture_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle(); - style.bigPicture(BitmapFactory.decodeResource(context.getResources(), - R.drawable.example_big_picture)); - style.setBigContentTitle(context.getString(R.string.big_picture_style_example_title)); - style.setSummaryText(context.getString( - R.string.big_picture_style_example_summary_text)); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context) - .setStyle(style); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, builder, wearableOptions, options); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - } - - private static class BigTextNotificationPreset extends NotificationPreset { - public BigTextNotificationPreset() { - super(R.string.big_text_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle(); - style.bigText(context.getString(R.string.big_text_example_big_text)); - style.setBigContentTitle(context.getString(R.string.big_text_example_title)); - style.setSummaryText(context.getString(R.string.big_text_example_summary_text)); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context) - .setStyle(style); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, builder, wearableOptions, options); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - } - - private static class BottomAlignedNotificationPreset extends NotificationPreset { - public BottomAlignedNotificationPreset() { - super(R.string.bottom_aligned_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, builder, wearableOptions, options); - - NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context); - secondPageBuilder.setContentTitle( - context.getString(R.string.second_page_content_title)); - secondPageBuilder.setContentText(context.getString(R.string.big_text_example_big_text)); - secondPageBuilder.extend(new NotificationCompat.WearableExtender() - .setStartScrollBottom(true)); - - wearableOptions.addPage(secondPageBuilder.build()); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - } - - private static class GravityNotificationPreset extends NotificationPreset { - public GravityNotificationPreset() { - super(R.string.gravity_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, builder, wearableOptions, options); - - NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context) - .setContentTitle(options.titlePreset) - .setContentText(options.textPreset) - .extend(new NotificationCompat.WearableExtender() - .setGravity(Gravity.CENTER_VERTICAL)); - wearableOptions.addPage(secondPageBuilder.build()); - - NotificationCompat.Builder thirdPageBuilder = new NotificationCompat.Builder(context) - .setContentTitle(options.titlePreset) - .setContentText(options.textPreset) - .extend(new NotificationCompat.WearableExtender() - .setGravity(Gravity.TOP)); - wearableOptions.addPage(thirdPageBuilder.build()); - - wearableOptions.setGravity(Gravity.BOTTOM); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - } - - private static class ContentActionNotificationPreset extends NotificationPreset { - public ContentActionNotificationPreset() { - super(R.string.content_action_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - Notification secondPage = new NotificationCompat.Builder(context) - .setContentTitle(context.getString(R.string.second_page_content_title)) - .setContentText(context.getString(R.string.second_page_content_text)) - .extend(new NotificationCompat.WearableExtender() - .setContentAction(1)) - .build(); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - NotificationCompat.Action action = new NotificationCompat.Action.Builder( - R.drawable.ic_result_open, null, NotificationUtil.getExamplePendingIntent( - context, R.string.example_content_action_clicked)).build(); - NotificationCompat.Action action2 = new NotificationCompat.Action.Builder( - R.drawable.ic_result_open, null, NotificationUtil.getExamplePendingIntent( - context, R.string.example_content_action2_clicked)).build(); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender() - .addAction(action) - .addAction(action2) - .addPage(secondPage) - .setContentAction(0) - .setHintHideIcon(true); - applyBasicOptions(context, builder, wearableOptions, options); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - - @Override - public boolean actionsRequired() { - return true; - } - } - - private static class ContentIconNotificationPreset extends NotificationPreset { - public ContentIconNotificationPreset() { - super(R.string.content_icon_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - Notification secondPage = new NotificationCompat.Builder(context) - .setContentTitle(context.getString(R.string.second_page_content_title)) - .setContentText(context.getString(R.string.second_page_content_text)) - .extend(new NotificationCompat.WearableExtender() - .setContentIcon(R.drawable.content_icon_small) - .setContentIconGravity(Gravity.START)) - .build(); - - Notification thirdPage = new NotificationCompat.Builder(context) - .setContentTitle(context.getString(R.string.third_page_content_title)) - .setContentText(context.getString(R.string.third_page_content_text)) - .extend(new NotificationCompat.WearableExtender() - .setContentIcon(R.drawable.content_icon_large)) - .build(); - - Notification fourthPage = new NotificationCompat.Builder(context) - .setContentTitle(context.getString(R.string.fourth_page_content_title)) - .setContentText(context.getString(R.string.fourth_page_content_text)) - .extend(new NotificationCompat.WearableExtender() - .setContentIcon(R.drawable.content_icon_large) - .setContentIconGravity(Gravity.START)) - .build(); - - NotificationCompat.Builder builder = new NotificationCompat.Builder(context); - NotificationCompat.WearableExtender wearableOptions = - new NotificationCompat.WearableExtender() - .setHintHideIcon(true) - .setContentIcon(R.drawable.content_icon_small) - .addPage(secondPage) - .addPage(thirdPage) - .addPage(fourthPage); - applyBasicOptions(context, builder, wearableOptions, options); - builder.extend(wearableOptions); - return new Notification[] { builder.build() }; - } - } - - private static class MultiplePageNotificationPreset extends NotificationPreset { - public MultiplePageNotificationPreset() { - super(R.string.multiple_page_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.Builder secondPageBuilder = new NotificationCompat.Builder(context) - .setContentTitle(context.getString(R.string.second_page_content_title)) - .setContentText(context.getString(R.string.second_page_content_text)); - - NotificationCompat.Builder firstPageBuilder = new NotificationCompat.Builder(context); - NotificationCompat.WearableExtender firstPageWearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, firstPageBuilder, firstPageWearableOptions, options); - - Integer firstBackground = options.backgroundIds == null - ? null : options.backgroundIds[0]; - if (firstBackground != null) { - NotificationCompat.BigPictureStyle style = - new NotificationCompat.BigPictureStyle(); - style.bigPicture(BitmapFactory.decodeResource(context.getResources(), - firstBackground)); - firstPageBuilder.setStyle(style); - } - - Integer secondBackground = options.backgroundIds == null - ? null : options.backgroundIds[1]; - if (secondBackground != null) { - NotificationCompat.BigPictureStyle style = new NotificationCompat.BigPictureStyle(); - style.bigPicture(BitmapFactory.decodeResource(context.getResources(), - secondBackground)); - secondPageBuilder.setStyle(style); - } - - firstPageBuilder.extend( - firstPageWearableOptions.addPage(secondPageBuilder.build())); - - return new Notification[]{ firstPageBuilder.build() }; - } - - @Override - public int countBackgroundPickersRequired() { - return 2; // This sample does 2 pages notifications. - } - } - - private static class NotificationBundlePreset extends NotificationPreset { - public NotificationBundlePreset() { - super(R.string.bundle_example, R.string.example_content_title, - R.string.example_content_text); - } - - @Override - public Notification[] buildNotifications(Context context, BuildOptions options) { - NotificationCompat.Builder childBuilder1 = new NotificationCompat.Builder(context) - .setContentTitle(context.getString(R.string.first_child_content_title)) - .setContentText(context.getString(R.string.first_child_content_text)) - .setSmallIcon(R.mipmap.ic_launcher) - .setLocalOnly(options.isLocalOnly) - .setGroup(EXAMPLE_GROUP_KEY) - .setSortKey("0"); - - NotificationCompat.Builder childBuilder2 = new NotificationCompat.Builder(context) - .setContentTitle(context.getString(R.string.second_child_content_title)) - .setContentText(context.getString(R.string.second_child_content_text)) - .setSmallIcon(R.mipmap.ic_launcher) - .addAction(R.mipmap.ic_launcher, - context.getString(R.string.second_child_action), - NotificationUtil.getExamplePendingIntent( - context, R.string.second_child_action_clicked)) - .setLocalOnly(options.isLocalOnly) - .setGroup(EXAMPLE_GROUP_KEY) - .setSortKey("1"); - - NotificationCompat.Builder summaryBuilder = new NotificationCompat.Builder(context) - .setGroup(EXAMPLE_GROUP_KEY) - .setGroupSummary(true); - - NotificationCompat.WearableExtender summaryWearableOptions = - new NotificationCompat.WearableExtender(); - applyBasicOptions(context, summaryBuilder, summaryWearableOptions, options); - summaryBuilder.extend(summaryWearableOptions); - - return new Notification[] { summaryBuilder.build(), childBuilder1.build(), - childBuilder2.build() }; - } - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationUtil.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationUtil.java deleted file mode 100644 index 389b90a5a..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/NotificationUtil.java +++ /dev/null @@ -1,36 +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.support.wearable.notifications; - -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; - -public class NotificationUtil { - public static final String EXTRA_MESSAGE = - "com.example.android.support.wearable.notifications.MESSAGE"; - public static final String EXTRA_REPLY = - "com.example.android.support.wearable.notifications.REPLY"; - - public static PendingIntent getExamplePendingIntent(Context context, int messageResId) { - Intent intent = new Intent(NotificationIntentReceiver.ACTION_EXAMPLE) - .setClass(context, NotificationIntentReceiver.class); - intent.putExtra(EXTRA_MESSAGE, context.getString(messageResId)); - return PendingIntent.getBroadcast(context, messageResId /* requestCode */, intent, - PendingIntent.FLAG_UPDATE_CURRENT); - } -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPreset.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPreset.java deleted file mode 100644 index b4298fd30..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPreset.java +++ /dev/null @@ -1,32 +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.support.wearable.notifications; - -import android.support.v4.app.NotificationCompat; - -/** - * Base class for notification priority presets. - */ -public abstract class PriorityPreset extends NamedPreset { - public PriorityPreset(int nameResId) { - super(nameResId); - } - - /** Apply the priority to a notification builder */ - public abstract void apply(NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions); -} diff --git a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPresets.java b/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPresets.java deleted file mode 100644 index c33b59d7a..000000000 --- a/samples/wearable/Notifications/Application/src/main/java/com/example/android/support/wearable/notifications/PriorityPresets.java +++ /dev/null @@ -1,55 +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.support.wearable.notifications; - -import android.app.Notification; -import android.support.v4.app.NotificationCompat; - -/** - * Collection of notification priority presets. - */ -public class PriorityPresets { - public static final PriorityPreset DEFAULT = new SimplePriorityPreset( - R.string.default_priority, Notification.PRIORITY_DEFAULT); - - public static final PriorityPreset[] PRESETS = new PriorityPreset[] { - new SimplePriorityPreset(R.string.min_priority, Notification.PRIORITY_MIN), - new SimplePriorityPreset(R.string.low_priority, Notification.PRIORITY_LOW), - DEFAULT, - new SimplePriorityPreset(R.string.high_priority, Notification.PRIORITY_HIGH), - new SimplePriorityPreset(R.string.max_priority, Notification.PRIORITY_MAX) - }; - - /** - * Simple notification priority preset that sets a priority using - * {@link android.support.v4.app.NotificationCompat.Builder#setPriority} - */ - private static class SimplePriorityPreset extends PriorityPreset { - private final int mPriority; - - public SimplePriorityPreset(int nameResId, int priority) { - super(nameResId); - mPriority = priority; - } - - @Override - public void apply(NotificationCompat.Builder builder, - NotificationCompat.WearableExtender wearableOptions) { - builder.setPriority(mPriority); - } - } -} diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/example_large_icon.png b/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/example_large_icon.png Binary files differdeleted file mode 100644 index 545f8cecb..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/example_large_icon.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_action.png b/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_action.png Binary files differdeleted file mode 100644 index 1f274990c..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_action.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_reply.png b/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_reply.png Binary files differdeleted file mode 100644 index 66388d5fa..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_full_reply.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_result_open.png b/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_result_open.png Binary files differdeleted file mode 100644 index db8af57f7..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-hdpi/ic_result_open.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_action.png b/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_action.png Binary files differdeleted file mode 100644 index b70b74ff5..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_action.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_reply.png b/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_reply.png Binary files differdeleted file mode 100644 index 60ce9f9c5..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_full_reply.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_result_open.png b/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_result_open.png Binary files differdeleted file mode 100644 index 860d7de6c..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-mdpi/ic_result_open.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_1.png b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_1.png Binary files differdeleted file mode 100644 index 9c807946d..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_1.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_2.png b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_2.png Binary files differdeleted file mode 100644 index 23d7062b3..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_2.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_3.png b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_3.png Binary files differdeleted file mode 100644 index 588318ddd..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_3.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_4.png b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_4.png Binary files differdeleted file mode 100644 index bd1dfee00..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_4.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_5.png b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_5.png Binary files differdeleted file mode 100644 index aa1ad23af..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/bg_5.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_large.png b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_large.png Binary files differdeleted file mode 100644 index 0eab3b10a..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_large.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_small.png b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_small.png Binary files differdeleted file mode 100644 index 9a9f4b4b5..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/content_icon_small.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/example_big_picture.jpg b/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/example_big_picture.jpg Binary files differdeleted file mode 100644 index 68473ba6c..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-nodpi/example_big_picture.jpg +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_action.png b/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_action.png Binary files differdeleted file mode 100644 index 6a769521b..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_action.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_reply.png b/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_reply.png Binary files differdeleted file mode 100644 index dba6fa7b0..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_full_reply.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_result_open.png b/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_result_open.png Binary files differdeleted file mode 100644 index 7d3c785c8..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable-xhdpi/ic_result_open.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable/selected_background.xml b/samples/wearable/Notifications/Application/src/main/res/drawable/selected_background.xml deleted file mode 100644 index 5852dd89a..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable/selected_background.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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <padding - android:top="4dp" - android:bottom="4dp" - android:left="4dp" - android:right="4dp"/> - <stroke - android:width="4dp" - android:color="@android:color/holo_blue_bright" /> -</shape> diff --git a/samples/wearable/Notifications/Application/src/main/res/drawable/unselected_background.xml b/samples/wearable/Notifications/Application/src/main/res/drawable/unselected_background.xml deleted file mode 100644 index 161316759..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/drawable/unselected_background.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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <padding - android:top="4dp" - android:bottom="4dp" - android:left="4dp" - android:right="4dp"/> - <stroke - android:width="4dp" - android:color="#ff000000" /> -</shape> diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/activity_main.xml b/samples/wearable/Notifications/Application/src/main/res/layout/activity_main.xml deleted file mode 100644 index 3068ddcd6..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,173 +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. ---> - -<ScrollView 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:paddingBottom="@dimen/activity_vertical_margin" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - tools:context="com.example.android.support.wearable.notifications.MainActivity" - tools:ignore="MergeRootFrame"> - - <LinearLayout android:id="@+id/container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <include layout="@layout/layout_divider" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/preset" /> - - <Spinner android:id="@+id/preset_spinner" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/priority" /> - - <Spinner android:id="@+id/priority_spinner" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/actions" /> - - <Spinner android:id="@+id/actions_spinner" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/title_edit_field" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/title" /> - - <EditText android:id="@+id/title_editor" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/text_edit_field" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal"> - - <TextView - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:minWidth="@dimen/editor_spinner_caption_min_width" - android:minHeight="?android:attr/listPreferredItemHeightSmall" - android:gravity="center_vertical" - android:text="@string/text" /> - - <EditText android:id="@+id/text_editor" - android:layout_marginLeft="10dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" /> - - </LinearLayout> - - <CheckBox android:id="@+id/include_large_icon_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/include_large_icon" /> - - <CheckBox android:id="@+id/local_only_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/local_only" /> - - <CheckBox android:id="@+id/include_content_intent_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/include_content_intent" /> - - <CheckBox android:id="@+id/vibrate_checkbox" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_bottom" - android:text="@string/vibrate" /> - - <LinearLayout android:id="@+id/background_pickers" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - </LinearLayout> - - </LinearLayout> - -</ScrollView> diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/background_picker.xml b/samples/wearable/Notifications/Application/src/main/res/layout/background_picker.xml deleted file mode 100644 index 03f77f1c1..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/layout/background_picker.xml +++ /dev/null @@ -1,84 +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. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <TextView - android:id="@+id/bg_picker_label" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginLeft="@dimen/editor_item_padding_top" - android:paddingTop="@dimen/editor_item_padding_top" - android:paddingBottom="@dimen/editor_item_padding_top" - android:text="@string/bg_picker_label"/> - - <HorizontalScrollView - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <LinearLayout - android:id="@+id/bg_picker_container" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <ImageView - android:id="@+id/bg_none" - android:background="@drawable/selected_background" - style="@style/bg_picker" - android:layout_width="@dimen/image_picker_item_side" - android:layout_height="@dimen/image_picker_item_side" - android:src="@android:color/background_light"/> - <ImageView - android:id="@+id/bg1" - style="@style/bg_picker" - android:layout_width="@dimen/image_picker_item_side" - android:layout_height="@dimen/image_picker_item_side" - android:tag="bg_1" - android:src="@drawable/bg_1"/> - <ImageView - android:id="@+id/bg2" - style="@style/bg_picker" - android:layout_width="@dimen/image_picker_item_side" - android:layout_height="@dimen/image_picker_item_side" - android:tag="bg_2" - android:src="@drawable/bg_2"/> - <ImageView - android:id="@+id/bg3" - style="@style/bg_picker" - android:layout_width="@dimen/image_picker_item_side" - android:layout_height="@dimen/image_picker_item_side" - android:tag="bg_3" - android:src="@drawable/bg_3"/> - <ImageView - android:id="@+id/bg4" - style="@style/bg_picker" - android:layout_width="@dimen/image_picker_item_side" - android:layout_height="@dimen/image_picker_item_side" - android:tag="bg_4" - android:src="@drawable/bg_4"/> - <ImageView - android:id="@+id/bg5" - style="@style/bg_picker" - android:layout_width="@dimen/image_picker_item_side" - android:layout_height="@dimen/image_picker_item_side" - android:tag="bg_5" - android:src="@drawable/bg_5"/> - </LinearLayout> - - </HorizontalScrollView> - -</LinearLayout> diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/layout_divider.xml b/samples/wearable/Notifications/Application/src/main/res/layout/layout_divider.xml deleted file mode 100644 index 82142b7f3..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/layout/layout_divider.xml +++ /dev/null @@ -1,53 +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. ---> - -<!-- - Copyright 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. - --> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" > - - <TextView - android:id="@+id/divider_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="3dp" - android:textAllCaps="true" - android:textColor="@color/divider_text" - android:textSize="@dimen/editor_text_size" - android:text="@string/properties"/> - - <View - android:layout_width="match_parent" - android:layout_height="1dp" - android:layout_marginTop="3dp" - android:background="@color/divider_text" /> - -</LinearLayout> diff --git a/samples/wearable/Notifications/Application/src/main/res/layout/simple_spinner_item.xml b/samples/wearable/Notifications/Application/src/main/res/layout/simple_spinner_item.xml deleted file mode 100644 index 342a13027..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/layout/simple_spinner_item.xml +++ /dev/null @@ -1,25 +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. ---> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceListItemSmall" - android:gravity="center_vertical" - android:paddingStart="?android:attr/listPreferredItemPaddingStart" - android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" - android:background="?android:attr/activatedBackgroundIndicator" - android:minHeight="?android:attr/listPreferredItemHeightSmall" /> diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/wearable/Notifications/Application/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 41479debe..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/mipmap-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/wearable/Notifications/Application/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 380b02f45..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/mipmap-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/wearable/Notifications/Application/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index b3e251e0b..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/mipmap-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/wearable/Notifications/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 1962289e7..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/samples/wearable/Notifications/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 163f1f000..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/mipmap-xxxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Application/src/main/res/values/colors.xml b/samples/wearable/Notifications/Application/src/main/res/values/colors.xml deleted file mode 100644 index 946408559..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/values/colors.xml +++ /dev/null @@ -1,19 +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. ---> - -<resources> - <color name="divider_text">@android:color/holo_blue_bright</color> -</resources> diff --git a/samples/wearable/Notifications/Application/src/main/res/values/dimens.xml b/samples/wearable/Notifications/Application/src/main/res/values/dimens.xml deleted file mode 100644 index fd97910ac..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/values/dimens.xml +++ /dev/null @@ -1,29 +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. ---> - -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> - - <dimen name="editor_text_size">12dp</dimen> - <dimen name="editor_item_padding_top">8dp</dimen> - <dimen name="editor_item_padding_bottom">8dp</dimen> - <dimen name="editor_spinner_caption_min_width">50dp</dimen> - - <dimen name="image_picker_item_side">48dp</dimen> - -</resources> diff --git a/samples/wearable/Notifications/Application/src/main/res/values/strings.xml b/samples/wearable/Notifications/Application/src/main/res/values/strings.xml deleted file mode 100644 index d46ced776..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,193 +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. ---> - -<resources> - - <string name="app_name">Wearable Notifications</string> - <string name="properties">Properties</string> - <string name="preset">Preset</string> - <string name="text">Text</string> - <string name="title">Title</string> - <string name="priority">Priority</string> - <string name="actions">Actions</string> - <string name="include_large_icon">Include large icon</string> - <string name="local_only">Local only</string> - <string name="include_content_intent">Include content intent</string> - <string name="vibrate">Vibrate</string> - - <string name="basic_example">Basic example</string> - <string name="stylized_text_example">Stylized text example</string> - <string name="inbox_example">Inbox example</string> - <string name="big_picture_example">Big picture example</string> - <string name="big_text_example">Big text example</string> - <string name="bottom_aligned_example">Bottom-aligned example</string> - <string name="gravity_example">Gravity example</string> - <string name="content_action_example">Content action example</string> - <string name="content_icon_example">Content icon example</string> - <string name="multiple_page_example">Multiple page example</string> - <string name="bundle_example">Bundle example</string> - - <string name="min_priority">Min priority</string> - <string name="low_priority">Low priority</string> - <string name="default_priority">Default priority</string> - <string name="high_priority">High priority</string> - <string name="max_priority">Max priority</string> - - <string name="no_actions">No actions</string> - <string name="single_action">Single action</string> - <string name="long_title_action">Single action with a long title</string> - <string name="reply_action">Reply action</string> - <string name="reply_action_with_choices">Reply action with choices</string> - <string name="different_actions_on_phone_and_wearable">Different on phone and wearable</string> - - <string name="example_action">Example action</string> - <string name="example_action_long_title">Example action with a long title which wraps</string> - <string name="example_reply_action">Example reply action</string> - <string name="phone_action">Phone action</string> - <string name="wearable_action">Wearable action</string> - - <string name="example_action_clicked">Example action clicked</string> - <string name="example_reply_action_clicked">Example reply action clicked</string> - <string name="phone_action_clicked">Phone action clicked</string> - <string name="wearable_action_clicked">Wearable action clicked</string> - <string name="second_child_action_clicked">Second child action clicked</string> - <string name="content_intent_clicked">Content intent clicked</string> - <string name="example_content_action_clicked">Example content action clicked</string> - <string name="example_content_action2_clicked">Example content action 2 clicked</string> - <string name="example_notification_deleted">Example notification deleted</string> - - <string name="example_content_title">Basic example title</string> - <string name="example_content_text">Basic example text</string> - - <string name="big_text_example_title">Big text example title</string> - <string name="big_text_example_summary_text">Big text example summary</string> - <string name="big_text_example_big_text"> - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor - incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud - exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure - dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit - anim id est laborum. - </string> - - <string name="inbox_style_example_title">Inbox style example title</string> - <string name="inbox_style_example_summary_text">Inbox style example summary</string> - <string name="inbox_style_example_line1">Inbox style example line 1</string> - <string name="inbox_style_example_line2">Inbox style example line 2</string> - <string name="inbox_style_example_line3">Inbox style example line 3</string> - - <string name="big_picture_style_example_title">Big picture style example title</string> - <string name="big_picture_style_example_summary_text">Big picture style example summary</string> - - <string name="second_page_content_title">Second page title</string> - <string name="second_page_content_text">Second page text</string> - - <string name="third_page_content_title">Third page title</string> - <string name="third_page_content_text">Third page text</string> - - <string name="fourth_page_content_title">Fourth page title</string> - <string name="fourth_page_content_text">Fourth page text</string> - - <string name="first_child_content_title">First child title</string> - <string name="first_child_content_text"> - First child text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua.</string> - <string name="second_child_content_title">Second child title</string> - <string name="second_child_content_text"> - Second child text. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod - tempor incididunt ut labore et dolore magna aliqua.</string> - <string name="second_child_action">Second child action</string> - - <string name="example_reply_label">Message?</string> - - <string name="example_reply_answer_label">Answer?</string> - <string name="yes">Yes</string> - <string name="no">No</string> - <string name="maybe">Maybe</string> - - <string name="bg_picker_label">Page %s background: </string> - -</resources> diff --git a/samples/wearable/Notifications/Application/src/main/res/values/styles.xml b/samples/wearable/Notifications/Application/src/main/res/values/styles.xml deleted file mode 100644 index cf0494b4b..000000000 --- a/samples/wearable/Notifications/Application/src/main/res/values/styles.xml +++ /dev/null @@ -1,29 +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. ---> - -<resources> - - <!-- Base application theme. --> - <style name="AppTheme" parent="android:Theme.Holo"> - <!-- Customize your theme here. --> - </style> - - <style name="bg_picker"> - <item name="android:layout_marginLeft">16dp</item> - <item name="android:background">@drawable/unselected_background</item> - </style> - -</resources> diff --git a/samples/wearable/Notifications/Wearable/build.gradle b/samples/wearable/Notifications/Wearable/build.gradle deleted file mode 100644 index b9450ca9a..000000000 --- a/samples/wearable/Notifications/Wearable/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile "com.google.android.support:wearable:1.0.+" -} diff --git a/samples/wearable/Notifications/Wearable/proguard-rules.txt b/samples/wearable/Notifications/Wearable/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/Notifications/Wearable/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/Notifications/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Notifications/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index ad744570a..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,50 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.support.wearable.notifications" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light" > - - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - <activity - android:name=".BasicNotificationDisplayActivity" - android:exported="true" - android:allowEmbedded="true" - android:label="@string/app_name" - android:taskAffinity="" /> - <activity - android:name=".AnimatedNotificationDisplayActivity" - android:exported="true" - android:allowEmbedded="true" - android:label="@string/app_name" - android:taskAffinity="" /> - </application> - -</manifest> diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/AnimatedNotificationDisplayActivity.java b/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/AnimatedNotificationDisplayActivity.java deleted file mode 100644 index 2e0b2eed4..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/AnimatedNotificationDisplayActivity.java +++ /dev/null @@ -1,138 +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.support.wearable.notifications; - -import android.animation.Animator; -import android.animation.AnimatorListenerAdapter; -import android.animation.ObjectAnimator; -import android.animation.PropertyValuesHolder; -import android.app.Activity; -import android.content.Context; -import android.os.Bundle; -import android.view.ViewGroup; -import android.view.animation.AccelerateDecelerateInterpolator; -import android.widget.FrameLayout; -import android.widget.ImageView; -import android.widget.TextView; - -import java.util.Random; - -/** - * Custom display activity for an animated sample notification. - */ -public class AnimatedNotificationDisplayActivity extends Activity { - public static final String EXTRA_TITLE = "title"; - - private static final int BASE_ANIMATION_DURATION_MS = 2000; - - private Random mRandom; - private int mAnimationRange; - private ImageView mImageView; - private Animator mAnimation; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_animated_notification_display); - - mRandom = new Random(System.currentTimeMillis()); - mAnimationRange = getResources().getDimensionPixelSize(R.dimen.animation_range); - - String title = getIntent().getStringExtra(EXTRA_TITLE); - ((TextView) findViewById(R.id.title)).setText(title); - - mImageView = new ImageView(this); - mImageView.setImageResource(R.drawable.example_big_picture); - - ImageZoomView zoomView = new ImageZoomView(this, mImageView, mAnimationRange); - zoomView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, - ViewGroup.LayoutParams.MATCH_PARENT)); - - ((FrameLayout) findViewById(R.id.container)).addView(zoomView, 0); - - createNextAnimation(false); - } - - private void createNextAnimation(boolean start) { - float startX = mImageView.getTranslationX(); - float startY = mImageView.getTranslationY(); - float endX = -mRandom.nextInt(mAnimationRange); - float endY = -mRandom.nextInt(mAnimationRange); - float distance = (float) Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2)); - - mAnimation = ObjectAnimator.ofPropertyValuesHolder(mImageView, - PropertyValuesHolder.ofFloat("translationX", startX, endX), - PropertyValuesHolder.ofFloat("translationY", startY, endY)); - mAnimation.setInterpolator(new AccelerateDecelerateInterpolator()); - - mAnimation.setDuration(Math.max(BASE_ANIMATION_DURATION_MS / 10, - (int) (distance * BASE_ANIMATION_DURATION_MS / mAnimationRange))); - - mAnimation.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - super.onAnimationEnd(animation); - createNextAnimation(true); - } - }); - if (start) { - mAnimation.start(); - } - } - - @Override - protected void onResume() { - super.onResume(); - mAnimation.start(); - } - - @Override - protected void onPause() { - mAnimation.pause(); - super.onPause(); - } - - /** Helper view that zooms in on a child image view */ - private static class ImageZoomView extends ViewGroup { - private final int mZoomLength; - - public ImageZoomView(Context context, ImageView imageView, int zoomLength) { - super(context); - addView(imageView); - mZoomLength = zoomLength; - } - - @Override - protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - ImageView imageView = (ImageView) getChildAt(0); - - // Resize the image view to be at least mZoomLength pixels larger in both - // dimensions than the containing view. - int imageWidth = imageView.getDrawable().getIntrinsicWidth(); - int imageHeight = imageView.getDrawable().getIntrinsicHeight(); - int minSize = Math.max(right - left, bottom - top) + mZoomLength; - if (imageWidth > imageHeight) { - imageWidth = minSize * imageWidth / imageHeight; - imageHeight = minSize; - } else { - imageHeight = minSize * imageHeight / imageWidth; - imageWidth = minSize; - } - imageView.layout(left, top, left + imageWidth, top + imageHeight); - } - } -} diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/BasicNotificationDisplayActivity.java b/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/BasicNotificationDisplayActivity.java deleted file mode 100644 index d029f436b..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/BasicNotificationDisplayActivity.java +++ /dev/null @@ -1,38 +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.support.wearable.notifications; - -import android.app.Activity; -import android.os.Bundle; -import android.widget.TextView; - -/** - * Custom display activity for a sample notification. - */ -public class BasicNotificationDisplayActivity extends Activity { - public static final String EXTRA_TITLE = "title"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_notification_display); - - String title = getIntent().getStringExtra(EXTRA_TITLE); - - ((TextView) findViewById(R.id.title)).setText(title); - } -} diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java b/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java deleted file mode 100644 index d564e13a3..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/MainActivity.java +++ /dev/null @@ -1,106 +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.support.wearable.notifications; - -import android.app.Activity; -import android.app.Notification; -import android.app.NotificationManager; -import android.app.RemoteInput; -import android.content.Context; -import android.os.Bundle; -import android.support.wearable.view.WearableListView; -import android.text.TextUtils; -import android.view.LayoutInflater; -import android.view.ViewGroup; -import android.widget.TextView; -import android.widget.Toast; - -public class MainActivity extends Activity implements WearableListView.ClickListener { - private static final int SAMPLE_NOTIFICATION_ID = 0; - public static final String KEY_REPLY = "reply"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - WearableListView listView = (WearableListView) findViewById(R.id.list); - listView.setAdapter(new Adapter(this)); - listView.setClickListener(this); - } - - @Override - protected void onResume() { - super.onResume(); - if (getIntent() != null) { - Bundle inputResults = RemoteInput.getResultsFromIntent(getIntent()); - if (inputResults != null) { - CharSequence replyText = inputResults.getCharSequence(KEY_REPLY); - if (replyText != null) { - Toast.makeText(this, TextUtils.concat(getString(R.string.reply_was), replyText), - Toast.LENGTH_LONG).show(); - } - } - } - } - - /** Post a new or updated notification using the selected notification options. */ - private void updateNotification(int presetIndex) { - NotificationPreset preset = NotificationPresets.PRESETS[presetIndex]; - Notification notif = preset.buildNotification(this); - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(SAMPLE_NOTIFICATION_ID, notif); - finish(); - } - - @Override - public void onClick(WearableListView.ViewHolder v) { - updateNotification((Integer) v.itemView.getTag()); - } - - @Override - public void onTopEmptyRegionClick() { - } - - private static final class Adapter extends WearableListView.Adapter { - private final Context mContext; - private final LayoutInflater mInflater; - - private Adapter(Context context) { - mContext = context; - mInflater = LayoutInflater.from(context); - } - - @Override - public WearableListView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - return new WearableListView.ViewHolder( - mInflater.inflate(R.layout.notif_preset_list_item, null)); - } - - @Override - public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { - TextView view = (TextView) holder.itemView.findViewById(R.id.name); - view.setText(mContext.getString(NotificationPresets.PRESETS[position].nameResId)); - holder.itemView.setTag(position); - } - - @Override - public int getItemCount() { - return NotificationPresets.PRESETS.length; - } - } -} diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java b/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java deleted file mode 100644 index d6570d5ba..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPreset.java +++ /dev/null @@ -1,34 +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.support.wearable.notifications; - -import android.app.Notification; -import android.content.Context; - -/** - * Base class for notification preset generators. - */ -public abstract class NotificationPreset { - public final int nameResId; - - public NotificationPreset(int nameResId) { - this.nameResId = nameResId; - } - - /** Start building a notification with this preset */ - public abstract Notification buildNotification(Context context); -} diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java b/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java deleted file mode 100644 index 5578659e1..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/NotificationPresets.java +++ /dev/null @@ -1,314 +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.support.wearable.notifications; - -import android.app.Notification; -import android.app.PendingIntent; -import android.app.RemoteInput; -import android.content.Context; -import android.content.Intent; -import android.graphics.BitmapFactory; -import android.graphics.Color; -import android.graphics.Typeface; -import android.net.Uri; -import android.text.SpannableStringBuilder; -import android.text.style.ForegroundColorSpan; -import android.text.style.RelativeSizeSpan; -import android.text.style.StrikethroughSpan; -import android.text.style.StyleSpan; -import android.text.style.SubscriptSpan; -import android.text.style.SuperscriptSpan; -import android.text.style.TypefaceSpan; -import android.text.style.UnderlineSpan; -import android.util.TypedValue; -import android.view.Gravity; - -/** - * Collection of notification builder presets. - */ -public class NotificationPresets { - public static final NotificationPreset[] PRESETS = new NotificationPreset[] { - new BasicPreset(), - new StylizedTextPreset(), - new DisplayIntentPreset(), - new MultiSizeDisplayIntentPreset(), - new AnimatedDisplayIntentPreset(), - new ContentIconPreset() - }; - - private static Notification.Builder buildBasicNotification(Context context) { - return new Notification.Builder(context) - .setContentTitle(context.getString(R.string.example_content_title)) - .setContentText(context.getString(R.string.example_content_text)) - // Set a content intent to return to this sample - .setContentIntent(PendingIntent.getActivity(context, 0, - new Intent(context, MainActivity.class), 0)) - .setSmallIcon(R.mipmap.ic_launcher); - } - - private static class BasicPreset extends NotificationPreset { - public BasicPreset() { - super(R.string.basic_example); - } - - @Override - public Notification buildNotification(Context context) { - PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, - new Intent(context, MainActivity.class), 0); - - Notification page2 = buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setHintShowBackgroundOnly(true) - .setBackground(BitmapFactory.decodeResource(context.getResources(), - R.drawable.example_big_picture))) - .build(); - - Notification page3 = buildBasicNotification(context) - .setContentTitle(context.getString(R.string.third_page)) - .setContentText(null) - .extend(new Notification.WearableExtender() - .setContentAction(0 /* action A */)) - .build(); - - SpannableStringBuilder choice2 = new SpannableStringBuilder( - "This choice is best"); - choice2.setSpan(new StyleSpan(Typeface.BOLD_ITALIC), 5, 11, 0); - - return buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .addAction(new Notification.Action(R.mipmap.ic_launcher, - context.getString(R.string.action_a), pendingIntent)) - .addAction(new Notification.Action.Builder(R.mipmap.ic_launcher, - context.getString(R.string.reply), pendingIntent) - .addRemoteInput(new RemoteInput.Builder(MainActivity.KEY_REPLY) - .setChoices(new CharSequence[] { - context.getString(R.string.choice_1), - choice2 }) - .build()) - .build()) - .addPage(page2) - .addPage(page3)) - .build(); - } - } - - private static class StylizedTextPreset extends NotificationPreset { - public StylizedTextPreset() { - super(R.string.stylized_text_example); - } - - @Override - public Notification buildNotification(Context context) { - Notification.Builder builder = buildBasicNotification(context); - - Notification.BigTextStyle style = new Notification.BigTextStyle(); - - SpannableStringBuilder title = new SpannableStringBuilder(); - appendStyled(title, "Stylized", new StyleSpan(Typeface.BOLD_ITALIC)); - title.append(" title"); - SpannableStringBuilder text = new SpannableStringBuilder("Stylized text: "); - appendStyled(text, "C", new ForegroundColorSpan(Color.RED)); - appendStyled(text, "O", new ForegroundColorSpan(Color.GREEN)); - appendStyled(text, "L", new ForegroundColorSpan(Color.BLUE)); - appendStyled(text, "O", new ForegroundColorSpan(Color.YELLOW)); - appendStyled(text, "R", new ForegroundColorSpan(Color.MAGENTA)); - appendStyled(text, "S", new ForegroundColorSpan(Color.CYAN)); - text.append("; "); - appendStyled(text, "1.25x size", new RelativeSizeSpan(1.25f)); - text.append("; "); - appendStyled(text, "0.75x size", new RelativeSizeSpan(0.75f)); - text.append("; "); - appendStyled(text, "underline", new UnderlineSpan()); - text.append("; "); - appendStyled(text, "strikethrough", new StrikethroughSpan()); - text.append("; "); - appendStyled(text, "bold", new StyleSpan(Typeface.BOLD)); - text.append("; "); - appendStyled(text, "italic", new StyleSpan(Typeface.ITALIC)); - text.append("; "); - appendStyled(text, "sans-serif-thin", new TypefaceSpan("sans-serif-thin")); - text.append("; "); - appendStyled(text, "monospace", new TypefaceSpan("monospace")); - text.append("; "); - appendStyled(text, "sub", new SubscriptSpan()); - text.append("script"); - appendStyled(text, "super", new SuperscriptSpan()); - - style.setBigContentTitle(title); - style.bigText(text); - - builder.setStyle(style); - return builder.build(); - } - - private void appendStyled(SpannableStringBuilder builder, String str, Object... spans) { - builder.append(str); - for (Object span : spans) { - builder.setSpan(span, builder.length() - str.length(), builder.length(), 0); - } - } - } - - private static class DisplayIntentPreset extends NotificationPreset { - public DisplayIntentPreset() { - super(R.string.display_intent_example); - } - - @Override - public Notification buildNotification(Context context) { - Intent displayIntent = new Intent(context, BasicNotificationDisplayActivity.class); - displayIntent.putExtra(BasicNotificationDisplayActivity.EXTRA_TITLE, - context.getString(nameResId)); - PendingIntent displayPendingIntent = PendingIntent.getActivity(context, - 0, displayIntent, PendingIntent.FLAG_UPDATE_CURRENT); - return buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setDisplayIntent(displayPendingIntent)) - .build(); - } - } - - private static class MultiSizeDisplayIntentPreset extends NotificationPreset { - public MultiSizeDisplayIntentPreset() { - super(R.string.multisize_display_intent_example); - } - - @Override - public Notification buildNotification(Context context) { - PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, - new Intent(context, MainActivity.class), 0); - Intent displayIntent = new Intent(context, BasicNotificationDisplayActivity.class) - .putExtra(BasicNotificationDisplayActivity.EXTRA_TITLE, - context.getString(R.string.xsmall_sized_display)); - return buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setDisplayIntent(PendingIntent.getActivity(context, 0, displayIntent, - PendingIntent.FLAG_UPDATE_CURRENT)) - .addPage(createPageForSizePreset(context, - Notification.WearableExtender.SIZE_SMALL, - R.string.small_sized_display, 0)) - .addPage(createPageForSizePreset(context, - Notification.WearableExtender.SIZE_MEDIUM, - R.string.medium_sized_display, 1)) - .addPage(createPageForSizePreset(context, - Notification.WearableExtender.SIZE_LARGE, - R.string.large_sized_display, 2)) - .addPage(createPageForSizePreset(context, - Notification.WearableExtender.SIZE_FULL_SCREEN, - R.string.full_screen_display, 3)) - .addPage(createPageForCustomHeight(context, 256, - R.string.dp256_height_display)) - .addPage(createPageForCustomHeight(context, 512, - R.string.dp512_height_display)) - .addAction(new Notification.Action(R.mipmap.ic_launcher, - context.getString(R.string.action_a), pendingIntent)) - .addAction(new Notification.Action(R.mipmap.ic_launcher, - context.getString(R.string.action_b), pendingIntent)) - .addAction(new Notification.Action(R.mipmap.ic_launcher, - context.getString(R.string.action_c), pendingIntent)) - .addAction(new Notification.Action(R.mipmap.ic_launcher, - context.getString(R.string.action_d), pendingIntent)) - .setCustomSizePreset(Notification.WearableExtender.SIZE_XSMALL)) - .build(); - } - - private Notification createPageForCustomHeight(Context context, int heightDisplayDp, - int pageNameResId) { - int contentHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, - heightDisplayDp, context.getResources().getDisplayMetrics()); - Intent displayIntent = new Intent(context, BasicNotificationDisplayActivity.class) - .setData(Uri.fromParts("example", "height/" + heightDisplayDp, null)) - .putExtra(BasicNotificationDisplayActivity.EXTRA_TITLE, - context.getString(pageNameResId)); - return buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setDisplayIntent(PendingIntent.getActivity(context, 0, displayIntent, - PendingIntent.FLAG_UPDATE_CURRENT)) - .setCustomContentHeight(contentHeight)) - .build(); - } - - private Notification createPageForSizePreset(Context context, int sizePreset, - int pageNameResId, int contentAction) { - Intent displayIntent = new Intent(context, BasicNotificationDisplayActivity.class) - .setData(Uri.fromParts("example", "size/" + sizePreset, null)) - .putExtra(BasicNotificationDisplayActivity.EXTRA_TITLE, - context.getString(pageNameResId)); - return buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setDisplayIntent(PendingIntent.getActivity(context, 0, displayIntent, - PendingIntent.FLAG_UPDATE_CURRENT)) - .setCustomSizePreset(sizePreset) - .setContentAction(contentAction)) - .build(); - } - } - - private static class AnimatedDisplayIntentPreset extends NotificationPreset { - public AnimatedDisplayIntentPreset() { - super(R.string.animated_display_intent_example); - } - - @Override - public Notification buildNotification(Context context) { - Intent displayIntent = new Intent(context, AnimatedNotificationDisplayActivity.class); - displayIntent.putExtra(BasicNotificationDisplayActivity.EXTRA_TITLE, - context.getString(nameResId)); - PendingIntent displayPendingIntent = PendingIntent.getActivity(context, - 0, displayIntent, 0); - return buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setDisplayIntent(displayPendingIntent)) - .build(); - } - } - - private static class ContentIconPreset extends NotificationPreset { - public ContentIconPreset() { - super(R.string.content_icon_example); - } - - @Override - public Notification buildNotification(Context context) { - Notification page2 = buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setContentIcon(R.drawable.content_icon_small) - .setContentIconGravity(Gravity.START)) - .build(); - - Notification page3 = buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setContentIcon(R.drawable.content_icon_large)) - .build(); - - Notification page4 = buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setContentIcon(R.drawable.content_icon_large) - .setContentIconGravity(Gravity.START)) - .build(); - - return buildBasicNotification(context) - .extend(new Notification.WearableExtender() - .setHintHideIcon(true) - .setContentIcon(R.drawable.content_icon_small) - .addPage(page2) - .addPage(page3) - .addPage(page4)) - .build(); - } - } -} diff --git a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/WearableListItemLayout.java b/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/WearableListItemLayout.java deleted file mode 100644 index 773dfe4cc..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/java/com/example/android/support/wearable/notifications/WearableListItemLayout.java +++ /dev/null @@ -1,91 +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.support.wearable.notifications; - -import android.content.Context; -import android.graphics.drawable.GradientDrawable; -import android.support.wearable.view.WearableListView; -import android.util.AttributeSet; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - -public class WearableListItemLayout extends LinearLayout implements WearableListView.Item { - - private final float mFadedTextAlpha; - private final int mFadedCircleColor; - private final int mChosenCircleColor; - private ImageView mCircle; - private float mScale; - private TextView mName; - - public WearableListItemLayout(Context context) { - this(context, null); - } - - public WearableListItemLayout(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public WearableListItemLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - mFadedTextAlpha = getResources().getInteger(R.integer.action_text_faded_alpha) / 100f; - mFadedCircleColor = getResources().getColor(R.color.wl_gray); - mChosenCircleColor = getResources().getColor(R.color.wl_blue); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - mCircle = (ImageView) findViewById(R.id.circle); - mName = (TextView) findViewById(R.id.name); - } - - @Override - public float getProximityMinValue() { - return 1f; - } - - @Override - public float getProximityMaxValue() { - return 1.6f; - } - - @Override - public float getCurrentProximityValue() { - return mScale; - } - - @Override - public void setScalingAnimatorValue(float scale) { - mScale = scale; - mCircle.setScaleX(scale); - mCircle.setScaleY(scale); - } - - @Override - public void onScaleUpStart() { - mName.setAlpha(1f); - ((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor); - } - - @Override - public void onScaleDownStart() { - ((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor); - mName.setAlpha(mFadedTextAlpha); - } -} diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_large.png b/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_large.png Binary files differdeleted file mode 100644 index 0eab3b10a..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_large.png +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_small.png b/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_small.png Binary files differdeleted file mode 100644 index 9a9f4b4b5..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/content_icon_small.png +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/example_big_picture.jpg b/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/example_big_picture.jpg Binary files differdeleted file mode 100644 index 68473ba6c..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/drawable-nodpi/example_big_picture.jpg +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/drawable/wl_circle.xml b/samples/wearable/Notifications/Wearable/src/main/res/drawable/wl_circle.xml deleted file mode 100644 index 7c9708ed0..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/drawable/wl_circle.xml +++ /dev/null @@ -1,21 +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. ---> - -<shape - xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="oval"> - <solid android:color="@color/wl_gray"/> -</shape> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_animated_notification_display.xml b/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_animated_notification_display.xml deleted file mode 100644 index be70b2b0b..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_animated_notification_display.xml +++ /dev/null @@ -1,35 +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" - android:id="@+id/container" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent" > - - <TextView android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:textSize="16sp" - android:padding="8dp" - android:gravity="center_vertical|center_horizontal" - android:textColor="#FF3333" - android:shadowColor="#992222" - android:shadowRadius="2" - android:shadowDx="1" - android:shadowDy="1" /> - -</FrameLayout> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_main.xml b/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_main.xml deleted file mode 100644 index 9ae6026b7..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,23 +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. ---> - -<android.support.wearable.view.WearableListView - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/list" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="none" - android:dividerHeight="0dp"/> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml b/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml deleted file mode 100644 index 7a329d2b7..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/layout/activity_notification_display.xml +++ /dev/null @@ -1,35 +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. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="match_parent" > - - <TextView android:id="@+id/title" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:textSize="16sp" - android:padding="8dp" - android:gravity="center_vertical|center_horizontal" - android:textColor="#7777FF" - android:shadowColor="#222299" - android:shadowRadius="2" - android:shadowDx="1" - android:shadowDy="1" - /> - -</LinearLayout> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/layout/notif_preset_list_item.xml b/samples/wearable/Notifications/Wearable/src/main/res/layout/notif_preset_list_item.xml deleted file mode 100644 index 9e3cd459d..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/layout/notif_preset_list_item.xml +++ /dev/null @@ -1,38 +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. ---> - -<com.example.android.support.wearable.notifications.WearableListItemLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:gravity="center_vertical" - android:layout_width="match_parent" - android:layout_height="80dp"> - <ImageView - android:id="@+id/circle" - android:layout_height="20dp" - android:layout_margin="16dp" - android:layout_width="20dp" - android:src="@drawable/wl_circle"/> - <TextView - android:id="@+id/name" - android:gravity="center_vertical|left" - android:layout_width="wrap_content" - android:layout_marginRight="16dp" - android:layout_height="match_parent" - android:fontFamily="sans-serif-condensed-light" - android:lineSpacingExtra="-4sp" - android:textColor="@color/text_color" - android:textSize="16sp"/> -</com.example.android.support.wearable.notifications.WearableListItemLayout> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/wearable/Notifications/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 41479debe..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/wearable/Notifications/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 380b02f45..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index b3e251e0b..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 1962289e7..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 163f1f000..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/colors.xml b/samples/wearable/Notifications/Wearable/src/main/res/values/colors.xml deleted file mode 100644 index 10fad66cf..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/values/colors.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <color name="wl_blue">#2878ff</color> - <color name="wl_gray">#c1c1c1</color> - <color name="text_color">#434343</color> -</resources> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/dimens.xml b/samples/wearable/Notifications/Wearable/src/main/res/values/dimens.xml deleted file mode 100644 index 50214e65d..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/values/dimens.xml +++ /dev/null @@ -1,23 +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. ---> - -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> - <dimen name="animation_range">60dp</dimen> - -</resources> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/integers.xml b/samples/wearable/Notifications/Wearable/src/main/res/values/integers.xml deleted file mode 100644 index 1dfb01162..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/values/integers.xml +++ /dev/null @@ -1,19 +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. ---> - -<resources> - <integer name="action_text_faded_alpha">40</integer> -</resources> diff --git a/samples/wearable/Notifications/Wearable/src/main/res/values/strings.xml b/samples/wearable/Notifications/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index ff7023b50..000000000 --- a/samples/wearable/Notifications/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,46 +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. ---> - -<resources> - - <string name="app_name">Wearable Notifications</string> - <string name="basic_example">Basic example</string> - <string name="stylized_text_example">Stylized text example</string> - <string name="display_intent_example">Display intent example</string> - <string name="multisize_display_intent_example">Multiple-sized display intent example</string> - <string name="animated_display_intent_example">Animated display intent example</string> - <string name="content_icon_example">Content icon example</string> - - <string name="example_content_title">Example content title</string> - <string name="example_content_text">Example content text</string> - - <string name="xsmall_sized_display">X-Small sized display</string> - <string name="small_sized_display">Small sized display</string> - <string name="medium_sized_display">Medium sized display</string> - <string name="large_sized_display">Large sized display</string> - <string name="full_screen_display">Full-Screen display</string> - <string name="dp256_height_display">256dp height display</string> - <string name="dp512_height_display">512dp height display</string> - - <string name="action_a">Action A</string> - <string name="action_b">Action B</string> - <string name="action_c">Action C</string> - <string name="action_d">Action D</string> - <string name="reply">Reply</string> - <string name="reply_was">Reply was: </string> - <string name="third_page">Third page</string> - <string name="choice_1">Choice #1</string> -</resources> diff --git a/samples/wearable/Notifications/_index.html b/samples/wearable/Notifications/_index.html deleted file mode 100644 index af28c9404..000000000 --- a/samples/wearable/Notifications/_index.html +++ /dev/null @@ -1,76 +0,0 @@ -<p><b>About:</b> This sample application provides a showcase of available notification styles and -demonstrates various features of the Android Wear notifications API. Running the sample on your -companion allows you to select between various notification styles and to see how these -notifications are displayed, both in a phone's notification shade and on the wearable. The companion -application allows you to create the following types of notifications:</p> -<ul> - <li>Basic notification</li> - <li>"Inbox style" notification: multiple lines of text</li> - <li>"Big picture style" notification: a full-screen background image for the card on the - wearable</li> - <li>"Big text style" notification: a tall card that is collapsed and can be expanded with a - tap</li> - <li>"Big action style" notification: tapping anywhere on the card triggers the notification - content intent</li> - <li>Notification with multiple pages: swipe horizontally to view the second page</li> - <li>Bundled Notifications: a stack of cards that can be individually expanded</li> -</ul> -<p>This sample also allows you to toggle other attributes for each of these notification types, -including whether a content intent or action are included, and whether the notification is marked as -"local only," indicating that it should not be bridged between devices.</p> -<p>You can also run a separate APK on your wearable for even more customizable notifications. The -wearable notification styles include:</p> -<ul> - <li>A notification drawn with a custom display Activity, using setDisplayIntent</li> - <li>A notification styled using SpannableStrings</li> - <li>A notification page with bottom-aligned text</li> - <li>A notification with a "content icon"</li> -</ul> -<p><b>How to run:</b> Install the Application APK on the companion, and/or the Wearable APK on the -wearable. Start the sample by running the Wearable Notifications application on the companion, or -by starting the Wearable Notifications application on the wearable. To do the latter, go to the -voice menu - either by saying Ok Google or tapping the home screen - and select the "Start..." -option. Then, select "Wearable Notifications" from the submenu.</p> -<p><b>Wearable APIs used:</b> Notification.WearableExtender, Notification.BigTextStyle, -Notification.BigPictureStyle (note that NotificationCompat, rather than Notification, is used on the -companion side in order to be compatible with older versions of Android).</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/companion-multiple-page.png" alt="Multiple page" width="216" - height="384"> - <img src="screenshots/multiple-page1.png" alt="Page 1" width="140" height="140"> - <img src="screenshots/multiple-page2.png" alt="Page 2" width="140" height="140"> - <img src="screenshots/companion-bottom-aligned.png" alt="Bottom aligned - companion" - width="216" height="384"> - <img src="screenshots/bottom-aligned.png" alt="Bottom aligned - wearable" width="140" - height="140"> - <img src="screenshots/companion-content-action.png" alt="Content action - companion" - width="216" height="384"> - <img src="screenshots/content-action.png" alt="Content action - wearable" width="140" - height="140"> - <img src="screenshots/content-action2.png" alt="Content action 2 - wearable" width="140" - height="140"> - <img src="screenshots/companion-bundle.png" alt="Bundle aligned - companion" width="216" - height="384"> - <img src="screenshots/bundle.png" alt="Bundle - wearable" width="140" height="140"> - <figcaption>Notifications selected from companion app.</figcaption> - </figure> - <figure> - <img src="screenshots/basic-menu.png" alt="Select 'Basic example'" width="140" - height="140"> - <img src="screenshots/basic.png" alt="Basic example" width="140" height="140"> - <img src="screenshots/content-icon-menu.png" alt="Select 'Content icon example'" width="140" - height="140"> - <img src="screenshots/content-icon1.png" alt="Content icon 1" width="140" height="140"> - <img src="screenshots/content-icon2.png" alt="Content icon 2" width="140" height="140"> - <img src="screenshots/content-icon3.png" alt="Content icon 3" width="140" height="140"> - <img src="screenshots/content-icon4.png" alt="Content icon 4" width="140" height="140"> - <img src="screenshots/display-intent-menu.png" alt="Select 'Display intent example'" - width="140" height="140"> - <img src="screenshots/display-intent.png" alt="Display intent" width="140" height="140"> - <img src="screenshots/stylized-menu.png" alt="Select 'Stylized text example'" width="140" - height="140"> - <img src="screenshots/stylized.png" alt="Stylized text example" width="140" height="140"> - <figcaption>Notifications selected from wearable app.</figcaption> - </figure> -</p> diff --git a/samples/wearable/Notifications/build.gradle b/samples/wearable/Notifications/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/Notifications/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/Notifications/gradle.properties b/samples/wearable/Notifications/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/Notifications/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/Notifications/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/Notifications/gradlew b/samples/wearable/Notifications/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/Notifications/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/Notifications/gradlew.bat b/samples/wearable/Notifications/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/Notifications/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Notifications/screenshots/basic-menu.png b/samples/wearable/Notifications/screenshots/basic-menu.png Binary files differdeleted file mode 100644 index 75c29cc15..000000000 --- a/samples/wearable/Notifications/screenshots/basic-menu.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/basic.png b/samples/wearable/Notifications/screenshots/basic.png Binary files differdeleted file mode 100644 index 9e13b0926..000000000 --- a/samples/wearable/Notifications/screenshots/basic.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/bottom-aligned.png b/samples/wearable/Notifications/screenshots/bottom-aligned.png Binary files differdeleted file mode 100644 index 88c7ffadb..000000000 --- a/samples/wearable/Notifications/screenshots/bottom-aligned.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/bundle.png b/samples/wearable/Notifications/screenshots/bundle.png Binary files differdeleted file mode 100644 index a6e1ad5ee..000000000 --- a/samples/wearable/Notifications/screenshots/bundle.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/companion-bottom-aligned.png b/samples/wearable/Notifications/screenshots/companion-bottom-aligned.png Binary files differdeleted file mode 100644 index 2bda56c8b..000000000 --- a/samples/wearable/Notifications/screenshots/companion-bottom-aligned.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/companion-bundle.png b/samples/wearable/Notifications/screenshots/companion-bundle.png Binary files differdeleted file mode 100644 index 90e0e0869..000000000 --- a/samples/wearable/Notifications/screenshots/companion-bundle.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/companion-content-action.png b/samples/wearable/Notifications/screenshots/companion-content-action.png Binary files differdeleted file mode 100644 index 07e680602..000000000 --- a/samples/wearable/Notifications/screenshots/companion-content-action.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/companion-multiple-page.png b/samples/wearable/Notifications/screenshots/companion-multiple-page.png Binary files differdeleted file mode 100644 index 7f115219d..000000000 --- a/samples/wearable/Notifications/screenshots/companion-multiple-page.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/content-action.png b/samples/wearable/Notifications/screenshots/content-action.png Binary files differdeleted file mode 100644 index 415dd9f66..000000000 --- a/samples/wearable/Notifications/screenshots/content-action.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/content-action2.png b/samples/wearable/Notifications/screenshots/content-action2.png Binary files differdeleted file mode 100644 index 7f01994ac..000000000 --- a/samples/wearable/Notifications/screenshots/content-action2.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/content-icon-menu.png b/samples/wearable/Notifications/screenshots/content-icon-menu.png Binary files differdeleted file mode 100644 index 6c810cea8..000000000 --- a/samples/wearable/Notifications/screenshots/content-icon-menu.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/content-icon1.png b/samples/wearable/Notifications/screenshots/content-icon1.png Binary files differdeleted file mode 100644 index f9d12da48..000000000 --- a/samples/wearable/Notifications/screenshots/content-icon1.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/content-icon2.png b/samples/wearable/Notifications/screenshots/content-icon2.png Binary files differdeleted file mode 100644 index a36b734c4..000000000 --- a/samples/wearable/Notifications/screenshots/content-icon2.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/content-icon3.png b/samples/wearable/Notifications/screenshots/content-icon3.png Binary files differdeleted file mode 100644 index e2c757e5d..000000000 --- a/samples/wearable/Notifications/screenshots/content-icon3.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/content-icon4.png b/samples/wearable/Notifications/screenshots/content-icon4.png Binary files differdeleted file mode 100644 index f5d05231f..000000000 --- a/samples/wearable/Notifications/screenshots/content-icon4.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/display-intent-menu.png b/samples/wearable/Notifications/screenshots/display-intent-menu.png Binary files differdeleted file mode 100644 index 567673f73..000000000 --- a/samples/wearable/Notifications/screenshots/display-intent-menu.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/display-intent.png b/samples/wearable/Notifications/screenshots/display-intent.png Binary files differdeleted file mode 100644 index f3b333d5e..000000000 --- a/samples/wearable/Notifications/screenshots/display-intent.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/multiple-page1.png b/samples/wearable/Notifications/screenshots/multiple-page1.png Binary files differdeleted file mode 100644 index d6591d97e..000000000 --- a/samples/wearable/Notifications/screenshots/multiple-page1.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/multiple-page2.png b/samples/wearable/Notifications/screenshots/multiple-page2.png Binary files differdeleted file mode 100644 index 730cb3047..000000000 --- a/samples/wearable/Notifications/screenshots/multiple-page2.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/stylized-menu.png b/samples/wearable/Notifications/screenshots/stylized-menu.png Binary files differdeleted file mode 100644 index 2e94c93bd..000000000 --- a/samples/wearable/Notifications/screenshots/stylized-menu.png +++ /dev/null diff --git a/samples/wearable/Notifications/screenshots/stylized.png b/samples/wearable/Notifications/screenshots/stylized.png Binary files differdeleted file mode 100644 index 338c9cc5d..000000000 --- a/samples/wearable/Notifications/screenshots/stylized.png +++ /dev/null diff --git a/samples/wearable/Notifications/settings.gradle b/samples/wearable/Notifications/settings.gradle deleted file mode 100644 index f3f25a547..000000000 --- a/samples/wearable/Notifications/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Wearable', 'Application' diff --git a/samples/wearable/Quiz/Application/build.gradle b/samples/wearable/Quiz/Application/build.gradle deleted file mode 100644 index a138acb2f..000000000 --- a/samples/wearable/Quiz/Application/build.gradle +++ /dev/null @@ -1,26 +0,0 @@ -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.google.android.gms:play-services:5.0.+' - compile "com.android.support:support-v13:20.0.+" - wearApp project(':Wearable') -} diff --git a/samples/wearable/Quiz/Application/proguard-rules.txt b/samples/wearable/Quiz/Application/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/Quiz/Application/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/Quiz/Application/src/main/AndroidManifest.xml b/samples/wearable/Quiz/Application/src/main/AndroidManifest.xml deleted file mode 100644 index faf65f62b..000000000 --- a/samples/wearable/Quiz/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,41 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.quiz" > - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@style/AppTheme"> - <meta-data android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <activity - android:name="com.example.android.wearable.quiz.MainActivity" - android:label="@string/app_name" - android:windowSoftInputMode="stateHidden" - android:configChanges="keyboardHidden|orientation|screenSize" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - - </application> - -</manifest> diff --git a/samples/wearable/Quiz/Application/src/main/assets/Quiz.json b/samples/wearable/Quiz/Application/src/main/assets/Quiz.json deleted file mode 100644 index db2448d9d..000000000 --- a/samples/wearable/Quiz/Application/src/main/assets/Quiz.json +++ /dev/null @@ -1,124 +0,0 @@ -{ -"questions": [ -{ -"question": "What is the scientific name of a butterfly?", -"answers": [ -"Apis", -"Coleoptera", -"Formicidae", -"Rhopalocera" -], -"correctIndex": 3 -}, -{ -"question": "How hot is the surface of the sun?", -"answers": [ -"1,233 K", -"5,778 K", -"12,130 K", -"101,300 K" -], -"correctIndex": 1 -}, -{ -"question": "Who are the actors in The Internship?", -"answers": [ -"Ben Stiller, Jonah Hill", -"Courteney Cox, Matt LeBlanc", -"Kaley Cuoco, Jim Parsons", -"Vince Vaughn, Owen Wilson" -], -"correctIndex": 3 -}, -{ -"question": "What is the capital of Spain?", -"answers": [ -"Berlin", -"Buenos Aires", -"Madrid", -"San Juan" -], -"correctIndex": 2 -}, -{ -"question": "What are the school colors of the University of Texas at Austin?", -"answers": [ -"Black, Red", -"Blue, Orange", -"White, Burnt Orange", -"White, Old gold, Gold" -], -"correctIndex": 2 -}, -{ -"question": "What is 70 degrees Fahrenheit in Celsius?", -"answers": [ -"18.8889", -"20", -"21.1111", -"158" -], -"correctIndex": 2 -}, -{ -"question": "When was Mahatma Gandhi born?", -"answers": [ -"October 2, 1869", -"December 15, 1872", -"July 18, 1918", -"January 15, 1929" -], -"correctIndex": 0 -}, -{ -"question": "How far is the moon from Earth?", -"answers": [ -"7,918 miles (12,742 km)", -"86,881 miles (139,822 km)", -"238,400 miles (384,400 km)", -"35,980,000 miles (57,910,000 km)" -], -"correctIndex": 2 -}, -{ -"question": "What is 65 times 52?", -"answers": [ -"117", -"3120", -"3380", -"3520" -], -"correctIndex": 2 -}, -{ -"question": "How tall is Mount Everest?", -"answers": [ -"6,683 ft (2,037 m)", -"7,918 ft (2,413 m)", -"19,341 ft (5,895 m)", -"29,029 ft (8,847 m)" -], -"correctIndex": 3 -}, -{ -"question": "When did The Avengers come out?", -"answers": [ -"May 2, 2008", -"May 4, 2012", -"May 3, 2013", -"April 4, 2014" -], -"correctIndex": 1 -}, -{ -"question": "What is 48,879 in hexidecimal?", -"answers": [ -"0x18C1", -"0xBEEF", -"0xDEAD", -"0x12D591" -], -"correctIndex": 1 -} -] -}
\ No newline at end of file diff --git a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/Constants.java b/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/Constants.java deleted file mode 100644 index 2bcfe5f18..000000000 --- a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/Constants.java +++ /dev/null @@ -1,39 +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.quiz; - -/** Constants used in the companion app. */ -public final class Constants { - private Constants() { - } - - public static final String ANSWERS = "answers"; - public static final String CHOSEN_ANSWER_CORRECT = "chosen_answer_correct"; - public static final String CORRECT_ANSWER_INDEX = "correct_answer_index"; - public static final String QUESTION = "question"; - public static final String QUESTION_INDEX = "question_index"; - public static final String QUESTION_WAS_ANSWERED = "question_was_answered"; - public static final String QUESTION_WAS_DELETED = "question_was_deleted"; - - public static final String NUM_CORRECT = "num_correct"; - public static final String NUM_INCORRECT = "num_incorrect"; - public static final String NUM_SKIPPED = "num_skipped"; - - public static final String QUIZ_ENDED_PATH = "/quiz_ended"; - public static final String QUIZ_EXITED_PATH = "/quiz_exited"; - public static final String RESET_QUIZ_PATH = "/reset_quiz"; -} diff --git a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/JsonUtils.java b/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/JsonUtils.java deleted file mode 100644 index df8c8998e..000000000 --- a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/JsonUtils.java +++ /dev/null @@ -1,47 +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.quiz; - -import android.content.Context; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.IOException; -import java.io.InputStream; - -final class JsonUtils { - public static final String JSON_FIELD_QUESTIONS = "questions"; - public static final String JSON_FIELD_QUESTION = "question"; - public static final String JSON_FIELD_ANSWERS = "answers"; - public static final String JSON_FIELD_CORRECT_INDEX = "correctIndex"; - public static final int NUM_ANSWER_CHOICES = 4; - - private JsonUtils() { - } - - public static JSONObject loadJsonFile(Context context, String fileName) throws IOException, - JSONException { - InputStream is = context.getAssets().open(fileName); - int size = is.available(); - byte[] buffer = new byte[size]; - is.read(buffer); - is.close(); - String jsonString = new String(buffer); - return new JSONObject(jsonString); - } -} diff --git a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/MainActivity.java b/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/MainActivity.java deleted file mode 100644 index c860d59f7..000000000 --- a/samples/wearable/Quiz/Application/src/main/java/com/example/android/wearable/quiz/MainActivity.java +++ /dev/null @@ -1,585 +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.quiz; - -import static com.example.android.wearable.quiz.Constants.ANSWERS; -import static com.example.android.wearable.quiz.Constants.CHOSEN_ANSWER_CORRECT; -import static com.example.android.wearable.quiz.Constants.CORRECT_ANSWER_INDEX; -import static com.example.android.wearable.quiz.Constants.NUM_CORRECT; -import static com.example.android.wearable.quiz.Constants.NUM_INCORRECT; -import static com.example.android.wearable.quiz.Constants.NUM_SKIPPED; -import static com.example.android.wearable.quiz.Constants.QUESTION; -import static com.example.android.wearable.quiz.Constants.QUESTION_INDEX; -import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_ANSWERED; -import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_DELETED; -import static com.example.android.wearable.quiz.Constants.QUIZ_ENDED_PATH; -import static com.example.android.wearable.quiz.Constants.QUIZ_EXITED_PATH; -import static com.example.android.wearable.quiz.Constants.RESET_QUIZ_PATH; - -import android.app.Activity; -import android.graphics.Color; -import android.net.Uri; -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.Button; -import android.widget.EditText; -import android.widget.LinearLayout; -import android.widget.RadioGroup; -import android.widget.TextView; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.common.data.FreezableUtils; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.DataItem; -import com.google.android.gms.wearable.DataItemBuffer; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.DataMapItem; -import com.google.android.gms.wearable.MessageApi; -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.NodeApi; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.PutDataRequest; -import com.google.android.gms.wearable.Wearable; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.PriorityQueue; - -/** - * Allows the user to create questions, which will be put as notifications on the watch's stream. - * The status of questions will be updated on the phone when the user answers them. - */ -public class MainActivity extends Activity implements DataApi.DataListener, - MessageApi.MessageListener, ConnectionCallbacks, - GoogleApiClient.OnConnectionFailedListener { - - private static final String TAG = "ExampleQuizApp"; - private static final String QUIZ_JSON_FILE = "Quiz.json"; - - // Various UI components. - private EditText questionEditText; - private EditText choiceAEditText; - private EditText choiceBEditText; - private EditText choiceCEditText; - private EditText choiceDEditText; - private RadioGroup choicesRadioGroup; - private TextView quizStatus; - private LinearLayout quizButtons; - private LinearLayout questionsContainer; - private Button readQuizFromFileButton; - private Button resetQuizButton; - - private GoogleApiClient mGoogleApiClient; - private PriorityQueue<Question> mFutureQuestions; - private int mQuestionIndex = 0; - private boolean mHasQuestionBeenAsked = false; - - // Data to display in end report. - private int mNumCorrect = 0; - private int mNumIncorrect = 0; - private int mNumSkipped = 0; - - private static final Map<Integer, Integer> radioIdToIndex; - - static { - Map<Integer, Integer> temp = new HashMap<Integer, Integer>(4); - temp.put(R.id.choice_a_radio, 0); - temp.put(R.id.choice_b_radio, 1); - temp.put(R.id.choice_c_radio, 2); - temp.put(R.id.choice_d_radio, 3); - radioIdToIndex = Collections.unmodifiableMap(temp); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_main); - - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - mFutureQuestions = new PriorityQueue<Question>(10); - - // Find UI components to be used later. - questionEditText = (EditText) findViewById(R.id.question_text); - choiceAEditText = (EditText) findViewById(R.id.choice_a_text); - choiceBEditText = (EditText) findViewById(R.id.choice_b_text); - choiceCEditText = (EditText) findViewById(R.id.choice_c_text); - choiceDEditText = (EditText) findViewById(R.id.choice_d_text); - choicesRadioGroup = (RadioGroup) findViewById(R.id.choices_radio_group); - quizStatus = (TextView) findViewById(R.id.quiz_status); - quizButtons = (LinearLayout) findViewById(R.id.quiz_buttons); - questionsContainer = (LinearLayout) findViewById(R.id.questions_container); - readQuizFromFileButton = (Button) findViewById(R.id.read_quiz_from_file_button); - resetQuizButton = (Button) findViewById(R.id.reset_quiz_button); - } - - @Override - protected void onStart() { - super.onStart(); - if (!mGoogleApiClient.isConnected()) { - mGoogleApiClient.connect(); - } - } - - @Override - protected void onStop() { - Wearable.DataApi.removeListener(mGoogleApiClient, this); - Wearable.MessageApi.removeListener(mGoogleApiClient, this); - - // Tell the wearable to end the quiz (counting unanswered questions as skipped), and then - // disconnect mGoogleApiClient. - DataMap dataMap = new DataMap(); - dataMap.putInt(NUM_CORRECT, mNumCorrect); - dataMap.putInt(NUM_INCORRECT, mNumIncorrect); - if (mHasQuestionBeenAsked) { - mNumSkipped += 1; - } - mNumSkipped += mFutureQuestions.size(); - dataMap.putInt(NUM_SKIPPED, mNumSkipped); - if (mNumCorrect + mNumIncorrect + mNumSkipped > 0) { - sendMessageToWearable(QUIZ_EXITED_PATH, dataMap.toByteArray()); - } - - clearQuizStatus(); - super.onStop(); - } - - @Override - public void onConnected(Bundle connectionHint) { - Wearable.DataApi.addListener(mGoogleApiClient, this); - Wearable.MessageApi.addListener(mGoogleApiClient, this); - } - - @Override - public void onConnectionSuspended(int cause) { - // Ignore - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - Log.e(TAG, "Failed to connect to Google Play Services"); - } - - @Override - public void onMessageReceived(MessageEvent messageEvent) { - if (messageEvent.getPath().equals(RESET_QUIZ_PATH)) { - runOnUiThread(new Runnable() { - @Override - public void run() { - resetQuiz(null); - } - }); - } - } - - /** - * Used to ensure questions with smaller indexes come before questions with larger - * indexes. For example, question0 should come before question1. - */ - private static class Question implements Comparable<Question> { - private String question; - private int questionIndex; - private String[] answers; - private int correctAnswerIndex; - - public Question(String question, int questionIndex, String[] answers, - int correctAnswerIndex) { - this.question = question; - this.questionIndex = questionIndex; - this.answers = answers; - this.correctAnswerIndex = correctAnswerIndex; - } - - public static Question fromJson(JSONObject questionObject, int questionIndex) - throws JSONException { - String question = questionObject.getString(JsonUtils.JSON_FIELD_QUESTION); - JSONArray answersJsonArray = questionObject.getJSONArray(JsonUtils.JSON_FIELD_ANSWERS); - String[] answers = new String[JsonUtils.NUM_ANSWER_CHOICES]; - for (int j = 0; j < answersJsonArray.length(); j++) { - answers[j] = answersJsonArray.getString(j); - } - int correctIndex = questionObject.getInt(JsonUtils.JSON_FIELD_CORRECT_INDEX); - return new Question(question, questionIndex, answers, correctIndex); - } - - @Override - public int compareTo(Question that) { - return this.questionIndex - that.questionIndex; - } - - public PutDataRequest toPutDataRequest() { - PutDataMapRequest request = PutDataMapRequest.create("/question/" + questionIndex); - DataMap dataMap = request.getDataMap(); - dataMap.putString(QUESTION, question); - dataMap.putInt(QUESTION_INDEX, questionIndex); - dataMap.putStringArray(ANSWERS, answers); - dataMap.putInt(CORRECT_ANSWER_INDEX, correctAnswerIndex); - return request.asPutDataRequest(); - } - } - - /** - * Create a quiz, as defined in Quiz.json, when the user clicks on "Read quiz from file." - * @throws IOException - */ - public void readQuizFromFile(View view) throws IOException, JSONException { - clearQuizStatus(); - JSONObject jsonObject = JsonUtils.loadJsonFile(this, QUIZ_JSON_FILE); - JSONArray jsonArray = jsonObject.getJSONArray(JsonUtils.JSON_FIELD_QUESTIONS); - for (int i = 0; i < jsonArray.length(); i++) { - JSONObject questionObject = jsonArray.getJSONObject(i); - Question question = Question.fromJson(questionObject, mQuestionIndex++); - addQuestionDataItem(question); - setNewQuestionStatus(question.question); - } - } - - /** - * Adds a question (with answer choices) when user clicks on "Add Question." - */ - public void addQuestion(View view) { - // Retrieve the question and answers supplied by the user. - String question = questionEditText.getText().toString(); - String[] answers = new String[4]; - answers[0] = choiceAEditText.getText().toString(); - answers[1] = choiceBEditText.getText().toString(); - answers[2] = choiceCEditText.getText().toString(); - answers[3] = choiceDEditText.getText().toString(); - int correctAnswerIndex = radioIdToIndex.get(choicesRadioGroup.getCheckedRadioButtonId()); - - addQuestionDataItem(new Question(question, mQuestionIndex++, answers, correctAnswerIndex)); - setNewQuestionStatus(question); - - // Clear the edit boxes to let the user input a new question. - questionEditText.setText(""); - choiceAEditText.setText(""); - choiceBEditText.setText(""); - choiceCEditText.setText(""); - choiceDEditText.setText(""); - } - - /** - * Adds the questions (and answers) to the wearable's stream by creating a Data Item - * that will be received on the wearable, which will create corresponding notifications. - */ - private void addQuestionDataItem(Question question) { - if (!mHasQuestionBeenAsked) { - // Ask the question now. - Wearable.DataApi.putDataItem(mGoogleApiClient, question.toPutDataRequest()); - setHasQuestionBeenAsked(true); - } else { - // Enqueue the question to be asked in the future. - mFutureQuestions.add(question); - } - } - - /** - * Sets the question's status to be the default "unanswered." This will be updated when the - * user chooses an answer for the question on the wearable. - */ - private void setNewQuestionStatus(String question) { - quizStatus.setVisibility(View.VISIBLE); - quizButtons.setVisibility(View.VISIBLE); - LayoutInflater inflater = LayoutInflater.from(this); - View questionStatusElem = inflater.inflate(R.layout.question_status_element, null, false); - ((TextView) questionStatusElem.findViewById(R.id.question)).setText(question); - ((TextView) questionStatusElem.findViewById(R.id.status)) - .setText(R.string.question_unanswered); - questionsContainer.addView(questionStatusElem); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents); - dataEvents.close(); - runOnUiThread(new Runnable() { - @Override - public void run() { - for (DataEvent event : events) { - if (event.getType() == DataEvent.TYPE_CHANGED) { - DataMap dataMap = DataMapItem.fromDataItem(event.getDataItem()) - .getDataMap(); - boolean questionWasAnswered = dataMap.getBoolean(QUESTION_WAS_ANSWERED); - boolean questionWasDeleted = dataMap.getBoolean(QUESTION_WAS_DELETED); - if (questionWasAnswered) { - // Update the answered question's status. - int questionIndex = dataMap.getInt(QUESTION_INDEX); - boolean questionCorrect = dataMap.getBoolean(CHOSEN_ANSWER_CORRECT); - updateQuestionStatus(questionIndex, questionCorrect); - askNextQuestionIfExists(); - } else if (questionWasDeleted) { - // Update the deleted question's status by marking it as left blank. - int questionIndex = dataMap.getInt(QUESTION_INDEX); - markQuestionLeftBlank(questionIndex); - askNextQuestionIfExists(); - } - } - } - } - }); - } - - /** - * Updates the given question based on whether it was answered correctly or not. - * This involves changing the question's text color and changing the status text for it. - */ - public void updateQuestionStatus(int questionIndex, boolean questionCorrect) { - LinearLayout questionStatusElement = (LinearLayout) - questionsContainer.getChildAt(questionIndex); - TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question); - TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status); - if (questionCorrect) { - questionText.setTextColor(Color.GREEN); - questionStatus.setText(R.string.question_correct); - mNumCorrect++; - } else { - questionText.setTextColor(Color.RED); - questionStatus.setText(R.string.question_incorrect); - mNumIncorrect++; - } - } - - /** - * Marks a question as "left blank" when its corresponding question notification is deleted. - */ - private void markQuestionLeftBlank(int index) { - LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(index); - if (questionStatusElement != null) { - TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question); - TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status); - if (questionStatus.getText().equals(getString(R.string.question_unanswered))) { - questionText.setTextColor(Color.YELLOW); - questionStatus.setText(R.string.question_left_blank); - mNumSkipped++; - } - } - } - - /** - * Asks the next enqueued question if it exists, otherwise ends the quiz. - */ - private void askNextQuestionIfExists() { - if (mFutureQuestions.isEmpty()) { - // Quiz has been completed - send message to wearable to display end report. - DataMap dataMap = new DataMap(); - dataMap.putInt(NUM_CORRECT, mNumCorrect); - dataMap.putInt(NUM_INCORRECT, mNumIncorrect); - dataMap.putInt(NUM_SKIPPED, mNumSkipped); - sendMessageToWearable(QUIZ_ENDED_PATH, dataMap.toByteArray()); - setHasQuestionBeenAsked(false); - } else { - // Ask next question by putting a DataItem that will be received on the wearable. - Wearable.DataApi.putDataItem(mGoogleApiClient, - mFutureQuestions.remove().toPutDataRequest()); - setHasQuestionBeenAsked(true); - } - } - - private void sendMessageToWearable(final String path, final byte[] data) { - Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).setResultCallback( - new ResultCallback<NodeApi.GetConnectedNodesResult>() { - @Override - public void onResult(NodeApi.GetConnectedNodesResult nodes) { - for (Node node : nodes.getNodes()) { - Wearable.MessageApi.sendMessage(mGoogleApiClient, node.getId(), path, data); - } - - if (path.equals(QUIZ_EXITED_PATH) && mGoogleApiClient.isConnected()) { - mGoogleApiClient.disconnect(); - } - } - }); - } - - /** - * Resets the current quiz when Reset Quiz is pressed. - */ - public void resetQuiz(View view) { - // Reset quiz status in phone layout. - for(int i = 0; i < questionsContainer.getChildCount(); i++) { - LinearLayout questionStatusElement = (LinearLayout) questionsContainer.getChildAt(i); - TextView questionText = (TextView) questionStatusElement.findViewById(R.id.question); - TextView questionStatus = (TextView) questionStatusElement.findViewById(R.id.status); - questionText.setTextColor(Color.WHITE); - questionStatus.setText(R.string.question_unanswered); - } - // Reset data items and notifications on wearable. - if (mGoogleApiClient.isConnected()) { - Wearable.DataApi.getDataItems(mGoogleApiClient) - .setResultCallback(new ResultCallback<DataItemBuffer>() { - @Override - public void onResult(DataItemBuffer result) { - if (result.getStatus().isSuccess()) { - List<DataItem> dataItemList = FreezableUtils.freezeIterable(result); - result.close(); - resetDataItems(dataItemList); - } else { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Reset quiz: failed to get Data Items to reset"); - } - } - result.close(); - } - }); - } else { - Log.e(TAG, "Failed to reset data items because client is disconnected from " - + "Google Play Services"); - } - setHasQuestionBeenAsked(false); - mNumCorrect = 0; - mNumIncorrect = 0; - mNumSkipped = 0; - } - - private void resetDataItems(List<DataItem> dataItemList) { - if (mGoogleApiClient.isConnected()) { - for (final DataItem dataItem : dataItemList) { - final Uri dataItemUri = dataItem.getUri(); - Wearable.DataApi.getDataItem(mGoogleApiClient, dataItemUri) - .setResultCallback(new ResetDataItemCallback()); - } - } else { - Log.e(TAG, "Failed to reset data items because client is disconnected from " - + "Google Play Services"); - } - } - - /** - * Callback that marks a DataItem, which represents a question, as unanswered and not deleted. - */ - private class ResetDataItemCallback implements ResultCallback<DataApi.DataItemResult> { - @Override - public void onResult(DataApi.DataItemResult dataItemResult) { - if (dataItemResult.getStatus().isSuccess()) { - PutDataMapRequest request = PutDataMapRequest.createFromDataMapItem( - DataMapItem.fromDataItem(dataItemResult.getDataItem())); - DataMap dataMap = request.getDataMap(); - dataMap.putBoolean(QUESTION_WAS_ANSWERED, false); - dataMap.putBoolean(QUESTION_WAS_DELETED, false); - if (!mHasQuestionBeenAsked && dataMap.getInt(QUESTION_INDEX) == 0) { - // Ask the first question now. - Wearable.DataApi.putDataItem(mGoogleApiClient, request.asPutDataRequest()); - setHasQuestionBeenAsked(true); - } else { - // Enqueue future questions. - mFutureQuestions.add(new Question(dataMap.getString(QUESTION), - dataMap.getInt(QUESTION_INDEX), dataMap.getStringArray(ANSWERS), - dataMap.getInt(CORRECT_ANSWER_INDEX))); - } - } else { - Log.e(TAG, "Failed to reset data item " + dataItemResult.getDataItem().getUri()); - } - } - } - - /** - * Clears the current quiz when user clicks on "New Quiz." - * On this end, this involves clearing the quiz status layout and deleting all DataItems. The - * wearable will then remove any outstanding question notifications upon receiving this change. - */ - public void newQuiz(View view) { - clearQuizStatus(); - if (mGoogleApiClient.isConnected()) { - Wearable.DataApi.getDataItems(mGoogleApiClient) - .setResultCallback(new ResultCallback<DataItemBuffer>() { - @Override - public void onResult(DataItemBuffer result) { - if (result.getStatus().isSuccess()) { - List<Uri> dataItemUriList = new ArrayList<Uri>(); - for (final DataItem dataItem : result) { - dataItemUriList.add(dataItem.getUri()); - } - result.close(); - deleteDataItems(dataItemUriList); - } else { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Clear quiz: failed to get Data Items for deletion"); - } - } - result.close(); - } - }); - } else { - Log.e(TAG, "Failed to delete data items because client is disconnected from " - + "Google Play Services"); - } - } - - /** - * Removes quiz status views (i.e. the views describing the status of each question). - */ - private void clearQuizStatus() { - questionsContainer.removeAllViews(); - quizStatus.setVisibility(View.INVISIBLE); - quizButtons.setVisibility(View.INVISIBLE); - setHasQuestionBeenAsked(false); - mFutureQuestions.clear(); - mQuestionIndex = 0; - mNumCorrect = 0; - mNumIncorrect = 0; - mNumSkipped = 0; - } - - private void deleteDataItems(List<Uri> dataItemUriList) { - if (mGoogleApiClient.isConnected()) { - for (final Uri dataItemUri : dataItemUriList) { - Wearable.DataApi.deleteDataItems(mGoogleApiClient, dataItemUri) - .setResultCallback(new ResultCallback<DataApi.DeleteDataItemsResult>() { - @Override - public void onResult(DataApi.DeleteDataItemsResult deleteResult) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - if (deleteResult.getStatus().isSuccess()) { - Log.d(TAG, "Successfully deleted data item " + dataItemUri); - } else { - Log.d(TAG, "Failed to delete data item " + dataItemUri); - } - } - } - }); - } - } else { - Log.e(TAG, "Failed to delete data items because client is disconnected from " - + "Google Play Services"); - } - } - - private void setHasQuestionBeenAsked(boolean b) { - mHasQuestionBeenAsked = b; - // Only let user click on Reset or Read from file if they have answered all the questions. - readQuizFromFileButton.setEnabled(!mHasQuestionBeenAsked); - resetQuizButton.setEnabled(!mHasQuestionBeenAsked); - } -} diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_a.png b/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_a.png Binary files differdeleted file mode 100644 index de18ce11a..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_a.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_b.png b/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_b.png Binary files differdeleted file mode 100644 index 3cdfe9750..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_b.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_c.png b/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_c.png Binary files differdeleted file mode 100644 index f0ed2ef99..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_c.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_d.png b/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_d.png Binary files differdeleted file mode 100644 index c158d2953..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_choice_d.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 91a8cff95..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_unknown_choice.png b/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_unknown_choice.png Binary files differdeleted file mode 100644 index 9aed51728..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-hdpi/ic_unknown_choice.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_a.png b/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_a.png Binary files differdeleted file mode 100644 index 57459365c..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_a.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_b.png b/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_b.png Binary files differdeleted file mode 100644 index 958b92e31..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_b.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_c.png b/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_c.png Binary files differdeleted file mode 100644 index 9fcfab754..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_c.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_d.png b/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_d.png Binary files differdeleted file mode 100644 index 821cadb78..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_choice_d.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 728ee6d73..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_unknown_choice.png b/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_unknown_choice.png Binary files differdeleted file mode 100644 index b8030ef08..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-mdpi/ic_unknown_choice.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_a.png b/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_a.png Binary files differdeleted file mode 100644 index 3dba96f32..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_a.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_b.png b/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_b.png Binary files differdeleted file mode 100644 index 9ca3c85f2..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_b.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_c.png b/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_c.png Binary files differdeleted file mode 100644 index b84b3b76d..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_c.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_d.png b/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_d.png Binary files differdeleted file mode 100644 index 185e91ec8..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_choice_d.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 64a585453..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/Quiz/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 86a395bb6..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable/selected_background.xml b/samples/wearable/Quiz/Application/src/main/res/drawable/selected_background.xml deleted file mode 100644 index 5852dd89a..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable/selected_background.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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <padding - android:top="4dp" - android:bottom="4dp" - android:left="4dp" - android:right="4dp"/> - <stroke - android:width="4dp" - android:color="@android:color/holo_blue_bright" /> -</shape> diff --git a/samples/wearable/Quiz/Application/src/main/res/drawable/unselected_background.xml b/samples/wearable/Quiz/Application/src/main/res/drawable/unselected_background.xml deleted file mode 100644 index 161316759..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/drawable/unselected_background.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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <padding - android:top="4dp" - android:bottom="4dp" - android:left="4dp" - android:right="4dp"/> - <stroke - android:width="4dp" - android:color="#ff000000" /> -</shape> diff --git a/samples/wearable/Quiz/Application/src/main/res/layout/activity_main.xml b/samples/wearable/Quiz/Application/src/main/res/layout/activity_main.xml deleted file mode 100644 index 3eb19f9bb..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/layout/activity_main.xml +++ /dev/null @@ -1,168 +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. ---> - -<ScrollView 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:paddingBottom="@dimen/activity_vertical_margin" - android:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - tools:context="com.example.android.support.wearable.quiz.MainActivity" - tools:ignore="MergeRootFrame"> - - <LinearLayout android:id="@+id/container" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/read_quiz_from_file_button" - android:text="@string/read_from_file_button" - android:onClick="readQuizFromFile" - android:layout_gravity="center"/> - - <LinearLayout - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceLarge" - android:text="@string/edit_question" - android:id="@+id/textView2" /> - - <EditText - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/question_text" /> - </LinearLayout> - - <LinearLayout - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <RadioGroup - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - android:id="@+id/choices_radio_group"> - <RadioButton - android:layout_width="wrap_content" - android:layout_height="50dp" - android:text="@string/edit_choice_a" - android:id="@+id/choice_a_radio" - android:checked="true" /> - <RadioButton - android:layout_width="wrap_content" - android:layout_height="50dp" - android:text="@string/edit_choice_b" - android:id="@+id/choice_b_radio" - android:checked="false" /> - <RadioButton - android:layout_width="wrap_content" - android:layout_height="50dp" - android:text="@string/edit_choice_c" - android:id="@+id/choice_c_radio" /> - <RadioButton - android:layout_width="wrap_content" - android:layout_height="50dp" - android:text="@string/edit_choice_d" - android:id="@+id/choice_d_radio" /> - </RadioGroup> - - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - <EditText - android:layout_width="match_parent" - android:layout_height="50dp" - android:id="@+id/choice_a_text" /> - <EditText - android:layout_width="match_parent" - android:layout_height="50dp" - android:id="@+id/choice_b_text" /> - <EditText - android:layout_width="match_parent" - android:layout_height="50dp" - android:id="@+id/choice_c_text" /> - <EditText - android:layout_width="match_parent" - android:layout_height="50dp" - android:id="@+id/choice_d_text" /> - </LinearLayout> - - - </LinearLayout> - - <Button android:id="@+id/add_question" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:text="@string/add_question" - android:onClick="addQuestion" - android:layout_gravity="center"> - </Button> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceLarge" - android:text="@string/quiz_status" - android:id="@+id/quiz_status" - android:paddingTop="30dp" - android:paddingBottom="10dp" - android:visibility="invisible"/> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/questions_container" - android:orientation="vertical" - android:paddingBottom="10dp"> - </LinearLayout> - - <LinearLayout - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:id="@+id/quiz_buttons" - android:layout_gravity="center" - android:visibility="invisible"> - <Button android:id="@+id/reset_quiz_button" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:text="@string/reset_quiz" - android:onClick="resetQuiz"> - </Button> - <Button android:id="@+id/new_quiz_button" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:text="@string/new_quiz" - android:onClick="newQuiz"> - </Button> - </LinearLayout> - - - </LinearLayout> - -</ScrollView> diff --git a/samples/wearable/Quiz/Application/src/main/res/layout/question_status_element.xml b/samples/wearable/Quiz/Application/src/main/res/layout/question_status_element.xml deleted file mode 100644 index 280f44ad7..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/layout/question_status_element.xml +++ /dev/null @@ -1,34 +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. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="match_parent"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceMedium" - android:text="@string/question_placeholder" - android:id="@+id/question" /> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textAppearance="?android:attr/textAppearanceSmall" - android:text="@string/question_unanswered" - android:id="@+id/status" /> -</LinearLayout> diff --git a/samples/wearable/Quiz/Application/src/main/res/values/dimens.xml b/samples/wearable/Quiz/Application/src/main/res/values/dimens.xml deleted file mode 100644 index fd97910ac..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/values/dimens.xml +++ /dev/null @@ -1,29 +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. ---> - -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> - - <dimen name="editor_text_size">12dp</dimen> - <dimen name="editor_item_padding_top">8dp</dimen> - <dimen name="editor_item_padding_bottom">8dp</dimen> - <dimen name="editor_spinner_caption_min_width">50dp</dimen> - - <dimen name="image_picker_item_side">48dp</dimen> - -</resources> diff --git a/samples/wearable/Quiz/Application/src/main/res/values/strings.xml b/samples/wearable/Quiz/Application/src/main/res/values/strings.xml deleted file mode 100644 index 7c0c2452b..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,40 +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. ---> - -<resources> - - <string name="app_name">Quiz</string> - - <string name="read_from_file_button">Read quiz from file</string> - - <string name="edit_question">Question</string> - <string name="edit_choice_a">Choice A</string> - <string name="edit_choice_b">Choice B</string> - <string name="edit_choice_c">Choice C</string> - <string name="edit_choice_d">Choice D</string> - <string name="add_question">Add Question</string> - - <string name="quiz_status">Quiz Status</string> - <string name="question_placeholder">Question</string> - <string name="question_unanswered">This question has not yet been answered.</string> - <string name="question_incorrect">This question has been answered incorrectly.</string> - <string name="question_correct">This question has been answered correctly!</string> - <string name="question_left_blank">This question was left blank.</string> - - <string name="reset_quiz">Reset Quiz</string> - <string name="new_quiz">New Quiz</string> - -</resources> diff --git a/samples/wearable/Quiz/Application/src/main/res/values/styles.xml b/samples/wearable/Quiz/Application/src/main/res/values/styles.xml deleted file mode 100644 index cf0494b4b..000000000 --- a/samples/wearable/Quiz/Application/src/main/res/values/styles.xml +++ /dev/null @@ -1,29 +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. ---> - -<resources> - - <!-- Base application theme. --> - <style name="AppTheme" parent="android:Theme.Holo"> - <!-- Customize your theme here. --> - </style> - - <style name="bg_picker"> - <item name="android:layout_marginLeft">16dp</item> - <item name="android:background">@drawable/unselected_background</item> - </style> - -</resources> diff --git a/samples/wearable/Quiz/Wearable/build.gradle b/samples/wearable/Quiz/Wearable/build.gradle deleted file mode 100644 index de43728e0..000000000 --- a/samples/wearable/Quiz/Wearable/build.gradle +++ /dev/null @@ -1,25 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile 'com.google.android.gms:play-services-wearable:+' - compile "com.google.android.support:wearable:1.0.+" -} diff --git a/samples/wearable/Quiz/Wearable/proguard-rules.txt b/samples/wearable/Quiz/Wearable/proguard-rules.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/samples/wearable/Quiz/Wearable/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/Quiz/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Quiz/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 3b8a3184f..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,42 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.quiz" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault" > - <meta-data - android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - - <service android:name=".QuizListenerService" > - <intent-filter> - <action android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - </service> - <service android:name=".UpdateQuestionService" /> - <service android:name=".DeleteQuestionService" /> - <service android:name=".QuizReportActionService" /> - - </application> - -</manifest> diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/Constants.java b/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/Constants.java deleted file mode 100644 index 8b81f59be..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/Constants.java +++ /dev/null @@ -1,41 +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.quiz; - -/** Constants used in the wearable app. */ -public final class Constants { - private Constants() { - } - - public static final String ANSWERS = "answers"; - public static final String CHOSEN_ANSWER_CORRECT = "chosen_answer_correct"; - public static final String CORRECT_ANSWER_INDEX = "correct_answer_index"; - public static final String QUESTION = "question"; - public static final String QUESTION_INDEX = "question_index"; - public static final String QUESTION_WAS_ANSWERED = "question_was_answered"; - public static final String QUESTION_WAS_DELETED = "question_was_deleted"; - - public static final String NUM_CORRECT = "num_correct"; - public static final String NUM_INCORRECT = "num_incorrect"; - public static final String NUM_SKIPPED = "num_skipped"; - - public static final String QUIZ_ENDED_PATH = "/quiz_ended"; - public static final String QUIZ_EXITED_PATH = "/quiz_exited"; - public static final String RESET_QUIZ_PATH = "/reset_quiz"; - - public static final int CONNECT_TIMEOUT_MS = 100; -} diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/DeleteQuestionService.java b/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/DeleteQuestionService.java deleted file mode 100644 index 78e81ca0c..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/DeleteQuestionService.java +++ /dev/null @@ -1,94 +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.quiz; - -import android.app.IntentService; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.DataMapItem; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.PutDataRequest; -import com.google.android.gms.wearable.Wearable; - -import java.util.concurrent.TimeUnit; - -import static com.example.android.wearable.quiz.Constants.CONNECT_TIMEOUT_MS; -import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_DELETED; - -/** - * Used to update quiz status on the phone when user dismisses a question on the watch. - */ -public class DeleteQuestionService extends IntentService - implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { - - private static final String TAG = "DeleteQuestionReceiver"; - - private GoogleApiClient mGoogleApiClient; - - public DeleteQuestionService() { - super(DeleteQuestionService.class.getSimpleName()); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - public void onHandleIntent(Intent intent) { - mGoogleApiClient.blockingConnect(CONNECT_TIMEOUT_MS, TimeUnit.MILLISECONDS); - Uri dataItemUri = intent.getData(); - if (!mGoogleApiClient.isConnected()) { - Log.e(TAG, "Failed to update data item " + dataItemUri - + " because client is disconnected from Google Play Services"); - return; - } - DataApi.DataItemResult dataItemResult = Wearable.DataApi.getDataItem( - mGoogleApiClient, dataItemUri).await(); - PutDataMapRequest putDataMapRequest = PutDataMapRequest - .createFromDataMapItem(DataMapItem.fromDataItem(dataItemResult.getDataItem())); - DataMap dataMap = putDataMapRequest.getDataMap(); - dataMap.putBoolean(QUESTION_WAS_DELETED, true); - PutDataRequest request = putDataMapRequest.asPutDataRequest(); - Wearable.DataApi.putDataItem(mGoogleApiClient, request).await(); - mGoogleApiClient.disconnect(); - } - - @Override - public void onConnected(Bundle bundle) { - } - - @Override - public void onConnectionSuspended(int i) { - } - - @Override - public void onConnectionFailed(ConnectionResult connectionResult) { - } -} diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizListenerService.java b/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizListenerService.java deleted file mode 100644 index 020a37b8d..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizListenerService.java +++ /dev/null @@ -1,219 +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.quiz; - -import static com.example.android.wearable.quiz.Constants.ANSWERS; -import static com.example.android.wearable.quiz.Constants.CONNECT_TIMEOUT_MS; -import static com.example.android.wearable.quiz.Constants.CORRECT_ANSWER_INDEX; -import static com.example.android.wearable.quiz.Constants.NUM_CORRECT; -import static com.example.android.wearable.quiz.Constants.NUM_INCORRECT; -import static com.example.android.wearable.quiz.Constants.NUM_SKIPPED; -import static com.example.android.wearable.quiz.Constants.QUESTION; -import static com.example.android.wearable.quiz.Constants.QUESTION_INDEX; -import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_ANSWERED; -import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_DELETED; -import static com.example.android.wearable.quiz.Constants.QUIZ_ENDED_PATH; -import static com.example.android.wearable.quiz.Constants.QUIZ_EXITED_PATH; - -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Intent; -import android.net.Uri; -import android.text.SpannableStringBuilder; -import android.text.style.ForegroundColorSpan; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.data.FreezableUtils; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.DataItem; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.DataMapItem; -import com.google.android.gms.wearable.MessageEvent; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.WearableListenerService; - -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.TimeUnit; - -/** - * Listens to changes in DataItems, which represent quiz questions. - * If a new question is created, this builds a new notification for it. - * Otherwise, if a question is deleted, this cancels the corresponding notification. - * - * When the quiz ends, this listener receives a message telling it to create an end-of-quiz report. - */ -public class QuizListenerService extends WearableListenerService { - private static final String TAG = "QuizSample"; - private static final int QUIZ_REPORT_NOTIF_ID = -1; // Never used by question notifications. - private static final Map<Integer, Integer> questionNumToDrawableId; - - static { - Map<Integer, Integer> temp = new HashMap<Integer, Integer>(4); - temp.put(0, R.drawable.ic_choice_a); - temp.put(1, R.drawable.ic_choice_b); - temp.put(2, R.drawable.ic_choice_c); - temp.put(3, R.drawable.ic_choice_d); - questionNumToDrawableId = Collections.unmodifiableMap(temp); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - final List<DataEvent> events = FreezableUtils.freezeIterable(dataEvents); - dataEvents.close(); - - GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .build(); - - ConnectionResult connectionResult = googleApiClient.blockingConnect(CONNECT_TIMEOUT_MS, - TimeUnit.MILLISECONDS); - if (!connectionResult.isSuccess()) { - Log.e(TAG, "QuizListenerService failed to connect to GoogleApiClient."); - return; - } - - for (DataEvent event : events) { - if (event.getType() == DataEvent.TYPE_CHANGED) { - DataItem dataItem = event.getDataItem(); - DataMap dataMap = DataMapItem.fromDataItem(dataItem).getDataMap(); - if (dataMap.getBoolean(QUESTION_WAS_ANSWERED) - || dataMap.getBoolean(QUESTION_WAS_DELETED)) { - // Ignore the change in data; it is used in MainActivity to update - // the question's status (i.e. was the answer right or wrong or left blank). - continue; - } - String question = dataMap.getString(QUESTION); - int questionIndex = dataMap.getInt(QUESTION_INDEX); - int questionNum = questionIndex + 1; - String[] answers = dataMap.getStringArray(ANSWERS); - int correctAnswerIndex = dataMap.getInt(CORRECT_ANSWER_INDEX); - Intent deleteOperation = new Intent(this, DeleteQuestionService.class); - deleteOperation.setData(dataItem.getUri()); - PendingIntent deleteIntent = PendingIntent.getService(this, 0, - deleteOperation, PendingIntent.FLAG_UPDATE_CURRENT); - // First page of notification contains question as Big Text. - Notification.BigTextStyle bigTextStyle = new Notification.BigTextStyle() - .setBigContentTitle(getString(R.string.question, questionNum)) - .bigText(question); - Notification.Builder builder = new Notification.Builder(this) - .setStyle(bigTextStyle) - .setSmallIcon(R.drawable.ic_launcher) - .setLocalOnly(true) - .setDeleteIntent(deleteIntent); - - // Add answers as actions. - Notification.WearableExtender wearableOptions = new Notification.WearableExtender(); - for (int i = 0; i < answers.length; i++) { - Notification answerPage = new Notification.Builder(this) - .setContentTitle(question) - .setContentText(answers[i]) - .extend(new Notification.WearableExtender() - .setContentAction(i)) - .build(); - - boolean correct = (i == correctAnswerIndex); - Intent updateOperation = new Intent(this, UpdateQuestionService.class); - // Give each intent a unique action. - updateOperation.setAction("question_" + questionIndex + "_answer_" + i); - updateOperation.setData(dataItem.getUri()); - updateOperation.putExtra(UpdateQuestionService.EXTRA_QUESTION_INDEX, - questionIndex); - updateOperation.putExtra(UpdateQuestionService.EXTRA_QUESTION_CORRECT, correct); - PendingIntent updateIntent = PendingIntent.getService(this, 0, updateOperation, - PendingIntent.FLAG_UPDATE_CURRENT); - Notification.Action action = new Notification.Action.Builder( - questionNumToDrawableId.get(i), null, updateIntent) - .build(); - wearableOptions.addAction(action).addPage(answerPage); - } - builder.extend(wearableOptions); - Notification notification = builder.build(); - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(questionIndex, notification); - } else if (event.getType() == DataEvent.TYPE_DELETED) { - Uri uri = event.getDataItem().getUri(); - // URI's are of the form "/question/0", "/question/1" etc. - // We use the question index as the notification id. - int notificationId = Integer.parseInt(uri.getLastPathSegment()); - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .cancel(notificationId); - } - // Delete the quiz report, if it exists. - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .cancel(QUIZ_REPORT_NOTIF_ID); - } - googleApiClient.disconnect(); - } - - @Override - public void onMessageReceived(MessageEvent messageEvent) { - String path = messageEvent.getPath(); - if (path.equals(QUIZ_EXITED_PATH)) { - // Remove any lingering question notifications. - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancelAll(); - } - if (path.equals(QUIZ_ENDED_PATH) || path.equals(QUIZ_EXITED_PATH)) { - // Quiz ended - display overall results. - DataMap dataMap = DataMap.fromByteArray(messageEvent.getData()); - int numCorrect = dataMap.getInt(NUM_CORRECT); - int numIncorrect = dataMap.getInt(NUM_INCORRECT); - int numSkipped = dataMap.getInt(NUM_SKIPPED); - - Notification.Builder builder = new Notification.Builder(this) - .setContentTitle(getString(R.string.quiz_report)) - .setSmallIcon(R.drawable.ic_launcher) - .setLocalOnly(true); - SpannableStringBuilder quizReportText = new SpannableStringBuilder(); - appendColored(quizReportText, String.valueOf(numCorrect), R.color.dark_green); - quizReportText.append(" " + getString(R.string.correct) + "\n"); - appendColored(quizReportText, String.valueOf(numIncorrect), R.color.dark_red); - quizReportText.append(" " + getString(R.string.incorrect) + "\n"); - appendColored(quizReportText, String.valueOf(numSkipped), R.color.dark_yellow); - quizReportText.append(" " + getString(R.string.skipped) + "\n"); - - builder.setContentText(quizReportText); - if (!path.equals(QUIZ_EXITED_PATH)) { - // Don't add reset option if user exited quiz (there might not be a quiz to reset!). - builder.addAction(R.drawable.ic_launcher, - getString(R.string.reset_quiz), getResetQuizPendingIntent()); - } - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(QUIZ_REPORT_NOTIF_ID, builder.build()); - } - } - - private void appendColored(SpannableStringBuilder builder, String text, int colorResId) { - builder.append(text).setSpan(new ForegroundColorSpan(getResources().getColor(colorResId)), - builder.length() - text.length(), builder.length(), 0); - } - - /** - * Returns a PendingIntent that will send a message to the phone to reset the quiz when fired. - */ - private PendingIntent getResetQuizPendingIntent() { - Intent intent = new Intent(QuizReportActionService.ACTION_RESET_QUIZ) - .setClass(this, QuizReportActionService.class); - return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); - } -} diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizReportActionService.java b/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizReportActionService.java deleted file mode 100644 index 956bdaf38..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/QuizReportActionService.java +++ /dev/null @@ -1,67 +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.quiz; - -import android.app.IntentService; -import android.content.Intent; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.Node; -import com.google.android.gms.wearable.NodeApi; -import com.google.android.gms.wearable.Wearable; - -import java.util.concurrent.TimeUnit; - -import static com.example.android.wearable.quiz.Constants.CONNECT_TIMEOUT_MS; -import static com.example.android.wearable.quiz.Constants.RESET_QUIZ_PATH; - -/** - * Service to reset the quiz (by sending a message to the phone) when the Reset Quiz - * action on the Quiz Report is selected. - */ -public class QuizReportActionService extends IntentService { - public static final String ACTION_RESET_QUIZ = "com.example.android.wearable.quiz.RESET_QUIZ"; - - private static final String TAG = "QuizReportActionReceiver"; - - public QuizReportActionService() { - super(QuizReportActionService.class.getSimpleName()); - } - - @Override - public void onHandleIntent(Intent intent) { - if (intent.getAction().equals(ACTION_RESET_QUIZ)) { - GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .build(); - ConnectionResult result = googleApiClient.blockingConnect(CONNECT_TIMEOUT_MS, - TimeUnit.MILLISECONDS); - if (!result.isSuccess()) { - Log.e(TAG, "QuizListenerService failed to connect to GoogleApiClient."); - return; - } - NodeApi.GetConnectedNodesResult nodes = - Wearable.NodeApi.getConnectedNodes(googleApiClient).await(); - for (Node node : nodes.getNodes()) { - Wearable.MessageApi.sendMessage(googleApiClient, node.getId(), RESET_QUIZ_PATH, - new byte[0]); - } - } - } -} diff --git a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/UpdateQuestionService.java b/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/UpdateQuestionService.java deleted file mode 100644 index e06c30346..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/java/com/example/android/wearable/quiz/UpdateQuestionService.java +++ /dev/null @@ -1,108 +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.quiz; - -import android.app.IntentService; -import android.app.NotificationManager; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.util.Log; - -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.DataMapItem; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.PutDataRequest; -import com.google.android.gms.wearable.Wearable; - -import java.util.concurrent.TimeUnit; - -import static com.example.android.wearable.quiz.Constants.CHOSEN_ANSWER_CORRECT; -import static com.example.android.wearable.quiz.Constants.QUESTION_INDEX; -import static com.example.android.wearable.quiz.Constants.QUESTION_WAS_ANSWERED; - -/** - * Updates quiz status on the phone when user selects an answer to a question on the watch. - */ -public class UpdateQuestionService extends IntentService - implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener { - public static final String EXTRA_QUESTION_CORRECT = "extra_question_correct"; - public static final String EXTRA_QUESTION_INDEX = "extra_question_index"; - - private static final long TIME_OUT_MS = 100; - private static final String TAG = "UpdateQuestionService"; - - private GoogleApiClient mGoogleApiClient; - - public UpdateQuestionService() { - super(UpdateQuestionService.class.getSimpleName()); - } - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - protected void onHandleIntent(Intent intent) { - mGoogleApiClient.blockingConnect(TIME_OUT_MS, TimeUnit.MILLISECONDS); - Uri dataItemUri = intent.getData(); - if (!mGoogleApiClient.isConnected()) { - Log.e(TAG, "Failed to update data item " + dataItemUri - + " because client is disconnected from Google Play Services"); - return; - } - DataApi.DataItemResult dataItemResult = Wearable.DataApi.getDataItem( - mGoogleApiClient, dataItemUri).await(); - PutDataMapRequest putDataMapRequest = PutDataMapRequest - .createFromDataMapItem(DataMapItem.fromDataItem(dataItemResult.getDataItem())); - DataMap dataMap = putDataMapRequest.getDataMap(); - - // Update quiz status variables, which will be reflected on the phone. - int questionIndex = intent.getIntExtra(EXTRA_QUESTION_INDEX, -1); - boolean chosenAnswerCorrect = intent.getBooleanExtra(EXTRA_QUESTION_CORRECT, false); - dataMap.putInt(QUESTION_INDEX, questionIndex); - dataMap.putBoolean(CHOSEN_ANSWER_CORRECT, chosenAnswerCorrect); - dataMap.putBoolean(QUESTION_WAS_ANSWERED, true); - PutDataRequest request = putDataMapRequest.asPutDataRequest(); - Wearable.DataApi.putDataItem(mGoogleApiClient, request).await(); - - // Remove this question notification. - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)).cancel(questionIndex); - mGoogleApiClient.disconnect(); - } - - @Override - public void onConnected(Bundle connectionHint) { - } - - @Override - public void onConnectionSuspended(int cause) { - } - - @Override - public void onConnectionFailed(ConnectionResult result) { - } -} diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_a.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_a.png Binary files differdeleted file mode 100644 index de18ce11a..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_a.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_b.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_b.png Binary files differdeleted file mode 100644 index 3cdfe9750..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_b.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_c.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_c.png Binary files differdeleted file mode 100644 index f0ed2ef99..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_c.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_d.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_d.png Binary files differdeleted file mode 100644 index c158d2953..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_choice_d.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 91a8cff95..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_unknown_choice.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_unknown_choice.png Binary files differdeleted file mode 100644 index 9aed51728..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-hdpi/ic_unknown_choice.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_a.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_a.png Binary files differdeleted file mode 100644 index 57459365c..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_a.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_b.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_b.png Binary files differdeleted file mode 100644 index 958b92e31..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_b.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_c.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_c.png Binary files differdeleted file mode 100644 index 9fcfab754..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_c.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_d.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_d.png Binary files differdeleted file mode 100644 index 821cadb78..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_choice_d.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 728ee6d73..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_unknown_choice.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_unknown_choice.png Binary files differdeleted file mode 100644 index b8030ef08..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-mdpi/ic_unknown_choice.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_a.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_a.png Binary files differdeleted file mode 100644 index 3dba96f32..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_a.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_b.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_b.png Binary files differdeleted file mode 100644 index 9ca3c85f2..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_b.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_c.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_c.png Binary files differdeleted file mode 100644 index b84b3b76d..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_c.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_d.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_d.png Binary files differdeleted file mode 100644 index 185e91ec8..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_choice_d.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 64a585453..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_unknown_choice.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_unknown_choice.png Binary files differdeleted file mode 100644 index 57838d152..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xhdpi/ic_unknown_choice.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/Quiz/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 86a395bb6..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Quiz/Wearable/src/main/res/values/colors.xml b/samples/wearable/Quiz/Wearable/src/main/res/values/colors.xml deleted file mode 100644 index b10adafa3..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/values/colors.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <color name="dark_green">#009900</color> - <color name="dark_red">#800000</color> - <color name="dark_yellow">#FF9900</color> -</resources> diff --git a/samples/wearable/Quiz/Wearable/src/main/res/values/strings.xml b/samples/wearable/Quiz/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 313ee4c29..000000000 --- a/samples/wearable/Quiz/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,29 +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. ---> - -<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> - - <string name="app_name">Quiz Sample Wearable App</string> - - <string name="question">Question %d</string> - - <string name="quiz_report">Quiz Report</string> - <string name="correct">correct</string> - <string name="incorrect">incorrect</string> - <string name="skipped">skipped</string> - <string name="reset_quiz">Reset Quiz</string> - -</resources> diff --git a/samples/wearable/Quiz/_index.html b/samples/wearable/Quiz/_index.html deleted file mode 100644 index 98746112a..000000000 --- a/samples/wearable/Quiz/_index.html +++ /dev/null @@ -1,25 +0,0 @@ -<p><b>About:</b> This sample uses Google Play Services Wearable Data APIs to communicate between -applications on a phone and a paired wearable device. Users can create quiz questions on the phone, -each of which has an associated DataItem. These DataItems are then received on the wearable, which -displays them as notifications. Each notification contains the question as the first page, followed -by answers as actions. When an answer is selected, the corresponding question's DataItem is updated, -which allows the phone application to update the status of the question (i.e. did the user answer it -correctly or not) and prompt the next question. -</p> -<p>At the end of the quiz, the sample uses the Google Play Services Wearable Message APIs to create -an end-of-quiz report notification on the wearable, with an option to reset the quiz (by sending a -message back to the phone).</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. Start the sample by running the Quiz application on the companion.</p> -<p><b>Wearable APIs used:</b> DataApi, MessageApi, NodeApi, WearableListenerService</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/companion_quiz.png" alt="Quiz on companion" width="216" height="384"> - <img src="screenshots/wearable_quiz.png" alt="Wearable Quiz" width="160" height="160"> - <img src="screenshots/wearable_quiz_answer.png" alt="Answering..." width="160" height="160"> - <img src="screenshots/companion_quiz_correct_status.png" alt="Quiz on companion" width="216" - height="384"> - <img src="screenshots/wearable_quiz_report.png" alt="End report" width="160" height="160"> - <figcaption>Sample quiz progression involving a clearly unbiased question.</figcaption> - </figure> -</p> diff --git a/samples/wearable/Quiz/build.gradle b/samples/wearable/Quiz/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/Quiz/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/Quiz/gradle.properties b/samples/wearable/Quiz/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/Quiz/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/Quiz/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/Quiz/gradlew b/samples/wearable/Quiz/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/Quiz/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/Quiz/gradlew.bat b/samples/wearable/Quiz/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/Quiz/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Quiz/screenshots/companion_quiz.png b/samples/wearable/Quiz/screenshots/companion_quiz.png Binary files differdeleted file mode 100644 index 15f7e8030..000000000 --- a/samples/wearable/Quiz/screenshots/companion_quiz.png +++ /dev/null diff --git a/samples/wearable/Quiz/screenshots/companion_quiz_correct_status.png b/samples/wearable/Quiz/screenshots/companion_quiz_correct_status.png Binary files differdeleted file mode 100644 index c0e25ca58..000000000 --- a/samples/wearable/Quiz/screenshots/companion_quiz_correct_status.png +++ /dev/null diff --git a/samples/wearable/Quiz/screenshots/wearable_quiz.png b/samples/wearable/Quiz/screenshots/wearable_quiz.png Binary files differdeleted file mode 100644 index 0c631390e..000000000 --- a/samples/wearable/Quiz/screenshots/wearable_quiz.png +++ /dev/null diff --git a/samples/wearable/Quiz/screenshots/wearable_quiz_answer.png b/samples/wearable/Quiz/screenshots/wearable_quiz_answer.png Binary files differdeleted file mode 100644 index eb4751615..000000000 --- a/samples/wearable/Quiz/screenshots/wearable_quiz_answer.png +++ /dev/null diff --git a/samples/wearable/Quiz/screenshots/wearable_quiz_report.png b/samples/wearable/Quiz/screenshots/wearable_quiz_report.png Binary files differdeleted file mode 100644 index 196d04595..000000000 --- a/samples/wearable/Quiz/screenshots/wearable_quiz_report.png +++ /dev/null diff --git a/samples/wearable/Quiz/settings.gradle b/samples/wearable/Quiz/settings.gradle deleted file mode 100644 index d6b72d158..000000000 --- a/samples/wearable/Quiz/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Application', 'Wearable' diff --git a/samples/wearable/RecipeAssistant/Application/build.gradle b/samples/wearable/RecipeAssistant/Application/build.gradle deleted file mode 100644 index 7abc52428..000000000 --- a/samples/wearable/RecipeAssistant/Application/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -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.+" -} diff --git a/samples/wearable/RecipeAssistant/Application/proguard-rules.txt b/samples/wearable/RecipeAssistant/Application/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/RecipeAssistant/Application/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/RecipeAssistant/Application/src/main/AndroidManifest.xml b/samples/wearable/RecipeAssistant/Application/src/main/AndroidManifest.xml deleted file mode 100644 index fd5a1638c..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,41 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.recipeassistant" > - - <application - android:allowBackup="true" - android:icon="@mipmap/ic_app_recipe" - android:label="@string/app_name" - android:theme="@android:style/Theme.Holo.Light" > - <activity - android:name=".MainActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - <activity - android:name=".RecipeActivity" - android:label="@string/app_name" > - </activity> - <service - android:name=".RecipeService" /> - </application> - -</manifest> diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/beef-brisket-chili.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/beef-brisket-chili.json deleted file mode 100644 index 19598f9e5..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/beef-brisket-chili.json +++ /dev/null @@ -1,91 +0,0 @@ -{ -name: "beef-brisket-chili.json", -steps: [ -{ -text: "Place the cinnamon stick, cumin, paprika and oregano in a pestle and mortar. Bash and grind until the cinnamon is in very small flakes. ", -img: "step-1-grind-spices.jpg" -}, -{ -text: "Score the beef and rub the spice mix into the cuts. ", -img: "step-2-score-beef.jpg" -}, -{ -text: "Season the beef and drizzle with olive oil. Brown in a hot pan. ", -img: "step-3-brown-beef.jpg" -}, -{ -text: "Finely slice the onion and fry in a little olive oil together with the chillies, finely sliced. You can control the heat of your chili by deseeding some of the chillies. ", -img: "step-4-fry-onion.jpg" -}, -{ -text: "Add the browned brisket to the pan with the onions and chillies and fry on a low heat." -}, -{ -text: "Place the bell peppers, roughly sliced, the bay leaves and chopped tomatoes in a large covered pot. Bring to the boil and then add the beef, onions and chillies. ", -img: "step-6-combine.jpg" -}, -{ -text: "Bring back to the boil, cover and allow to simmer on a low heat for 4 hours." -}, -{ -text: "Remove the brisket from the pot, place on a large plate and use two forks to pull the beef apart into individual pieces. ", -img: "step-8-pull.jpg" -}, -{ -text: "Remove the bay leaves and add the pulled beef and coriander back to the pot, together with the kidney beans." -}, -{ -text: "Bring back to the boil and simmer gently for a further 15 - 20 mins." -} -], -summary: "", -title: "Beef brisket chili", -img: "chili.jpg", -serving: [ -"Serve with rice, yoghurt and fresh guacamole. Garnish with the remaining coriander." -], -ingredients: [ -{ -text: "3 lbs beef brisket" -}, -{ -text: "2 red onions" -}, -{ -text: "4 jalapeno chillies" -}, -{ -text: "1 large cinnamon stick" -}, -{ -text: "1 tbsp ground cumin" -}, -{ -text: "1 tbsp paprika" -}, -{ -text: "1 heaped tbsp dried oregano" -}, -{ -text: "2 fresh bay leaves" -}, -{ -text: "2 red bell peppers" -}, -{ -text: "2 green bell peppers" -}, -{ -text: "800g tin chopped tomatoes" -}, -{ -text: "400g tin kidney beans" -}, -{ -text: "400ml beef stock" -}, -{ -text: "1/2 bunch coriander" -} -] -}
\ No newline at end of file diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/chili.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/chili.jpg Binary files differdeleted file mode 100644 index ca5f7510f..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/chili.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.jpg Binary files differdeleted file mode 100644 index 77175eb88..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.json deleted file mode 100644 index 5fae53fe1..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/guacamole.json +++ /dev/null @@ -1,36 +0,0 @@ -{ -name: "guacamole.json", -steps: [ -{ -text: "Use a spoon to scoop the flesh of the avocados into a bowl." -}, -{ -text: "Mash with a fork until fairly smooth and creamy. Preserve some small solid chunks to add texture." -}, -{ -text: "Add the juice of the lime. ", -img: "step-3-lime.jpg" -}, -{ -text: "Add the cilantro." -}, -{ -text: "Mix thoroughly." -} -], -summary: "Some guacamole recipes call for many ingredients and can be a pain to prepare. This super simple guac can be thrown together in a couple of minutes and tastes great.", -title: "Super simple guacamole", -img: "guacamole.jpg", -serving: "", -ingredients: [ -{ -text: "2 ripe avocados" -}, -{ -text: "1 lime" -}, -{ -text: "2 tbsp cilantro" -} -] -}
\ No newline at end of file diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/irish-stew.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/irish-stew.jpg Binary files differdeleted file mode 100644 index 0c20766fd..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/irish-stew.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/northern-irish-vegetable-soup.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/northern-irish-vegetable-soup.json deleted file mode 100644 index 55d259190..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/northern-irish-vegetable-soup.json +++ /dev/null @@ -1,46 +0,0 @@ -{ -name: "northern-irish-vegetable-soup.json", -steps: [ -{ -text: "Place the beef in a large stock pot, cover with water and stew for 1 - 2 hours." -}, -{ -text: "Allow the stock to cool, skim off any fat." -}, -{ -text: "Add the soup mix to the stock, bring to the boil and simmer for 1 hour." -}, -{ -text: "Roughly chop the leeks (green and white parts), onion, carrots, celery and parsley. Add to the soup. Season well and simmer until the vegetables are soft." -} -], -summary: "This recipe is apparently unique to Northern Ireland and uses soup/herb celery which is hard to find outside the area, but regular table celery can be substituted (including the leaves).", -title: "Northern irish vegetable soup", -img: "irish-stew.jpg", -serving: [ -"Whole boiled potatoes are traditionally placed in the soup at time of serving." -], -ingredients: [ -{ -text: "2 lbs beef shin or similar beef on bone" -}, -{ -text: "60g soup mix (30g barley, 15g red lentils, 15g split peas)" -}, -{ -text: "3 carrots" -}, -{ -text: "1 white onion" -}, -{ -text: "field celery or 1 stalk celery, plus any leaves on the bunch" -}, -{ -text: "2 leeks" -}, -{ -text: "1 bunch parsley" -} -] -}
\ No newline at end of file diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/recipelist.json b/samples/wearable/RecipeAssistant/Application/src/main/assets/recipelist.json deleted file mode 100644 index efd787d35..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/recipelist.json +++ /dev/null @@ -1,23 +0,0 @@ -{ -recipe_list: -[ -{ -name: "guacamole.json", -summary: "Some guacamole recipes call for many ingredients and can be a pain to prepare. This super simple guac can be thrown together in a couple of minutes and tastes great.", -title: "Super simple guacamole", -img: "guacamole.jpg" -}, -{ -name: "northern-irish-vegetable-soup.json", -summary: "This recipe is apparently unique to Northern Ireland and uses soup/herb celery which is hard to find outside the area, but regular table celery can be substituted (including the leaves).", -title: "Northern irish vegetable soup", -img: "irish-stew.jpg" -}, -{ -name: "beef-brisket-chili.json", -summary: "", -title: "Beef brisket chili", -img: "chili.jpg" -} -] -}
\ No newline at end of file diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-1-grind-spices.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-1-grind-spices.jpg Binary files differdeleted file mode 100644 index 9b5f2b978..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-1-grind-spices.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-2-score-beef.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-2-score-beef.jpg Binary files differdeleted file mode 100644 index 66c549dfa..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-2-score-beef.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-brown-beef.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-brown-beef.jpg Binary files differdeleted file mode 100644 index 1bb801e6e..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-brown-beef.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-lime.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-lime.jpg Binary files differdeleted file mode 100644 index b615d5587..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-3-lime.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-4-fry-onion.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-4-fry-onion.jpg Binary files differdeleted file mode 100644 index b5d2a1875..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-4-fry-onion.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-6-combine.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-6-combine.jpg Binary files differdeleted file mode 100644 index fe2940578..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-6-combine.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-8-pull.jpg b/samples/wearable/RecipeAssistant/Application/src/main/assets/step-8-pull.jpg Binary files differdeleted file mode 100644 index f8288a849..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/assets/step-8-pull.jpg +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/AssetUtils.java b/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/AssetUtils.java deleted file mode 100644 index 8753582af..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/AssetUtils.java +++ /dev/null @@ -1,79 +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.recipeassistant; - -import android.content.Context; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.util.Log; - -import org.json.JSONException; -import org.json.JSONObject; - -import java.io.IOException; -import java.io.InputStream; - -final class AssetUtils { - private static final String TAG = "RecipeAssistant"; - - public static byte[] loadAsset(Context context, String asset) { - byte[] buffer = null; - try { - InputStream is = context.getAssets().open(asset); - int size = is.available(); - buffer = new byte[size]; - is.read(buffer); - is.close(); - } catch (IOException e) { - Log.e(TAG, "Failed to load asset " + asset + ": " + e); - } - return buffer; - } - - public static JSONObject loadJSONAsset(Context context, String asset) { - String jsonString = new String(loadAsset(context, asset)); - JSONObject jsonObject = null; - try { - jsonObject = new JSONObject(jsonString); - } catch (JSONException e) { - Log.e(TAG, "Failed to parse JSON asset " + asset + ": " + e); - } - return jsonObject; - } - - public static Bitmap loadBitmapAsset(Context context, String asset) { - InputStream is = null; - Bitmap bitmap = null; - try { - is = context.getAssets().open(asset); - if (is != null) { - bitmap = BitmapFactory.decodeStream(is); - } - } catch (IOException e) { - Log.e(TAG, e.toString()); - } finally { - if (is != null) { - try { - is.close(); - } catch (IOException e) { - Log.e(TAG, "Cannot close InputStream: ", e); - } - } - } - return bitmap; - } -} diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Constants.java b/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Constants.java deleted file mode 100644 index fae49ee7a..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Constants.java +++ /dev/null @@ -1,43 +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.recipeassistant; - -public final class Constants { - private Constants() { - } - public static final String RECIPE_LIST_FILE = "recipelist.json"; - public static final String RECIPE_NAME_TO_LOAD = "recipe_name"; - - public static final String RECIPE_FIELD_LIST = "recipe_list"; - public static final String RECIPE_FIELD_IMAGE = "img"; - public static final String RECIPE_FIELD_INGREDIENTS = "ingredients"; - public static final String RECIPE_FIELD_NAME = "name"; - public static final String RECIPE_FIELD_SUMMARY = "summary"; - public static final String RECIPE_FIELD_STEPS = "steps"; - public static final String RECIPE_FIELD_TEXT = "text"; - public static final String RECIPE_FIELD_TITLE = "title"; - public static final String RECIPE_FIELD_STEP_TEXT = "step_text"; - public static final String RECIPE_FIELD_STEP_IMAGE = "step_image"; - - static final String ACTION_START_COOKING = - "com.example.android.wearable.recipeassistant.START_COOKING"; - public static final String EXTRA_RECIPE = "recipe"; - - public static final int NOTIFICATION_ID = 0; - public static final int NOTIFICATION_IMAGE_WIDTH = 280; - public static final int NOTIFICATION_IMAGE_HEIGHT = 280; -} diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/MainActivity.java b/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/MainActivity.java deleted file mode 100644 index 4cc860f49..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/MainActivity.java +++ /dev/null @@ -1,50 +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.recipeassistant; - -import android.app.ListActivity; -import android.content.Intent; -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.ListView; - -public class MainActivity extends ListActivity { - - private static final String TAG = "RecipeAssistant"; - private RecipeListAdapter mAdapter; - - @Override - protected void onListItemClick(ListView l, View v, int position, long id) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG , "onListItemClick " + position); - } - String itemName = mAdapter.getItemName(position); - Intent intent = new Intent(getApplicationContext(), RecipeActivity.class); - intent.putExtra(Constants.RECIPE_NAME_TO_LOAD, itemName); - startActivity(intent); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(android.R.layout.list_content); - - mAdapter = new RecipeListAdapter(this); - setListAdapter(mAdapter); - } -} diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Recipe.java b/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Recipe.java deleted file mode 100644 index e470c0f4e..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/Recipe.java +++ /dev/null @@ -1,126 +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.recipeassistant; - -import android.content.Context; -import android.os.Bundle; -import android.os.Parcelable; -import android.util.Log; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.ArrayList; - -public class Recipe { - private static final String TAG = "RecipeAssistant"; - - public String titleText; - public String summaryText; - public String recipeImage; - public String ingredientsText; - - public static class RecipeStep { - RecipeStep() { } - public String stepImage; - public String stepText; - - public Bundle toBundle() { - Bundle bundle = new Bundle(); - bundle.putString(Constants.RECIPE_FIELD_STEP_TEXT, stepText); - bundle.putString(Constants.RECIPE_FIELD_STEP_IMAGE, stepImage); - return bundle; - } - - public static RecipeStep fromBundle(Bundle bundle) { - RecipeStep recipeStep = new RecipeStep(); - recipeStep.stepText = bundle.getString(Constants.RECIPE_FIELD_STEP_TEXT); - recipeStep.stepImage = bundle.getString(Constants.RECIPE_FIELD_STEP_IMAGE); - return recipeStep; - } - } - ArrayList<RecipeStep> recipeSteps; - - public Recipe() { - recipeSteps = new ArrayList<RecipeStep>(); - } - - public static Recipe fromJson(Context context, JSONObject json) { - Recipe recipe = new Recipe(); - try { - recipe.titleText = json.getString(Constants.RECIPE_FIELD_TITLE); - recipe.summaryText = json.getString(Constants.RECIPE_FIELD_SUMMARY); - if (json.has(Constants.RECIPE_FIELD_IMAGE)) { - recipe.recipeImage = json.getString(Constants.RECIPE_FIELD_IMAGE); - } - JSONArray ingredients = json.getJSONArray(Constants.RECIPE_FIELD_INGREDIENTS); - recipe.ingredientsText = ""; - for (int i = 0; i < ingredients.length(); i++) { - recipe.ingredientsText += " - " - + ingredients.getJSONObject(i).getString(Constants.RECIPE_FIELD_TEXT) + "\n"; - } - - JSONArray steps = json.getJSONArray(Constants.RECIPE_FIELD_STEPS); - for (int i = 0; i < steps.length(); i++) { - JSONObject step = steps.getJSONObject(i); - RecipeStep recipeStep = new RecipeStep(); - recipeStep.stepText = step.getString(Constants.RECIPE_FIELD_TEXT); - if (step.has(Constants.RECIPE_FIELD_IMAGE)) { - recipeStep.stepImage = step.getString(Constants.RECIPE_FIELD_IMAGE); - } - recipe.recipeSteps.add(recipeStep); - } - } catch (JSONException e) { - Log.e(TAG, "Error loading recipe: " + e); - return null; - } - return recipe; - } - - public Bundle toBundle() { - Bundle bundle = new Bundle(); - bundle.putString(Constants.RECIPE_FIELD_TITLE, titleText); - bundle.putString(Constants.RECIPE_FIELD_SUMMARY, summaryText); - bundle.putString(Constants.RECIPE_FIELD_IMAGE, recipeImage); - bundle.putString(Constants.RECIPE_FIELD_INGREDIENTS, ingredientsText); - if (recipeSteps != null) { - ArrayList<Parcelable> stepBundles = new ArrayList<Parcelable>(recipeSteps.size()); - for (RecipeStep recipeStep : recipeSteps) { - stepBundles.add(recipeStep.toBundle()); - } - bundle.putParcelableArrayList(Constants.RECIPE_FIELD_STEPS, stepBundles); - } - return bundle; - } - - public static Recipe fromBundle(Bundle bundle) { - Recipe recipe = new Recipe(); - recipe.titleText = bundle.getString(Constants.RECIPE_FIELD_TITLE); - recipe.summaryText = bundle.getString(Constants.RECIPE_FIELD_SUMMARY); - recipe.recipeImage = bundle.getString(Constants.RECIPE_FIELD_IMAGE); - recipe.ingredientsText = bundle.getString(Constants.RECIPE_FIELD_INGREDIENTS); - ArrayList<Parcelable> stepBundles = - bundle.getParcelableArrayList(Constants.RECIPE_FIELD_STEPS); - if (stepBundles != null) { - for (Parcelable stepBundle : stepBundles) { - recipe.recipeSteps.add(RecipeStep.fromBundle((Bundle) stepBundle)); - } - } - return recipe; - } -} diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeActivity.java b/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeActivity.java deleted file mode 100644 index cc7f034a7..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeActivity.java +++ /dev/null @@ -1,138 +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.recipeassistant; - -import android.app.Activity; -import android.app.PendingIntent; -import android.content.Intent; -import android.graphics.Bitmap; -import android.os.Bundle; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.animation.Animation; -import android.view.animation.AnimationUtils; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - -import org.json.JSONObject; - -public class RecipeActivity extends Activity { - private static final String TAG = "RecipeAssistant"; - private String mRecipeName; - private Recipe mRecipe; - private ImageView mImageView; - private TextView mTitleTextView; - private TextView mSummaryTextView; - private TextView mIngredientsTextView; - private LinearLayout mStepsLayout; - - @Override - protected void onStart() { - super.onStart(); - Intent intent = getIntent(); - mRecipeName = intent.getStringExtra(Constants.RECIPE_NAME_TO_LOAD); - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Intent: " + intent.toString() + " " + mRecipeName); - } - loadRecipe(); - } - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.recipe); - mTitleTextView = (TextView) findViewById(R.id.recipeTextTitle); - mSummaryTextView = (TextView) findViewById(R.id.recipeTextSummary); - mImageView = (ImageView) findViewById(R.id.recipeImageView); - mIngredientsTextView = (TextView) findViewById(R.id.textIngredients); - mStepsLayout = (LinearLayout) findViewById(R.id.layoutSteps); - } - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - // Inflate the menu; this adds items to the action bar if it is present. - getMenuInflater().inflate(R.menu.main, menu); - return true; - } - - @Override - public boolean onOptionsItemSelected(MenuItem item) { - switch(item.getItemId()) { - case R.id.action_cook: - startCooking(); - return true; - } - return super.onOptionsItemSelected(item); - } - - private void loadRecipe() { - JSONObject jsonObject = AssetUtils.loadJSONAsset(this, mRecipeName); - if (jsonObject != null) { - mRecipe = Recipe.fromJson(this, jsonObject); - if (mRecipe != null) { - displayRecipe(mRecipe); - } - } - } - - private void displayRecipe(Recipe recipe) { - Animation fadeIn = AnimationUtils.loadAnimation(this, android.R.anim.fade_in); - mTitleTextView.setAnimation(fadeIn); - mTitleTextView.setText(recipe.titleText); - mSummaryTextView.setText(recipe.summaryText); - if (recipe.recipeImage != null) { - mImageView.setAnimation(fadeIn); - Bitmap recipeImage = AssetUtils.loadBitmapAsset(this, recipe.recipeImage); - mImageView.setImageBitmap(recipeImage); - } - mIngredientsTextView.setText(recipe.ingredientsText); - - findViewById(R.id.ingredientsHeader).setAnimation(fadeIn); - findViewById(R.id.ingredientsHeader).setVisibility(View.VISIBLE); - findViewById(R.id.stepsHeader).setAnimation(fadeIn); - - findViewById(R.id.stepsHeader).setVisibility(View.VISIBLE); - - LayoutInflater inf = LayoutInflater.from(this); - mStepsLayout.removeAllViews(); - int stepNumber = 1; - for (Recipe.RecipeStep step : recipe.recipeSteps) { - View view = inf.inflate(R.layout.step_item, null); - ImageView iv = (ImageView) view.findViewById(R.id.stepImageView); - if (step.stepImage == null) { - iv.setVisibility(View.GONE); - } else { - Bitmap stepImage = AssetUtils.loadBitmapAsset(this, step.stepImage); - iv.setImageBitmap(stepImage); - } - ((TextView) view.findViewById(R.id.textStep)).setText( - (stepNumber++) + ". " + step.stepText); - mStepsLayout.addView(view); - } - } - - private void startCooking() { - Intent intent = new Intent(this, RecipeService.class); - intent.setAction(Constants.ACTION_START_COOKING); - intent.putExtra(Constants.EXTRA_RECIPE, mRecipe.toBundle()); - startService(intent); - } -} diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeListAdapter.java b/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeListAdapter.java deleted file mode 100644 index 746603a31..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeListAdapter.java +++ /dev/null @@ -1,173 +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.recipeassistant; - -import android.content.Context; -import android.database.DataSetObserver; -import android.graphics.Bitmap; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.ListAdapter; -import android.widget.TextView; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import java.util.ArrayList; -import java.util.List; - -public class RecipeListAdapter implements ListAdapter { - private String TAG = "RecipeListAdapter"; - - private class Item { - String title; - String name; - String summary; - Bitmap image; - } - - private List<Item> mItems = new ArrayList<Item>(); - private Context mContext; - private DataSetObserver mObserver; - - public RecipeListAdapter(Context context) { - mContext = context; - loadRecipeList(); - } - - private void loadRecipeList() { - JSONObject jsonObject = AssetUtils.loadJSONAsset(mContext, Constants.RECIPE_LIST_FILE); - if (jsonObject != null) { - List<Item> items = parseJson(jsonObject); - appendItemsToList(items); - } - } - - private List<Item> parseJson(JSONObject json) { - List<Item> result = new ArrayList<Item>(); - try { - JSONArray items = json.getJSONArray(Constants.RECIPE_FIELD_LIST); - for (int i = 0; i < items.length(); i++) { - JSONObject item = items.getJSONObject(i); - Item parsed = new Item(); - parsed.name = item.getString(Constants.RECIPE_FIELD_NAME); - parsed.title = item.getString(Constants.RECIPE_FIELD_TITLE); - if (item.has(Constants.RECIPE_FIELD_IMAGE)) { - String imageFile = item.getString(Constants.RECIPE_FIELD_IMAGE); - parsed.image = AssetUtils.loadBitmapAsset(mContext, imageFile); - } - parsed.summary = item.getString(Constants.RECIPE_FIELD_SUMMARY); - result.add(parsed); - } - } catch (JSONException e) { - Log.e(TAG, "Failed to parse recipe list: " + e); - } - return result; - } - - private void appendItemsToList(List<Item> items) { - mItems.addAll(items); - if (mObserver != null) { - mObserver.onChanged(); - } - } - - @Override - public int getCount() { - return mItems.size(); - } - - @Override - public Object getItem(int position) { - return mItems.get(position); - } - - @Override - public long getItemId(int position) { - return 0; - } - - @Override - public int getItemViewType(int position) { - return 0; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - View view = convertView; - if (view == null) { - LayoutInflater inf = LayoutInflater.from(mContext); - view = inf.inflate(R.layout.list_item, null); - } - Item item = (Item) getItem(position); - TextView titleView = (TextView) view.findViewById(R.id.textTitle); - TextView summaryView = (TextView) view.findViewById(R.id.textSummary); - ImageView iv = (ImageView) view.findViewById(R.id.imageView); - - titleView.setText(item.title); - summaryView.setText(item.summary); - if (item.image != null) { - iv.setImageBitmap(item.image); - } else { - iv.setImageDrawable(mContext.getResources().getDrawable(R.drawable.ic_noimage)); - } - return view; - } - - @Override - public int getViewTypeCount() { - return 1; - } - - @Override - public boolean hasStableIds() { - return false; - } - - @Override - public boolean isEmpty() { - return mItems.isEmpty(); - } - - @Override - public void registerDataSetObserver(DataSetObserver observer) { - mObserver = observer; - } - - @Override - public void unregisterDataSetObserver(DataSetObserver observer) { - mObserver = null; - } - - @Override - public boolean areAllItemsEnabled() { - return true; - } - - @Override - public boolean isEnabled(int position) { - return true; - } - - public String getItemName(int position) { - return mItems.get(position).name; - } -} diff --git a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeService.java b/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeService.java deleted file mode 100644 index 4abdf97f0..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/java/com/example/android/wearable/recipeassistant/RecipeService.java +++ /dev/null @@ -1,96 +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.recipeassistant; - -import android.app.Notification; -import android.app.Service; -import android.content.Intent; -import android.graphics.Bitmap; -import android.os.Binder; -import android.os.IBinder; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.app.NotificationCompat; - -import java.util.ArrayList; - -public class RecipeService extends Service { - private NotificationManagerCompat mNotificationManager; - private Binder mBinder = new LocalBinder(); - private Recipe mRecipe; - - public class LocalBinder extends Binder { - RecipeService getService() { - return RecipeService.this; - } - } - - @Override - public void onCreate() { - mNotificationManager = NotificationManagerCompat.from(this); - } - - @Override - public IBinder onBind(Intent intent) { - return mBinder; - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - if (intent.getAction().equals(Constants.ACTION_START_COOKING)) { - createNotification(intent); - return START_STICKY; - } - return START_NOT_STICKY; - } - - private void createNotification(Intent intent) { - mRecipe = Recipe.fromBundle(intent.getBundleExtra(Constants.EXTRA_RECIPE)); - ArrayList<Notification> notificationPages = new ArrayList<Notification>(); - - int stepCount = mRecipe.recipeSteps.size(); - - for (int i = 0; i < stepCount; ++i) { - Recipe.RecipeStep recipeStep = mRecipe.recipeSteps.get(i); - NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle(); - style.bigText(recipeStep.stepText); - style.setBigContentTitle(String.format( - getResources().getString(R.string.step_count), i + 1, stepCount)); - style.setSummaryText(""); - NotificationCompat.Builder builder = new NotificationCompat.Builder(this); - builder.setStyle(style); - notificationPages.add(builder.build()); - } - - NotificationCompat.Builder builder = new NotificationCompat.Builder(this); - - if (mRecipe.recipeImage != null) { - Bitmap recipeImage = Bitmap.createScaledBitmap( - AssetUtils.loadBitmapAsset(this, mRecipe.recipeImage), - Constants.NOTIFICATION_IMAGE_WIDTH, Constants.NOTIFICATION_IMAGE_HEIGHT, false); - builder.setLargeIcon(recipeImage); - } - builder.setContentTitle(mRecipe.titleText); - builder.setContentText(mRecipe.summaryText); - builder.setSmallIcon(R.mipmap.ic_notification_recipe); - - Notification notification = builder - .extend(new NotificationCompat.WearableExtender() - .addPages(notificationPages)) - .build(); - mNotificationManager.notify(Constants.NOTIFICATION_ID, notification); - } -} diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-hdpi/ic_noimage.png b/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-hdpi/ic_noimage.png Binary files differdeleted file mode 100644 index 7bba7ab76..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-hdpi/ic_noimage.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-mdpi/ic_noimage.png b/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-mdpi/ic_noimage.png Binary files differdeleted file mode 100644 index a5ad26f64..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-mdpi/ic_noimage.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-xhdpi/ic_noimage.png b/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-xhdpi/ic_noimage.png Binary files differdeleted file mode 100644 index 8b631d121..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/drawable-xhdpi/ic_noimage.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/list_item.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/layout/list_item.xml deleted file mode 100644 index 756880c8f..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/list_item.xml +++ /dev/null @@ -1,58 +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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="16dp" - android:orientation="vertical" > - - <ImageView - android:id="@+id/imageView" - android:layout_width="fill_parent" - android:layout_height="300dp" - android:layout_alignParentLeft="true" - android:layout_alignParentTop="true" - android:layout_marginBottom="16dp" - android:background="@color/list_image_bg_color" - android:src="@drawable/ic_noimage" /> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_alignBottom="@+id/imageView" - android:layout_alignParentLeft="true" - android:background="@color/list_text_bg_color" - android:orientation="vertical" > - - <TextView - android:id="@+id/textTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:layout_marginLeft="8dp" - android:textAppearance="@style/RecipeTitleFont" /> - - <TextView - android:id="@+id/textSummary" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:layout_marginLeft="16dp" - android:textAppearance="@style/RecipeSummaryFont" /> - </LinearLayout> - -</RelativeLayout> diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/recipe.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/layout/recipe.xml deleted file mode 100644 index 3bb20b86b..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/recipe.xml +++ /dev/null @@ -1,95 +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. ---> - -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="match_parent" - android:layout_height="match_parent" > - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical" > - - <ImageView - android:id="@+id/recipeImageView" - android:layout_width="fill_parent" - android:layout_height="300dp" - android:layout_marginBottom="16dp" - android:background="@color/list_image_bg_color" - android:src="@drawable/ic_noimage" /> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:background="@color/list_text_bg_color" - android:orientation="vertical" > - - <TextView - android:id="@+id/recipeTextTitle" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:layout_marginLeft="8dp" - android:textAppearance="@style/RecipeHugeFont" /> - - <TextView - android:id="@+id/recipeTextSummary" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="16dp" - android:layout_marginLeft="16dp" - android:textAppearance="@style/RecipeSummaryFont" /> - </LinearLayout> - - <TextView - android:id="@+id/ingredientsHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:layout_marginLeft="8dp" - android:text="@string/ingredients" - android:textAppearance="@style/RecipeTitleFont" - android:visibility="gone" /> - - <TextView - android:id="@+id/textIngredients" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:layout_marginLeft="8dp" - android:textAppearance="@style/RecipeSummaryFont" /> - - <TextView - android:id="@+id/stepsHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:layout_marginLeft="8dp" - android:text="@string/steps" - android:textAppearance="@style/RecipeTitleFont" - android:visibility="gone" /> - - <LinearLayout - android:id="@+id/layoutSteps" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_margin="8dp" - android:orientation="vertical" - android:textAppearance="@style/RecipeSummaryFont" > - </LinearLayout> - </LinearLayout> - -</ScrollView> diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/step_item.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/layout/step_item.xml deleted file mode 100644 index faa5ac5c8..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/layout/step_item.xml +++ /dev/null @@ -1,51 +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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:layout_marginBottom="32dp" - android:orientation="vertical" > - - <ImageView - android:id="@+id/stepImageView" - android:layout_width="fill_parent" - android:layout_height="300dp" - android:layout_alignParentLeft="true" - android:layout_alignParentTop="true" - android:layout_marginBottom="16dp" - android:background="@color/list_image_bg_color" - android:src="@drawable/ic_noimage" /> - - <LinearLayout - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_alignBottom="@+id/stepImageView" - android:layout_alignParentLeft="true" - android:background="@color/list_text_bg_color" - android:orientation="vertical" > - - <TextView - android:id="@+id/textStep" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:layout_marginLeft="8dp" - android:layout_marginRight="8dp" - android:textAppearance="@style/RecipeTitleFont" /> - </LinearLayout> - -</RelativeLayout> diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/menu/main.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/menu/main.xml deleted file mode 100644 index b392472f8..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/menu/main.xml +++ /dev/null @@ -1,23 +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. ---> - -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - <item - android:id="@+id/action_cook" - android:orderInCategory="100" - android:showAsAction="always|withText" - android:title="@string/action_cook" /> -</menu> diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_app_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_app_recipe.png Binary files differdeleted file mode 100644 index 8ceb8696d..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_app_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_notification_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_notification_recipe.png Binary files differdeleted file mode 100644 index 844d8ede8..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-hdpi/ic_notification_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_app_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_app_recipe.png Binary files differdeleted file mode 100644 index b884789c5..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_app_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_notification_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_notification_recipe.png Binary files differdeleted file mode 100644 index 3f3f58cde..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-mdpi/ic_notification_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_app_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_app_recipe.png Binary files differdeleted file mode 100644 index 2a27c3283..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_app_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_notification_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_notification_recipe.png Binary files differdeleted file mode 100644 index 5a99b7c71..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xhdpi/ic_notification_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_app_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_app_recipe.png Binary files differdeleted file mode 100644 index b10c77068..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_app_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_notification_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_notification_recipe.png Binary files differdeleted file mode 100644 index 799726d05..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxhdpi/ic_notification_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_app_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_app_recipe.png Binary files differdeleted file mode 100644 index 606f07f77..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_app_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_notification_recipe.png b/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_notification_recipe.png Binary files differdeleted file mode 100644 index 30e28a884..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/mipmap-xxxhdpi/ic_notification_recipe.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/values/colors.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/values/colors.xml deleted file mode 100644 index 0f1430c3f..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/values/colors.xml +++ /dev/null @@ -1,20 +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. ---> - -<resources> - <color name="list_text_bg_color">#dfff</color> - <color name="list_image_bg_color">#6aaa</color> -</resources> diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/values/strings.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/values/strings.xml deleted file mode 100644 index 86da78c84..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,24 +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. ---> - -<resources> - <string name="app_name">Recipe Assistant</string> - <string name="action_settings">Settings</string> - <string name="action_cook">Start</string> - <string name="steps">Steps</string> - <string name="ingredients">Ingredients</string> - <string name="step_count">Step %1$d of %2$d</string> -</resources> diff --git a/samples/wearable/RecipeAssistant/Application/src/main/res/values/styles.xml b/samples/wearable/RecipeAssistant/Application/src/main/res/values/styles.xml deleted file mode 100644 index 8876dd5f5..000000000 --- a/samples/wearable/RecipeAssistant/Application/src/main/res/values/styles.xml +++ /dev/null @@ -1,39 +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. ---> - -<resources xmlns:android="http://schemas.android.com/apk/res/android"> - <style name="RecipeTitleFont" parent="@android:style/TextAppearance.Large"> - <item name="android:layout_width">fill_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textColor">#333333</item> - <item name="android:fontFamily">sans-serif</item> - </style> - - <style name="RecipeHugeFont" parent="@android:style/TextAppearance.Large"> - <item name="android:layout_width">fill_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textColor">#333333</item> - <item name="android:fontFamily">sans-serif</item> - <item name="android:textSize">20pt</item> - </style> - - <style name="RecipeSummaryFont" parent="@android:style/TextAppearance.Medium"> - <item name="android:layout_width">fill_parent</item> - <item name="android:layout_height">wrap_content</item> - <item name="android:textColor">#333333</item> - <item name="android:fontFamily">sans-serif</item> - </style> -</resources> diff --git a/samples/wearable/RecipeAssistant/_index.html b/samples/wearable/RecipeAssistant/_index.html deleted file mode 100644 index 80dc20078..000000000 --- a/samples/wearable/RecipeAssistant/_index.html +++ /dev/null @@ -1,19 +0,0 @@ -<p><b>About:</b> This phone application uses the enhanced notifications API to display recipe -instructions using paged notifications. After starting the application on your phone, you can browse -from a short list of recipes and select one to view. Each recipe is broken down into a number of -steps; when ready, you can click on the START action in the action bar to send the steps to the -wearable. On the wearable device, the steps are displayed as a multi-page notification, with one -page for each step in the recipe.</p> -<p><b>How to run:</b> Install the Application APK on the companion and run it like any other -Android app.</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/recipe_assistant_guac.png" alt="Super simple guacamole" width="216" - height="384"> - <img src="screenshots/guac_notification.png" alt="Guacamole wearable notification" - width="160" height="160"> - <img src="screenshots/guac_notification_step1.png" alt="Guacamole step 1" width="160" - height="160"> - <figcaption>Making guacamole!</figcaption> - </figure> -</p>
\ No newline at end of file diff --git a/samples/wearable/RecipeAssistant/build.gradle b/samples/wearable/RecipeAssistant/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/RecipeAssistant/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/RecipeAssistant/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/RecipeAssistant/gradlew b/samples/wearable/RecipeAssistant/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/RecipeAssistant/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/RecipeAssistant/gradlew.bat b/samples/wearable/RecipeAssistant/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/RecipeAssistant/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/RecipeAssistant/screenshots/guac_notification.png b/samples/wearable/RecipeAssistant/screenshots/guac_notification.png Binary files differdeleted file mode 100644 index e041b11ec..000000000 --- a/samples/wearable/RecipeAssistant/screenshots/guac_notification.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/screenshots/guac_notification_step1.png b/samples/wearable/RecipeAssistant/screenshots/guac_notification_step1.png Binary files differdeleted file mode 100644 index e0157ea7e..000000000 --- a/samples/wearable/RecipeAssistant/screenshots/guac_notification_step1.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/screenshots/recipe_assistant_guac.png b/samples/wearable/RecipeAssistant/screenshots/recipe_assistant_guac.png Binary files differdeleted file mode 100644 index a34da6e68..000000000 --- a/samples/wearable/RecipeAssistant/screenshots/recipe_assistant_guac.png +++ /dev/null diff --git a/samples/wearable/RecipeAssistant/settings.gradle b/samples/wearable/RecipeAssistant/settings.gradle deleted file mode 100644 index aa94981a3..000000000 --- a/samples/wearable/RecipeAssistant/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include 'Application'
\ No newline at end of file diff --git a/samples/wearable/SkeletonWearableApp/Wearable/build.gradle b/samples/wearable/SkeletonWearableApp/Wearable/build.gradle deleted file mode 100644 index b9450ca9a..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile "com.google.android.support:wearable:1.0.+" -} diff --git a/samples/wearable/SkeletonWearableApp/Wearable/proguard-rules.txt b/samples/wearable/SkeletonWearableApp/Wearable/proguard-rules.txt deleted file mode 100644 index 2ddbcfcdd..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/proguard-rules.txt +++ /dev/null @@ -1,21 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/AndroidManifest.xml b/samples/wearable/SkeletonWearableApp/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 062e0dd7f..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,48 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.google.wearable.app" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault"> - <activity - android:name="com.example.android.google.wearable.app.MainActivity" - android:label="@string/app_name"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - <intent-filter> - <action android:name="com.google.android.clockwork.example.SKELETON"/> - <category android:name="android.intent.category.DEFAULT"/> - </intent-filter> - </activity> - <activity - android:name="com.example.android.google.wearable.app.GridExampleActivity"> - <intent-filter> - <action android:name="com.example.android.google.wearable.app.GRID_ACTIVITY"/> - <category android:name="android.intent.category.DEFAULT"/> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/GridExampleActivity.java b/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/GridExampleActivity.java deleted file mode 100644 index 0a88c04d0..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/GridExampleActivity.java +++ /dev/null @@ -1,108 +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.google.wearable.app; - -import android.app.Activity; -import android.app.Fragment; -import android.app.FragmentManager; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.Color; -import android.graphics.Paint; -import android.graphics.Point; -import android.graphics.Typeface; -import android.os.Bundle; -import android.support.wearable.view.CardFragment; -import android.support.wearable.view.FragmentGridPagerAdapter; -import android.support.wearable.view.GridViewPager; -import android.support.wearable.view.ImageReference; -import java.util.HashMap; -import java.util.Map; - -public class GridExampleActivity extends Activity { - private static final int NUM_ROWS = 10; - private static final int NUM_COLS = 3; - - MainAdapter mAdapter; - GridViewPager mPager; - - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.grid_activity); - mPager = (GridViewPager) findViewById(R.id.fragment_container); - mAdapter = new MainAdapter(getFragmentManager()); - mPager.setAdapter(mAdapter); - - } - - private static class MainAdapter extends FragmentGridPagerAdapter{ - Map<Point, ImageReference> mBackgrounds = new HashMap<Point, ImageReference>(); - - public MainAdapter(FragmentManager fm) { - super(fm); - } - - @Override - public int getRowCount() { - return NUM_ROWS; - } - - @Override - public int getColumnCount(int rowNum) { - return NUM_COLS; - } - - @Override - public Fragment getFragment(int rowNum, int colNum) { - return MainFragment.newInstance(rowNum, colNum); - } - - @Override - public ImageReference getBackground(int row, int column) { - Point pt = new Point(column, row); - ImageReference ref = mBackgrounds.get(pt); - if (ref == null) { - Bitmap bm = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888); - Canvas c = new Canvas(bm); - Paint p = new Paint(); - // Clear previous image. - c.drawRect(0, 0, 200, 200, p); - p.setAntiAlias(true); - p.setTypeface(Typeface.DEFAULT); - p.setTextSize(64); - p.setColor(Color.LTGRAY); - c.drawText(column+ "-" + row, 20, 100, p); - ref = ImageReference.forBitmap(bm); - mBackgrounds.put(pt, ref); - } - return ref; - } - } - - public static class MainFragment extends CardFragment { - private static MainFragment newInstance(int rowNum, int colNum) { - Bundle args = new Bundle(); - args.putString(CardFragment.KEY_TITLE, "Row:" + rowNum); - args.putString(CardFragment.KEY_TEXT, "Col:" + colNum); - MainFragment f = new MainFragment(); - f.setArguments(args); - return f; - } - } -} diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/MainActivity.java b/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/MainActivity.java deleted file mode 100644 index 817e195a8..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/java/com/example/android/google/wearable/app/MainActivity.java +++ /dev/null @@ -1,129 +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.google.wearable.app; - -import android.app.Activity; -import android.app.Notification; -import android.app.PendingIntent; -import android.content.Intent; -import android.os.Bundle; -import android.support.v4.app.NotificationCompat; -import android.support.v4.app.NotificationManagerCompat; -import android.support.v4.view.GestureDetectorCompat; -import android.support.wearable.view.DelayedConfirmationView; -import android.support.wearable.view.DismissOverlayView; -import android.util.Log; -import android.view.GestureDetector; -import android.view.MotionEvent; -import android.view.View; -import android.widget.ScrollView; - -public class MainActivity extends Activity - implements DelayedConfirmationView.DelayedConfirmationListener { - private static final String TAG = "MainActivity"; - - private static final int NOTIFICATION_ID = 1; - private static final int NOTIFICATION_REQUEST_CODE = 1; - private static final int NUM_SECONDS = 5; - - private GestureDetectorCompat mGestureDetector; - private DismissOverlayView mDismissOverlayView; - - @Override - public void onCreate(Bundle b) { - super.onCreate(b); - setContentView(R.layout.main_activity); - - mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); - mDismissOverlayView.setIntroText(R.string.intro_text); - mDismissOverlayView.showIntroIfNecessary(); - mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); - } - - @Override - public boolean dispatchTouchEvent(MotionEvent event) { - return mGestureDetector.onTouchEvent(event) || super.dispatchTouchEvent(event); - } - - private class LongPressListener extends GestureDetector.SimpleOnGestureListener { - @Override - public void onLongPress(MotionEvent event) { - mDismissOverlayView.show(); - } - } - - /** - * Handles the button to launch a notification. - */ - public void showNotification(View view) { - Notification notification = new NotificationCompat.Builder(this) - .setContentTitle(getString(R.string.notification_title)) - .setContentText(getString(R.string.notification_title)) - .setSmallIcon(R.drawable.ic_launcher) - .addAction(R.drawable.ic_launcher, - getText(R.string.action_launch_activity), - PendingIntent.getActivity(this, NOTIFICATION_REQUEST_CODE, - new Intent(this, GridExampleActivity.class), - PendingIntent.FLAG_UPDATE_CURRENT)) - .build(); - NotificationManagerCompat.from(this).notify(NOTIFICATION_ID, notification); - finish(); - } - - - /** - * Handles the button press to finish this activity and take the user back to the Home. - */ - public void onFinishActivity(View view) { - setResult(RESULT_OK); - finish(); - } - - /** - * Handles the button to start a DelayedConfirmationView timer. - */ - public void onStartTimer(View view) { - DelayedConfirmationView delayedConfirmationView = (DelayedConfirmationView) - findViewById(R.id.timer); - delayedConfirmationView.setTotalTimeMs(NUM_SECONDS * 1000); - delayedConfirmationView.setListener(this); - delayedConfirmationView.start(); - scroll(View.FOCUS_DOWN); - } - - @Override - public void onTimerFinished(View v) { - Log.d(TAG, "onTimerFinished is called."); - scroll(View.FOCUS_UP); - } - - @Override - public void onTimerSelected(View v) { - Log.d(TAG, "onTimerSelected is called."); - scroll(View.FOCUS_UP); - } - - private void scroll(final int scrollDirection) { - final ScrollView scrollView = (ScrollView) findViewById(R.id.scroll); - scrollView.post(new Runnable() { - @Override - public void run() { - scrollView.fullScroll(scrollDirection); - } - }); - } -} diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/grid_activity.xml b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/grid_activity.xml deleted file mode 100644 index c86705131..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/grid_activity.xml +++ /dev/null @@ -1,21 +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. ---> - -<android.support.wearable.view.GridViewPager - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/fragment_container" - android:layout_width="match_parent" - android:layout_height="match_parent" /> diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/main_activity.xml b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/main_activity.xml deleted file mode 100644 index c949e5faf..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/layout/main_activity.xml +++ /dev/null @@ -1,84 +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" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <ScrollView - android:id="@+id/scroll" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - android:background="#000000" - android:fillViewport="true"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="vertical"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="2dp" - android:text="@string/main_activity_title_text" - android:textSize="36sp" - android:textColor="#006600"/> - - <Button - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:onClick="showNotification" - android:text="@string/show_notification" /> - - <Button - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:onClick="onFinishActivity" - android:text="@string/finish_activity" /> - - <Button - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:id="@+id/start_timer_button" - android:onClick="onStartTimer" - android:text="@string/start_timer" /> - - <android.support.wearable.view.DelayedConfirmationView - xmlns:app="http://schemas.android.com/apk/res-auto" - android:id="@+id/timer" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center" - android:src="@drawable/ic_launcher" - app:circle_color="@color/blue" - app:circle_padding="@dimen/circle_padding" - app:circle_border_width="@dimen/circle_border_normal_width" - app:circle_border_color="@color/white" - app:circle_radius="@dimen/circle_radius"/> - - </LinearLayout> - - </ScrollView> - - <android.support.wearable.view.DismissOverlayView - android:id="@+id/dismiss_overlay" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - -</FrameLayout> diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/dimens.xml b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/dimens.xml deleted file mode 100644 index 67c967796..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/dimens.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <dimen name="circle_border_normal_width">10dp</dimen> - <dimen name="circle_padding">5dp</dimen> - <dimen name="circle_radius">50dp</dimen> -</resources> diff --git a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/strings.xml b/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 3917d07da..000000000 --- a/samples/wearable/SkeletonWearableApp/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,28 +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. ---> - -<resources> - - <string name="app_name">Skeleton Wearable App</string> - <string name="intro_text">Long press to go back home.</string> - <string name="main_activity_title_text"> Main Activity </string> - <string name="grid_activity_title_text"> Grid Activity </string> - <string name="finish_activity"> Finish Activity </string> - <string name="start_timer"> Start Timer (5 sec) </string> - <string name="show_notification"> Show Notification </string> - <string name="notification_title"> Skeleton App Notification </string> - <string name="action_launch_activity">Launch Activity</string> -</resources> diff --git a/samples/wearable/SkeletonWearableApp/_index.html b/samples/wearable/SkeletonWearableApp/_index.html deleted file mode 100644 index dc2a488d8..000000000 --- a/samples/wearable/SkeletonWearableApp/_index.html +++ /dev/null @@ -1,22 +0,0 @@ -<p><b>About:</b> This sample is a mostly empty wearable app that implements a fullscreen activity -conforming to Android Wear best practices. Included in the sample are examples of GridViewPager, -DelayedConfirmationView, and DismissOverlayView. Developers who require a fullscreen activity for -their wearable app can use this sample as a starting point.</p> -<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by -saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select -"Skeleton Wearable App" from the submenu.</p> -<p><b>Wearable APIs used:</b> DelayedConfirmationView, DismissOverlayView, GridViewPager, -CardFragment, FragmentGridPagerAdapter, ImageReference</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/skeleton_wearable_app.png" alt="SkeletonWearableApp" width="140" - height="140"> - <img src="screenshots/grid_view_pager.png" alt="GridViewPager" width="140" height="140"> - <img src="screenshots/delayed_confirmation.png" alt="DelayedConfirmationView" width="140" - height="140"> - <img src="screenshots/dismiss_overlay.png" alt="DismissOverlayView" width="140" - height="140"> - <figcaption>From left to right: the initial activity, GridViewPager, - DelayedConfirmationView, and DismissOverlayView</figcaption> - </figure> -</p> diff --git a/samples/wearable/SkeletonWearableApp/build.gradle b/samples/wearable/SkeletonWearableApp/build.gradle deleted file mode 100644 index 43dbcd071..000000000 --- a/samples/wearable/SkeletonWearableApp/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} - diff --git a/samples/wearable/SkeletonWearableApp/gradle.properties b/samples/wearable/SkeletonWearableApp/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/SkeletonWearableApp/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/SkeletonWearableApp/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/SkeletonWearableApp/gradlew b/samples/wearable/SkeletonWearableApp/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/SkeletonWearableApp/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/SkeletonWearableApp/gradlew.bat b/samples/wearable/SkeletonWearableApp/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/SkeletonWearableApp/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/SkeletonWearableApp/screenshots/delayed_confirmation.png b/samples/wearable/SkeletonWearableApp/screenshots/delayed_confirmation.png Binary files differdeleted file mode 100644 index 29943617f..000000000 --- a/samples/wearable/SkeletonWearableApp/screenshots/delayed_confirmation.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/screenshots/dismiss_overlay.png b/samples/wearable/SkeletonWearableApp/screenshots/dismiss_overlay.png Binary files differdeleted file mode 100644 index 142d7e475..000000000 --- a/samples/wearable/SkeletonWearableApp/screenshots/dismiss_overlay.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/screenshots/grid_view_pager.png b/samples/wearable/SkeletonWearableApp/screenshots/grid_view_pager.png Binary files differdeleted file mode 100644 index f59c13d0d..000000000 --- a/samples/wearable/SkeletonWearableApp/screenshots/grid_view_pager.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/screenshots/skeleton_wearable_app.png b/samples/wearable/SkeletonWearableApp/screenshots/skeleton_wearable_app.png Binary files differdeleted file mode 100644 index 4f1727459..000000000 --- a/samples/wearable/SkeletonWearableApp/screenshots/skeleton_wearable_app.png +++ /dev/null diff --git a/samples/wearable/SkeletonWearableApp/settings.gradle b/samples/wearable/SkeletonWearableApp/settings.gradle deleted file mode 100644 index 1d97d30e1..000000000 --- a/samples/wearable/SkeletonWearableApp/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':Wearable' diff --git a/samples/wearable/SynchronizedNotifications/Application/build.gradle b/samples/wearable/SynchronizedNotifications/Application/build.gradle deleted file mode 100644 index 335203852..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -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' - } - } - lintOptions { - abortOnError false - } -} - -dependencies { - compile 'com.google.android.gms:play-services:5.0.+' - compile 'com.android.support:support-v13:20.0.+' - compile project(':Common') - wearApp project(':Wearable') -} diff --git a/samples/wearable/SynchronizedNotifications/Application/proguard-rules.txt b/samples/wearable/SynchronizedNotifications/Application/proguard-rules.txt deleted file mode 100644 index 5b86c0858..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/AndroidManifest.xml b/samples/wearable/SynchronizedNotifications/Application/src/main/AndroidManifest.xml deleted file mode 100644 index 97ab5779f..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/AndroidManifest.xml +++ /dev/null @@ -1,47 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.synchronizednotifications" > - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light" > - <meta-data android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - <activity - android:name=".PhoneActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - <service android:name=".DismissListener"> - <intent-filter> - <action - android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - <intent-filter> - <action - android:name="com.example.android.wearable.synchronizednotifications.DISMISS" /> - </intent-filter> - </service> - </application> - -</manifest> diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/DismissListener.java b/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/DismissListener.java deleted file mode 100644 index 98747f55b..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/DismissListener.java +++ /dev/null @@ -1,125 +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.synchronizednotifications; - -import static com.google.android.gms.wearable.PutDataRequest.WEAR_URI_SCHEME; - -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.support.v4.app.NotificationManagerCompat; -import android.util.Log; - -import com.example.android.wearable.synchronizednotifications.common.Constants; -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.WearableListenerService; - -/** - * A {@link com.google.android.gms.wearable.WearableListenerService} that is invoked when certain - * notifications are dismissed from either the phone or watch. - */ -public class DismissListener extends WearableListenerService - implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, - ResultCallback<DataApi.DeleteDataItemsResult> { - - private static final String TAG = "DismissListener"; - private GoogleApiClient mGoogleApiClient; - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - for (DataEvent dataEvent : dataEvents) { - if (dataEvent.getType() == DataEvent.TYPE_DELETED) { - if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) { - // notification on the phone should be dismissed - NotificationManagerCompat.from(this).cancel(Constants.BOTH_ID); - } - } - } - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - if (null != intent) { - String action = intent.getAction(); - if (Constants.ACTION_DISMISS.equals(action)) { - // We need to dismiss the wearable notification. We delete the DataItem that - // created the notification to inform the wearable. - int notificationId = intent.getIntExtra(Constants.KEY_NOTIFICATION_ID, -1); - if (notificationId == Constants.BOTH_ID) { - dismissWearableNotification(notificationId); - } - } - } - return super.onStartCommand(intent, flags, startId); - } - - /** - * Removes the DataItem that was used to create a notification on the watch. By deleting the - * data item, a {@link com.google.android.gms.wearable.WearableListenerService} on the watch - * will be notified and the notification on the watch will be removed. - * - * @param id The ID of the notification that should be removed - */ - private void dismissWearableNotification(final int id) { - mGoogleApiClient.connect(); - } - - @Override // ConnectionCallbacks - public void onConnected(Bundle bundle) { - final Uri dataItemUri = - new Uri.Builder().scheme(WEAR_URI_SCHEME).path(Constants.BOTH_PATH).build(); - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Deleting Uri: " + dataItemUri.toString()); - } - Wearable.DataApi.deleteDataItems( - mGoogleApiClient, dataItemUri).setResultCallback(this); - } - - @Override // ConnectionCallbacks - public void onConnectionSuspended(int i) { - } - - @Override // OnConnectionFailedListener - public void onConnectionFailed(ConnectionResult connectionResult) { - Log.e(TAG, "Failed to connect to the Google API client"); - } - - @Override // ResultCallback<DataApi.DeleteDataItemsResult> - public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) { - if (!deleteDataItemsResult.getStatus().isSuccess()) { - Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem"); - } - mGoogleApiClient.disconnect(); - } -} diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java b/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java deleted file mode 100644 index eb0833491..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/java/com/example/android/wearable/synchronizednotifications/PhoneActivity.java +++ /dev/null @@ -1,192 +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.synchronizednotifications; - -import android.app.Activity; -import android.app.PendingIntent; -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.view.View; - -import com.example.android.wearable.synchronizednotifications.common.Constants; -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.PutDataRequest; -import com.google.android.gms.wearable.Wearable; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Locale; - -/** - * A simple activity that presents three buttons that would trigger three different combinations of - * notifications on the handset and the watch: - * <ul> - * <li>The first button builds a simple local-only notification on the handset.</li> - * <li>The second one creates a wearable-only notification by putting a data item in the shared data - * store and having a {@link com.google.android.gms.wearable.WearableListenerService} listen for - * that on the wearable</li> - * <li>The third one creates a local notification and a wearable notification by combining the above - * two. It, however, demonstrates how one can set things up so that the dismissal of one - * notification results in the dismissal of the other one.</li> - * </ul> - */ -public class PhoneActivity extends Activity implements GoogleApiClient.ConnectionCallbacks, - GoogleApiClient.OnConnectionFailedListener { - - private static final String TAG = "PhoneActivity"; - private GoogleApiClient mGoogleApiClient; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_phone); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - /** - * Builds a local-only notification for the handset. This is achieved by using - * <code>setLocalOnly(true)</code>. If <code>withDismissal</code> is set to <code>true</code>, a - * {@link android.app.PendingIntent} will be added to handle the dismissal of notification to - * be able to remove the mirrored notification on the wearable. - */ - private void buildLocalOnlyNotification(String title, String content, int notificationId, - boolean withDismissal) { - NotificationCompat.Builder builder = new NotificationCompat.Builder(this); - builder.setContentTitle(title) - .setContentText(content) - .setLocalOnly(true) - .setSmallIcon(R.drawable.ic_launcher); - - if (withDismissal) { - Intent dismissIntent = new Intent(Constants.ACTION_DISMISS); - dismissIntent.putExtra(Constants.KEY_NOTIFICATION_ID, Constants.BOTH_ID); - PendingIntent pendingIntent = PendingIntent - .getService(this, 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT); - builder.setDeleteIntent(pendingIntent); - } - NotificationManagerCompat.from(this).notify(notificationId, builder.build()); - } - - /** - * Builds a DataItem that on the wearable will be interpreted as a request to show a - * notification. The result will be a notification that only shows up on the wearable. - */ - private void buildWearableOnlyNotification(String title, String content, String path) { - if (mGoogleApiClient.isConnected()) { - PutDataMapRequest putDataMapRequest = PutDataMapRequest.create(path); - putDataMapRequest.getDataMap().putString(Constants.KEY_CONTENT, content); - putDataMapRequest.getDataMap().putString(Constants.KEY_TITLE, title); - PutDataRequest request = putDataMapRequest.asPutDataRequest(); - Wearable.DataApi.putDataItem(mGoogleApiClient, request) - .setResultCallback(new ResultCallback<DataApi.DataItemResult>() { - @Override - public void onResult(DataApi.DataItemResult dataItemResult) { - if (!dataItemResult.getStatus().isSuccess()) { - Log.e(TAG, "buildWatchOnlyNotification(): Failed to set the data, " - + "status: " + dataItemResult.getStatus().getStatusCode()); - } - } - }); - } else { - Log.e(TAG, "buildWearableOnlyNotification(): no Google API Client connection"); - } - } - - /** - * Builds a local notification and sets a DataItem that will be interpreted by the wearable as - * a request to build a notification on the wearable as as well. The two notifications show - * different messages. - * Dismissing either of the notifications will result in dismissal of the other; this is - * achieved by creating a {@link android.app.PendingIntent} that results in removal of - * the DataItem that created the watch notification. The deletion of the DataItem is observed on - * both sides, using WearableListenerService callbacks, and is interpreted on each side as a - * request to dismiss the corresponding notification. - */ - private void buildMirroredNotifications(String phoneTitle, String watchTitle, String content) { - if (mGoogleApiClient.isConnected()) { - // Wearable notification - buildWearableOnlyNotification(watchTitle, content, Constants.BOTH_PATH); - - // Local notification, with a pending intent for dismissal - buildLocalOnlyNotification(phoneTitle, content, Constants.BOTH_ID, true); - } - } - - @Override - protected void onStart() { - super.onStart(); - mGoogleApiClient.connect(); - } - - @Override - protected void onStop() { - mGoogleApiClient.disconnect(); - super.onStop(); - } - - @Override - public void onConnected(Bundle bundle) { - } - - @Override - public void onConnectionSuspended(int i) { - } - - @Override - public void onConnectionFailed(ConnectionResult connectionResult) { - Log.e(TAG, "Failed to connect to Google API Client"); - } - - /** - * Returns a string built from the current time - */ - private String now() { - SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss", Locale.getDefault()); - return sdf.format(new Date()); - } - - /** - * Handles button clicks in the UI. - */ - public void onClick(View view) { - int id = view.getId(); - switch (id) { - case R.id.phone_only: - buildLocalOnlyNotification(getString(R.string.phone_only), now(), - Constants.PHONE_ONLY_ID, false); - break; - case R.id.wear_only: - buildWearableOnlyNotification(getString(R.string.wear_only), now(), - Constants.WATCH_ONLY_PATH); - break; - case R.id.different_notifications: - buildMirroredNotifications(getString(R.string.phone_both), getString(R.string.watch_both), now()); - break; - } - } -} diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index f7dd9a0bd..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index fef2da78f..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index f2fb03cdd..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 944042ca8..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/layout/activity_phone.xml b/samples/wearable/SynchronizedNotifications/Application/src/main/res/layout/activity_phone.xml deleted file mode 100644 index 0c20bc0e3..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/layout/activity_phone.xml +++ /dev/null @@ -1,57 +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:paddingLeft="@dimen/activity_horizontal_margin" - android:paddingRight="@dimen/activity_horizontal_margin" - android:paddingTop="@dimen/activity_vertical_margin" - android:paddingBottom="@dimen/activity_vertical_margin" - tools:context=".PhoneActivity"> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/phone_only" - android:id="@+id/phone_only" - android:onClick="onClick" - android:layout_alignParentTop="true" - android:layout_centerHorizontal="true" /> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/wear_only" - android:id="@+id/wear_only" - android:onClick="onClick" - android:layout_below="@+id/phone_only" - android:layout_alignLeft="@+id/phone_only" - android:layout_marginTop="30dp" - android:layout_alignRight="@+id/phone_only" /> - - <Button - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/different_notifications" - android:id="@+id/different_notifications" - android:layout_below="@+id/wear_only" - android:onClick="onClick" - android:layout_alignLeft="@+id/wear_only" - android:layout_marginTop="30dp" - android:layout_alignRight="@+id/wear_only" /> -</RelativeLayout> diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/dimens.xml b/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/dimens.xml deleted file mode 100644 index a1e9cfe8a..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/dimens.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - <!-- Default screen margins, per the Android Design guidelines. --> - <dimen name="activity_horizontal_margin">16dp</dimen> - <dimen name="activity_vertical_margin">16dp</dimen> -</resources> diff --git a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/strings.xml b/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/strings.xml deleted file mode 100644 index 4115af09d..000000000 --- a/samples/wearable/SynchronizedNotifications/Application/src/main/res/values/strings.xml +++ /dev/null @@ -1,26 +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. ---> - -<resources> - - <string name="app_name">Synchronized Notifications</string> - <string name="wear_only">Watch Only Notification</string> - <string name="phone_only">Phone Only Notification</string> - <string name="different_notifications">Different Notifications</string> - <string name="phone_both">Phone Notification</string> - <string name="watch_both">Watch Notification</string> - -</resources> diff --git a/samples/wearable/SynchronizedNotifications/Common/build.gradle b/samples/wearable/SynchronizedNotifications/Common/build.gradle deleted file mode 100644 index f87e44cf7..000000000 --- a/samples/wearable/SynchronizedNotifications/Common/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -apply plugin: 'android-library' - -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' - } - } - productFlavors { - } -} diff --git a/samples/wearable/SynchronizedNotifications/Common/proguard-rules.txt b/samples/wearable/SynchronizedNotifications/Common/proguard-rules.txt deleted file mode 100644 index f4a05360a..000000000 --- a/samples/wearable/SynchronizedNotifications/Common/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in /usr/local/android-sdk/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/SynchronizedNotifications/Common/src/main/AndroidManifest.xml b/samples/wearable/SynchronizedNotifications/Common/src/main/AndroidManifest.xml deleted file mode 100644 index c07d858b9..000000000 --- a/samples/wearable/SynchronizedNotifications/Common/src/main/AndroidManifest.xml +++ /dev/null @@ -1,8 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.synchronizednotifications.common"> - - <application android:allowBackup="true" - android:label="@string/app_name"> - </application> - -</manifest> diff --git a/samples/wearable/SynchronizedNotifications/Common/src/main/java/com/example/android/wearable/synchronizednotifications/common/Constants.java b/samples/wearable/SynchronizedNotifications/Common/src/main/java/com/example/android/wearable/synchronizednotifications/common/Constants.java deleted file mode 100644 index 693533f5d..000000000 --- a/samples/wearable/SynchronizedNotifications/Common/src/main/java/com/example/android/wearable/synchronizednotifications/common/Constants.java +++ /dev/null @@ -1,38 +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.synchronizednotifications.common; - -/** - * Constants that are used in both the Application and the Wearable modules. - */ -public final class Constants { - - private Constants() {}; - - public static final int WATCH_ONLY_ID = 2; - public static final int PHONE_ONLY_ID = 3; - public static final int BOTH_ID = 4; - - public static final String BOTH_PATH = "/both"; - public static final String WATCH_ONLY_PATH = "/watch-only"; - public static final String KEY_NOTIFICATION_ID = "notification-id"; - public static final String KEY_TITLE = "title"; - public static final String KEY_CONTENT = "content"; - - public static final String ACTION_DISMISS - = "com.example.android.wearable.synchronizednotifications.DISMISS"; -} diff --git a/samples/wearable/SynchronizedNotifications/Common/src/main/res/values/strings.xml b/samples/wearable/SynchronizedNotifications/Common/src/main/res/values/strings.xml deleted file mode 100644 index b28ef6067..000000000 --- a/samples/wearable/SynchronizedNotifications/Common/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ -<resources> - <string name="app_name">Common</string> -</resources> diff --git a/samples/wearable/SynchronizedNotifications/Wearable/build.gradle b/samples/wearable/SynchronizedNotifications/Wearable/build.gradle deleted file mode 100644 index 2b4731203..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName '1.0' - } - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } - lintOptions { - abortOnError false - } -} - -dependencies { - 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 project(':Common') -} diff --git a/samples/wearable/SynchronizedNotifications/Wearable/proguard-rules.txt b/samples/wearable/SynchronizedNotifications/Wearable/proguard-rules.txt deleted file mode 100644 index 5b86c0858..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/proguard-rules.txt +++ /dev/null @@ -1,17 +0,0 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/AndroidManifest.xml b/samples/wearable/SynchronizedNotifications/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 8e099b3ca..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,49 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.synchronizednotifications" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light" > - <meta-data android:name="com.google.android.gms.version" - android:value="@integer/google_play_services_version" /> - <activity - android:name=".WearableActivity" - android:label="@string/app_name" > - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - <service android:name=".NotificationUpdateService"> - <intent-filter> - <action - android:name="com.google.android.gms.wearable.BIND_LISTENER" /> - </intent-filter> - <intent-filter> - <action - android:name="com.example.android.wearable.synchronizednotifications.DISMISS" /> - </intent-filter> - </service> - </application> - -</manifest> diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java b/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java deleted file mode 100644 index d57148379..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/NotificationUpdateService.java +++ /dev/null @@ -1,164 +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.synchronizednotifications; - -import static com.google.android.gms.wearable.PutDataRequest.WEAR_URI_SCHEME; - -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Intent; -import android.net.Uri; -import android.os.Bundle; -import android.util.Log; - -import com.example.android.wearable.synchronizednotifications.common.Constants; -import com.google.android.gms.common.ConnectionResult; -import com.google.android.gms.common.api.GoogleApiClient; -import com.google.android.gms.common.api.ResultCallback; -import com.google.android.gms.wearable.DataApi; -import com.google.android.gms.wearable.DataEvent; -import com.google.android.gms.wearable.DataEventBuffer; -import com.google.android.gms.wearable.DataMap; -import com.google.android.gms.wearable.DataMapItem; -import com.google.android.gms.wearable.PutDataMapRequest; -import com.google.android.gms.wearable.Wearable; -import com.google.android.gms.wearable.WearableListenerService; - -/** - * A {@link com.google.android.gms.wearable.WearableListenerService} that will be invoked when a - * DataItem is added or deleted. The creation of a new DataItem will be interpreted as a request to - * create a new notification and the removal of that DataItem is interpreted as a request to - * dismiss that notification. - */ -public class NotificationUpdateService extends WearableListenerService - implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, - ResultCallback<DataApi.DeleteDataItemsResult> { - - private static final String TAG = "NotificationUpdate"; - private GoogleApiClient mGoogleApiClient; - - @Override - public void onCreate() { - super.onCreate(); - mGoogleApiClient = new GoogleApiClient.Builder(this) - .addApi(Wearable.API) - .addConnectionCallbacks(this) - .addOnConnectionFailedListener(this) - .build(); - } - - @Override - public int onStartCommand(Intent intent, int flags, int startId) { - if (null != intent) { - String action = intent.getAction(); - if (Constants.ACTION_DISMISS.equals(action)) { - // We need to dismiss the wearable notification. We delete the data item that - // created the notification and that is how we inform the phone - int notificationId = intent.getIntExtra(Constants.KEY_NOTIFICATION_ID, -1); - if (notificationId == Constants.BOTH_ID) { - dismissPhoneNotification(notificationId); - } - } - } - return super.onStartCommand(intent, flags, startId); - } - - /** - * Dismisses the phone notification, via a {@link android.app.PendingIntent} that is triggered - * when the user dismisses the local notification. Deleting the corresponding data item notifies - * the {@link com.google.android.gms.wearable.WearableListenerService} on the phone that the - * matching notification on the phone side should be removed. - */ - private void dismissPhoneNotification(int id) { - mGoogleApiClient.connect(); - } - - @Override - public void onDataChanged(DataEventBuffer dataEvents) { - for (DataEvent dataEvent : dataEvents) { - if (dataEvent.getType() == DataEvent.TYPE_CHANGED) { - DataMap dataMap = DataMapItem.fromDataItem(dataEvent.getDataItem()).getDataMap(); - String content = dataMap.getString(Constants.KEY_CONTENT); - String title = dataMap.getString(Constants.KEY_TITLE); - if (Constants.WATCH_ONLY_PATH.equals(dataEvent.getDataItem().getUri().getPath())) { - buildWearableOnlyNotification(title, content, false); - } else if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) { - buildWearableOnlyNotification(title, content, true); - } - } else if (dataEvent.getType() == DataEvent.TYPE_DELETED) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "DataItem deleted: " + dataEvent.getDataItem().getUri().getPath()); - } - if (Constants.BOTH_PATH.equals(dataEvent.getDataItem().getUri().getPath())) { - // Dismiss the corresponding notification - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .cancel(Constants.WATCH_ONLY_ID); - } - } - } - } - - /** - * Builds a simple notification on the wearable. - */ - private void buildWearableOnlyNotification(String title, String content, - boolean withDismissal) { - Notification.Builder builder = new Notification.Builder(this) - .setSmallIcon(R.drawable.ic_launcher) - .setContentTitle(title) - .setContentText(content); - - if (withDismissal) { - Intent dismissIntent = new Intent(Constants.ACTION_DISMISS); - dismissIntent.putExtra(Constants.KEY_NOTIFICATION_ID, Constants.BOTH_ID); - PendingIntent pendingIntent = PendingIntent - .getService(this, 0, dismissIntent, PendingIntent.FLAG_UPDATE_CURRENT); - builder.setDeleteIntent(pendingIntent); - } - - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)) - .notify(Constants.WATCH_ONLY_ID, builder.build()); - } - - @Override - public void onConnected(Bundle bundle) { - final Uri dataItemUri = - new Uri.Builder().scheme(WEAR_URI_SCHEME).path(Constants.BOTH_PATH).build(); - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Deleting Uri: " + dataItemUri.toString()); - } - Wearable.DataApi.deleteDataItems( - mGoogleApiClient, dataItemUri).setResultCallback(this); - } - - @Override - public void onConnectionSuspended(int i) { - } - - @Override - public void onConnectionFailed(ConnectionResult connectionResult) { - } - - @Override - public void onResult(DataApi.DeleteDataItemsResult deleteDataItemsResult) { - if (!deleteDataItemsResult.getStatus().isSuccess()) { - Log.e(TAG, "dismissWearableNotification(): failed to delete DataItem"); - } - mGoogleApiClient.disconnect(); - } -}
\ No newline at end of file diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/WearableActivity.java b/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/WearableActivity.java deleted file mode 100644 index 9c653d9b2..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/java/com/example/android/wearable/synchronizednotifications/WearableActivity.java +++ /dev/null @@ -1,29 +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.synchronizednotifications; - -import android.app.Activity; -import android.os.Bundle; - -public class WearableActivity extends Activity { - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_wearable); - } -} diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index f7dd9a0bd..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index fef2da78f..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index f2fb03cdd..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/layout/activity_wearable.xml b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/layout/activity_wearable.xml deleted file mode 100644 index 71451ff50..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/layout/activity_wearable.xml +++ /dev/null @@ -1,23 +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" - tools:context=".WearableActivity"> - -</RelativeLayout> diff --git a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/values/strings.xml b/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 81eb3f011..000000000 --- a/samples/wearable/SynchronizedNotifications/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,21 +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. ---> - -<resources> - - <string name="app_name">Synchronized Notifications</string> - -</resources> diff --git a/samples/wearable/SynchronizedNotifications/_index.html b/samples/wearable/SynchronizedNotifications/_index.html deleted file mode 100644 index 1461ba6b6..000000000 --- a/samples/wearable/SynchronizedNotifications/_index.html +++ /dev/null @@ -1,28 +0,0 @@ -<p><b>About:</b> This sample creates three simple types of notifications: - <ol> - <li>A phone-only notification</li> - <li>A watch-only notification</li> - <li>A pair of synchronized phone and watch notifications where the content shown - on the watch notification is different from the one on the phone. These notifications - are synchronized in the sense that dismissing one results in dismissal of the other one - (all based on the Data Layer APIs).</li> - </ol> -</p> -<p><b>How to run:</b> Install the Application APK on the companion, and the Wearable APK on the -wearable. Start the sample by running the SynchronizedNotifications application on the companion. -</p> -<p><b>Wearable APIs used:</b> DataApi, WearableListenerService</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/notification_options.png" alt="Notification options" width="216" - height="384"> - <img src="screenshots/watch_only_notification.png" alt="Watch only notification" width="140" - height="140"> - <img src="screenshots/different_notifications_phone.png" - alt="Different notifications - phone" width="216" height="384"> - <img src="screenshots/different_notifications_wearable.png" - alt="Different notifications - watch" width="140" height="140"> - <figcaption>From left to right: notification options, Watch Only Notification, Different - Notifications - Phone, and Different Notifications - Watch</figcaption> - </figure> -</p>
\ No newline at end of file diff --git a/samples/wearable/SynchronizedNotifications/build.gradle b/samples/wearable/SynchronizedNotifications/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/SynchronizedNotifications/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/SynchronizedNotifications/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/SynchronizedNotifications/gradlew b/samples/wearable/SynchronizedNotifications/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/SynchronizedNotifications/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/SynchronizedNotifications/gradlew.bat b/samples/wearable/SynchronizedNotifications/gradlew.bat deleted file mode 100644 index aec99730b..000000000 --- a/samples/wearable/SynchronizedNotifications/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_phone.png b/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_phone.png Binary files differdeleted file mode 100644 index cab31e090..000000000 --- a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_phone.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_wearable.png b/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_wearable.png Binary files differdeleted file mode 100644 index 97da71527..000000000 --- a/samples/wearable/SynchronizedNotifications/screenshots/different_notifications_wearable.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/screenshots/notification_options.png b/samples/wearable/SynchronizedNotifications/screenshots/notification_options.png Binary files differdeleted file mode 100644 index 8cd00950a..000000000 --- a/samples/wearable/SynchronizedNotifications/screenshots/notification_options.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/screenshots/watch_only_notification.png b/samples/wearable/SynchronizedNotifications/screenshots/watch_only_notification.png Binary files differdeleted file mode 100644 index 34e950fea..000000000 --- a/samples/wearable/SynchronizedNotifications/screenshots/watch_only_notification.png +++ /dev/null diff --git a/samples/wearable/SynchronizedNotifications/settings.gradle b/samples/wearable/SynchronizedNotifications/settings.gradle deleted file mode 100644 index 7a1e93702..000000000 --- a/samples/wearable/SynchronizedNotifications/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':Application', ':Wearable', ':Common' diff --git a/samples/wearable/Timer/Wearable/build.gradle b/samples/wearable/Timer/Wearable/build.gradle deleted file mode 100644 index 9c8901452..000000000 --- a/samples/wearable/Timer/Wearable/build.gradle +++ /dev/null @@ -1,22 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName '1.0' - } - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile 'com.google.android.support:wearable:+' -} diff --git a/samples/wearable/Timer/Wearable/proguard-rules.txt b/samples/wearable/Timer/Wearable/proguard-rules.txt deleted file mode 100644 index 08e5bdc8d..000000000 --- a/samples/wearable/Timer/Wearable/proguard-rules.txt +++ /dev/null @@ -1,22 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} --dontwarn android.support.wearable.view.DelayedConfirmationView --dontwarn android.support.wearable.view.CircledImageView diff --git a/samples/wearable/Timer/Wearable/src/main/AndroidManifest.xml b/samples/wearable/Timer/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index 22c7f4775..000000000 --- a/samples/wearable/Timer/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,44 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.wearable.timer" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:icon="@mipmap/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault.Light" - android:allowBackup="true"> - - <!-- Timer components --> - <activity android:name=".SetTimerActivity"> - <intent-filter> - <action android:name="com.android.example.clockwork.timer.TIMER"/> - <category android:name="android.intent.category.DEFAULT"/> - </intent-filter> - <!-- Set a timer voice command --> - <intent-filter> - <action android:name="android.intent.action.SET_TIMER"/> - <category android:name="android.intent.category.DEFAULT"/> - </intent-filter> - </activity> - - <service android:name=".TimerNotificationService" /> - - </application> -</manifest> diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/SetTimerActivity.java b/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/SetTimerActivity.java deleted file mode 100644 index f660f9ff1..000000000 --- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/SetTimerActivity.java +++ /dev/null @@ -1,217 +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.timer; - -import android.app.Activity; -import android.app.AlarmManager; -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.content.res.Resources; -import android.os.Bundle; -import android.provider.AlarmClock; -import android.support.wearable.view.WearableListView; -import android.util.Log; -import android.view.LayoutInflater; -import android.view.ViewGroup; -import android.widget.TextView; - -import com.example.android.wearable.timer.util.Constants; -import com.example.android.wearable.timer.util.TimerFormat; - -/** This class sets a timer. */ -public class SetTimerActivity extends Activity implements WearableListView.ClickListener { - - public static final int NUMBER_OF_TIMES = 10; - public static final String TAG = "SetTimerActivity"; - - private ListViewItem[] mTimeOptions = new ListViewItem[NUMBER_OF_TIMES]; - private WearableListView mWearableListView; - - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - int paramLength = getIntent().getIntExtra(AlarmClock.EXTRA_LENGTH, 0); - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "SetTimerActivity:onCreate=" + paramLength); - } - if (paramLength > 0 && paramLength <= 86400) { - long durationMillis = paramLength * 1000; - setupTimer(durationMillis); - finish(); - return; - } - - Resources res = getResources(); - for (int i = 0; i < NUMBER_OF_TIMES; i++) { - mTimeOptions[i] = new ListViewItem( - res.getQuantityString(R.plurals.timer_minutes, i + 1, i + 1), - (i + 1) * 60 * 1000); - } - - setContentView(R.layout.timer_set_timer); - - // Initialize a simple list of countdown time options. - mWearableListView = (WearableListView) findViewById(R.id.times_list_view); - mWearableListView.setAdapter(new TimerWearableListViewAdapter(this)); - mWearableListView.setClickListener(this); - } - - /** - * Sets up an alarm (and an associated notification) to go off after <code>duration</code> - * milliseconds. - */ - private void setupTimer(long duration) { - NotificationManager notifyMgr = - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)); - - // Delete dataItem and cancel a potential old countdown. - cancelCountdown(notifyMgr); - - // Build notification and set it. - notifyMgr.notify(Constants.NOTIFICATION_TIMER_COUNTDOWN, buildNotification(duration)); - - // Register with the alarm manager to display a notification when the timer is done. - registerWithAlarmManager(duration); - - finish(); - } - - @Override - public void onClick(WearableListView.ViewHolder holder) { - long duration = mTimeOptions[holder.getPosition()].duration; - setupTimer(duration); - } - - @Override - public void onTopEmptyRegionClick() { - } - - private void registerWithAlarmManager(long duration) { - // Get the alarm manager. - AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE); - - // Create intent that gets fired when timer expires. - Intent intent = new Intent(Constants.ACTION_SHOW_ALARM, null, this, - TimerNotificationService.class); - PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent, - PendingIntent.FLAG_UPDATE_CURRENT); - - // Calculate the time when it expires. - long wakeupTime = System.currentTimeMillis() + duration; - - // Schedule an alarm. - alarm.setExact(AlarmManager.RTC_WAKEUP, wakeupTime, pendingIntent); - } - - /** - * Build a notification including different actions and other various setup and return it. - * - * @param duration the duration of the timer. - * @return the notification to display. - */ - - private Notification buildNotification(long duration) { - // Intent to restart a timer. - Intent restartIntent = new Intent(Constants.ACTION_RESTART_ALARM, null, this, - TimerNotificationService.class); - PendingIntent pendingIntentRestart = PendingIntent - .getService(this, 0, restartIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - // Intent to delete a timer. - Intent deleteIntent = new Intent(Constants.ACTION_DELETE_ALARM, null, this, - TimerNotificationService.class); - PendingIntent pendingIntentDelete = PendingIntent - .getService(this, 0, deleteIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - // Create countdown notification using a chronometer style. - return new Notification.Builder(this) - .setSmallIcon(R.drawable.ic_cc_alarm) - .setContentTitle(getString(R.string.timer_time_left)) - .setContentText(TimerFormat.getTimeString(duration)) - .setUsesChronometer(true) - .setWhen(System.currentTimeMillis() + duration) - .addAction(R.drawable.ic_cc_alarm, getString(R.string.timer_restart), - pendingIntentRestart) - .addAction(R.drawable.ic_cc_alarm, getString(R.string.timer_delete), - pendingIntentDelete) - .setDeleteIntent(pendingIntentDelete) - .setLocalOnly(true) - .build(); - } - - /** - * Cancels an old countdown and deletes the dataItem. - * - * @param notifyMgr the notification manager. - */ - private void cancelCountdown(NotificationManager notifyMgr) { - notifyMgr.cancel(Constants.NOTIFICATION_TIMER_EXPIRED); - } - - /** Model class for the listview. */ - private static class ListViewItem { - - // Duration in milliseconds. - long duration; - // Label to display. - private String label; - - public ListViewItem(String label, long duration) { - this.label = label; - this.duration = duration; - } - - @Override - public String toString() { - return label; - } - } - - private final class TimerWearableListViewAdapter extends WearableListView.Adapter { - private final Context mContext; - private final LayoutInflater mInflater; - - private TimerWearableListViewAdapter(Context context) { - mContext = context; - mInflater = LayoutInflater.from(context); - } - - @Override - public WearableListView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { - return new WearableListView.ViewHolder( - mInflater.inflate(R.layout.timer_list_item, null)); - } - - @Override - public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { - TextView view = (TextView) holder.itemView.findViewById(R.id.time_text); - view.setText(mTimeOptions[position].label); - holder.itemView.setTag(position); - } - - @Override - public int getItemCount() { - return NUMBER_OF_TIMES; - } - } - -} diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/TimerNotificationService.java b/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/TimerNotificationService.java deleted file mode 100644 index 5822fe410..000000000 --- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/TimerNotificationService.java +++ /dev/null @@ -1,119 +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.timer; - -import android.app.AlarmManager; -import android.app.IntentService; -import android.app.Notification; -import android.app.NotificationManager; -import android.app.PendingIntent; -import android.content.Context; -import android.content.Intent; -import android.util.Log; - -import com.example.android.wearable.timer.util.Constants; - -/** - * Service class that manages notifications of the timer. - */ -public class TimerNotificationService extends IntentService { - - public static final String TAG = "TimerNotificationSvc"; - - public TimerNotificationService() { - super(TAG); - } - - @Override - public void onCreate() { - super.onCreate(); - } - - @Override - protected void onHandleIntent(Intent intent) { - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "onHandleIntent called with intent: " + intent); - } - String action = intent.getAction(); - if (Constants.ACTION_SHOW_ALARM.equals(action)) { - showTimerDoneNotification(); - } else if (Constants.ACTION_DELETE_ALARM.equals(action)) { - deleteTimer(); - } else if (Constants.ACTION_RESTART_ALARM.equals(action)) { - restartAlarm(); - } else { - throw new IllegalStateException("Undefined constant used: " + action); - } - } - - private void restartAlarm() { - Intent dialogIntent = new Intent(this, SetTimerActivity.class); - dialogIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - startActivity(dialogIntent); - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Timer restarted."); - } - } - - private void deleteTimer() { - cancelCountdownNotification(); - - AlarmManager alarm = (AlarmManager) getSystemService(Context.ALARM_SERVICE); - Intent intent = new Intent(Constants.ACTION_SHOW_ALARM, null, this, - TimerNotificationService.class); - PendingIntent pendingIntent = PendingIntent.getService(this, 0, intent, - PendingIntent.FLAG_UPDATE_CURRENT); - alarm.cancel(pendingIntent); - - if (Log.isLoggable(TAG, Log.DEBUG)) { - Log.d(TAG, "Timer deleted."); - } - } - - private void cancelCountdownNotification() { - NotificationManager notifyMgr = - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)); - notifyMgr.cancel(Constants.NOTIFICATION_TIMER_COUNTDOWN); - } - - private void showTimerDoneNotification() { - // Cancel the countdown notification to show the "timer done" notification. - cancelCountdownNotification(); - - // Create an intent to restart a timer. - Intent restartIntent = new Intent(Constants.ACTION_RESTART_ALARM, null, this, - TimerNotificationService.class); - PendingIntent pendingIntentRestart = PendingIntent - .getService(this, 0, restartIntent, PendingIntent.FLAG_UPDATE_CURRENT); - - // Create notification that timer has expired. - NotificationManager notifyMgr = - ((NotificationManager) getSystemService(NOTIFICATION_SERVICE)); - Notification notif = new Notification.Builder(this) - .setSmallIcon(R.drawable.ic_cc_alarm) - .setContentTitle(getString(R.string.timer_done)) - .setContentText(getString(R.string.timer_done)) - .setUsesChronometer(true) - .setWhen(System.currentTimeMillis()) - .addAction(R.drawable.ic_cc_alarm, getString(R.string.timer_restart), - pendingIntentRestart) - .setLocalOnly(true) - .build(); - notifyMgr.notify(Constants.NOTIFICATION_TIMER_EXPIRED, notif); - } - -} diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/WearableListItemLayout.java b/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/WearableListItemLayout.java deleted file mode 100644 index 0bbc58720..000000000 --- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/WearableListItemLayout.java +++ /dev/null @@ -1,90 +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.timer; - -import android.content.Context; -import android.graphics.drawable.GradientDrawable; -import android.support.wearable.view.WearableListView; -import android.util.AttributeSet; -import android.widget.ImageView; -import android.widget.LinearLayout; -import android.widget.TextView; - -public class WearableListItemLayout extends LinearLayout implements WearableListView.Item { - private final float mFadedTextAlpha; - private final int mFadedCircleColor; - private final int mChosenCircleColor; - private ImageView mCircle; - private float mScale; - private TextView mName; - - public WearableListItemLayout(Context context) { - this(context, null); - } - - public WearableListItemLayout(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public WearableListItemLayout(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - mFadedTextAlpha = getResources().getInteger(R.integer.action_text_faded_alpha) / 100f; - mFadedCircleColor = getResources().getColor(R.color.wl_gray); - mChosenCircleColor = getResources().getColor(R.color.wl_blue); - } - - @Override - protected void onFinishInflate() { - super.onFinishInflate(); - mCircle = (ImageView) findViewById(R.id.circle); - mName = (TextView) findViewById(R.id.time_text); - } - - @Override - public float getProximityMinValue() { - return 1f; - } - - @Override - public float getProximityMaxValue() { - return 1.6f; - } - - @Override - public float getCurrentProximityValue() { - return mScale; - } - - @Override - public void setScalingAnimatorValue(float scale) { - mScale = scale; - mCircle.setScaleX(scale); - mCircle.setScaleY(scale); - } - - @Override - public void onScaleUpStart() { - mName.setAlpha(1f); - ((GradientDrawable) mCircle.getDrawable()).setColor(mChosenCircleColor); - } - - @Override - public void onScaleDownStart() { - ((GradientDrawable) mCircle.getDrawable()).setColor(mFadedCircleColor); - mName.setAlpha(mFadedTextAlpha); - } -} diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/Constants.java b/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/Constants.java deleted file mode 100644 index 85885e415..000000000 --- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/Constants.java +++ /dev/null @@ -1,43 +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.timer.util; - -import android.net.Uri; - -/** Used to hold constants. */ -public final class Constants { - - public static final String START_TIME = "timer_start_time"; - public static final String ORIGINAL_TIME = "timer_original_time"; - public static final String DATA_ITEM_PATH = "/timer"; - public static final Uri URI_PATTERN_DATA_ITEMS = - Uri.fromParts("wear", DATA_ITEM_PATH, null); - - public static final int NOTIFICATION_TIMER_COUNTDOWN = 1; - public static final int NOTIFICATION_TIMER_EXPIRED = 2; - - public static final String ACTION_SHOW_ALARM - = "com.android.example.clockwork.timer.ACTION_SHOW"; - public static final String ACTION_DELETE_ALARM - = "com.android.example.clockwork.timer.ACTION_DELETE"; - public static final String ACTION_RESTART_ALARM - = "com.android.example.clockwork.timer.ACTION_RESTART"; - - private Constants() { - } - -} diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerFormat.java b/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerFormat.java deleted file mode 100644 index b40351ba4..000000000 --- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerFormat.java +++ /dev/null @@ -1,121 +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.timer.util; - -/** Helper class to format the timer. Based on com.android.deskclock.timer.CountingTimerView. */ -public final class TimerFormat { - - private static final String TWO_DIGITS = "%02d"; - - private static final String ONE_DIGIT = "%01d"; - - private static final String NEG_TWO_DIGITS = "-%02d"; - - private static final String NEG_ONE_DIGIT = "-%01d"; - - private static String mHours; - - private static String mMinutes; - - private static String mSeconds; - - private TimerFormat() { - - } - - /** - * Update the time to display. Separates that time into the hours, minutes, seconds. - * Copied and shortened from com.android.deskclock.timer.CountingTimerView. - * - * @param time new time to display - in milliseconds - */ - private static void setTime(long time) { - boolean neg = false; - boolean showNeg = false; - String format; - if (time < 0) { - time = -time; - neg = showNeg = true; - } - long seconds = time / 1000; - long hundreds = (time - seconds * 1000) / 10; - long minutes = seconds / 60; - seconds = seconds - minutes * 60; - long hours = minutes / 60; - minutes = minutes - hours * 60; - if (hours > 999) { - hours = 0; - } - // The time can be between 0 and -1 seconds, but the "truncated" equivalent time of hours - // and minutes and seconds could be zero, so since we do not show fractions of seconds - // when counting down, do not show the minus sign. - if (hours == 0 && minutes == 0 && seconds == 0) { - showNeg = false; - } - - // Normalize and check if it is 'time' to invalidate - if (!neg && hundreds != 0) { - seconds++; - if (seconds == 60) { - seconds = 0; - minutes++; - if (minutes == 60) { - minutes = 0; - hours++; - } - } - } - - // Hours may be empty - if (hours >= 10) { - format = showNeg ? NEG_TWO_DIGITS : TWO_DIGITS; - mHours = String.format(format, hours); - } else if (hours > 0) { - format = showNeg ? NEG_ONE_DIGIT : ONE_DIGIT; - mHours = String.format(format, hours); - } else { - mHours = null; - } - - // Minutes are never empty and when hours are non-empty, must be two digits - if (minutes >= 10 || hours > 0) { - format = (showNeg && hours == 0) ? NEG_TWO_DIGITS : TWO_DIGITS; - mMinutes = String.format(format, minutes); - } else { - format = (showNeg && hours == 0) ? NEG_ONE_DIGIT : ONE_DIGIT; - mMinutes = String.format(format, minutes); - } - - // Seconds are always two digits - mSeconds = String.format(TWO_DIGITS, seconds); - } - - /** - * Based on com.android.deskclock.timer.CountingTimerView. - * - * @param time the time to format. - * @return nicely formatted time. - */ - public static String getTimeString(long time) { - setTime(time); - if (mHours == null) { - return String.format("%s:%s", mMinutes, mSeconds); - } - return String.format("%s:%s:%s", mHours, mMinutes, mSeconds); - - } -} diff --git a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerObj.java b/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerObj.java deleted file mode 100644 index 52f7244c8..000000000 --- a/samples/wearable/Timer/Wearable/src/main/java/com/example/android/wearable/timer/util/TimerObj.java +++ /dev/null @@ -1,49 +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.timer.util; - -import android.os.SystemClock; - -/** This class represents a timer. */ -public class TimerObj { - - // Start time in milliseconds. - public long startTime; - - // Length of the timer in milliseconds. - public long originalLength; - - /** - * Construct a timer with a specific start time and length. - * - * @param startTime the start time of the timer. - * @param timerLength the length of the timer. - */ - public TimerObj(long startTime, long timerLength) { - this.startTime = startTime; - this.originalLength = timerLength; - } - - /** - * Calculate the time left of this timer. - * @return the time left for this timer. - */ - public long timeLeft() { - long millis = SystemClock.elapsedRealtime(); - return originalLength - (millis - startTime); - } -} diff --git a/samples/wearable/Timer/Wearable/src/main/res/drawable/ic_cc_alarm.png b/samples/wearable/Timer/Wearable/src/main/res/drawable/ic_cc_alarm.png Binary files differdeleted file mode 100644 index ad51ddf4d..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/drawable/ic_cc_alarm.png +++ /dev/null diff --git a/samples/wearable/Timer/Wearable/src/main/res/drawable/wl_circle.xml b/samples/wearable/Timer/Wearable/src/main/res/drawable/wl_circle.xml deleted file mode 100644 index a06c53a8d..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/drawable/wl_circle.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<shape - xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="oval"> - <solid android:color="@color/wl_gray"/> -</shape> diff --git a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_list_item.xml b/samples/wearable/Timer/Wearable/src/main/res/layout/timer_list_item.xml deleted file mode 100644 index 6cef07a2b..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_list_item.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<com.example.android.wearable.timer.WearableListItemLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:gravity="center_vertical" - android:layout_width="match_parent" - android:layout_height="80dp"> - <ImageView - android:id="@+id/circle" - android:layout_height="20dp" - android:layout_margin="16dp" - android:layout_width="20dp" - android:src="@drawable/wl_circle"/> - <TextView - android:id="@+id/time_text" - android:gravity="center_vertical|left" - android:layout_width="wrap_content" - android:layout_marginRight="16dp" - android:layout_height="match_parent" - android:fontFamily="sans-serif-condensed-light" - android:lineSpacingExtra="-4sp" - android:textColor="@color/text_color" - android:textSize="16sp"/> -</com.example.android.wearable.timer.WearableListItemLayout>
\ No newline at end of file diff --git a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_set_timer.xml b/samples/wearable/Timer/Wearable/src/main/res/layout/timer_set_timer.xml deleted file mode 100644 index cdf9e77e2..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/layout/timer_set_timer.xml +++ /dev/null @@ -1,23 +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. ---> - -<android.support.wearable.view.WearableListView - xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/times_list_view" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:scrollbars="none" - android:dividerHeight="0dp" />
\ No newline at end of file diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/wearable/Timer/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 56f7fc168..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/wearable/Timer/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png Binary files differdeleted file mode 100644 index dec99cdfe..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/wearable/Timer/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 48fa0abf7..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 817392194..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png Binary files differdeleted file mode 100644 index 0dce80932..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/mipmap-xxxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/Timer/Wearable/src/main/res/values/colors.xml b/samples/wearable/Timer/Wearable/src/main/res/values/colors.xml deleted file mode 100644 index a8bb87b7e..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/values/colors.xml +++ /dev/null @@ -1,6 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <color name="wl_blue">#2878ff</color> - <color name="wl_gray">#c1c1c1</color> - <color name="text_color">#434343</color> -</resources> diff --git a/samples/wearable/Timer/Wearable/src/main/res/values/integers.xml b/samples/wearable/Timer/Wearable/src/main/res/values/integers.xml deleted file mode 100644 index c3bc25215..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/values/integers.xml +++ /dev/null @@ -1,4 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<resources> - <integer name="action_text_faded_alpha">40</integer> -</resources> diff --git a/samples/wearable/Timer/Wearable/src/main/res/values/strings.xml b/samples/wearable/Timer/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index f7e05bb44..000000000 --- a/samples/wearable/Timer/Wearable/src/main/res/values/strings.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. ---> - -<resources> - <string name="app_name">Timer Example Wearable App</string> - <string name="timer_done">Timer done</string> - <string name="timer_time_left">Time remaining</string> - <string name="timer_delete">Delete</string> - <string name="timer_restart">Restart</string> - <plurals name="timer_minutes"> - <item quantity="one">1 minute</item> - <item quantity="other">%d minutes</item> - </plurals> -</resources> diff --git a/samples/wearable/Timer/_index.html b/samples/wearable/Timer/_index.html deleted file mode 100644 index 10ccf30b5..000000000 --- a/samples/wearable/Timer/_index.html +++ /dev/null @@ -1,13 +0,0 @@ -<p><b>About:</b> This simple wearable app allows the user to set a countdown timer. It runs -independently on the wearable with no phone connection.</p> -<p><b>How to run:</b> Install the Wearable APK on the wearable, then start the timer via the voice -menu, either by saying "OK Google, start a timer" or by tapping the home screen and selecting -"Start a timer".</p> -<p><b>Wearable APIs used:</b> voice command trigger, WearableListView</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/timer.png" alt="GridViewPager" width="140" height="140"> - <img src="screenshots/timer_countdown.png" alt="GridViewPager" width="140" height="140"> - <figcaption>A simple timer.</figcaption> - </figure> -</p> diff --git a/samples/wearable/Timer/build.gradle b/samples/wearable/Timer/build.gradle deleted file mode 100644 index 8bd4ffc49..000000000 --- a/samples/wearable/Timer/build.gradle +++ /dev/null @@ -1,14 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} diff --git a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/Timer/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/Timer/gradlew b/samples/wearable/Timer/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/Timer/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/Timer/gradlew.bat b/samples/wearable/Timer/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/Timer/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/Timer/screenshots/timer.png b/samples/wearable/Timer/screenshots/timer.png Binary files differdeleted file mode 100644 index 6ef8f869a..000000000 --- a/samples/wearable/Timer/screenshots/timer.png +++ /dev/null diff --git a/samples/wearable/Timer/screenshots/timer_countdown.png b/samples/wearable/Timer/screenshots/timer_countdown.png Binary files differdeleted file mode 100644 index 505733df6..000000000 --- a/samples/wearable/Timer/screenshots/timer_countdown.png +++ /dev/null diff --git a/samples/wearable/Timer/settings.gradle b/samples/wearable/Timer/settings.gradle deleted file mode 100644 index 1d97d30e1..000000000 --- a/samples/wearable/Timer/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':Wearable' diff --git a/samples/wearable/WatchViewStub/Wearable/build.gradle b/samples/wearable/WatchViewStub/Wearable/build.gradle deleted file mode 100644 index b9450ca9a..000000000 --- a/samples/wearable/WatchViewStub/Wearable/build.gradle +++ /dev/null @@ -1,24 +0,0 @@ -apply plugin: 'android' - -android { - compileSdkVersion 20 - buildToolsVersion '20' - - defaultConfig { - minSdkVersion 20 - targetSdkVersion 20 - versionCode 1 - versionName "1.0" - } - - buildTypes { - release { - runProguard false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' - } - } -} - -dependencies { - compile "com.google.android.support:wearable:1.0.+" -} diff --git a/samples/wearable/WatchViewStub/Wearable/proguard-rules.txt b/samples/wearable/WatchViewStub/Wearable/proguard-rules.txt deleted file mode 100644 index f2fe1559a..000000000 --- a/samples/wearable/WatchViewStub/Wearable/proguard-rules.txt +++ /dev/null @@ -1,20 +0,0 @@ -# To enable ProGuard in your project, edit project.properties -# to define the proguard.config property as described in that file. -# -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the ProGuard -# include property in project.properties. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/AndroidManifest.xml b/samples/wearable/WatchViewStub/Wearable/src/main/AndroidManifest.xml deleted file mode 100644 index b52a494f8..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/AndroidManifest.xml +++ /dev/null @@ -1,37 +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. ---> - -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.example.android.google.wearable.watchviewstub" > - - <uses-feature android:name="android.hardware.type.watch" /> - - <application - android:allowBackup="true" - android:icon="@drawable/ic_launcher" - android:label="@string/app_name" - android:theme="@android:style/Theme.DeviceDefault"> - <activity - android:name="com.example.android.google.wearable.watchviewstub.MainActivity" - android:label="@string/app_name"> - <intent-filter> - <action android:name="android.intent.action.MAIN"/> - <category android:name="android.intent.category.LAUNCHER"/> - </intent-filter> - </activity> - </application> - -</manifest> diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/java/com/example/android/google/wearable/watchviewstub/MainActivity.java b/samples/wearable/WatchViewStub/Wearable/src/main/java/com/example/android/google/wearable/watchviewstub/MainActivity.java deleted file mode 100644 index e4271d24b..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/java/com/example/android/google/wearable/watchviewstub/MainActivity.java +++ /dev/null @@ -1,85 +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.google.wearable.watchviewstub; - -import android.app.Activity; -import android.os.Bundle; -import android.support.v4.view.GestureDetectorCompat; -import android.support.wearable.view.DismissOverlayView; -import android.support.wearable.view.WatchViewStub; -import android.view.GestureDetector; -import android.view.MotionEvent; -import android.view.View; -import android.view.animation.Animation; -import android.view.animation.ScaleAnimation; -import android.widget.RelativeLayout; - -public class MainActivity extends Activity { - private RelativeLayout mRectBackground; - private RelativeLayout mRoundBackground; - - private GestureDetectorCompat mGestureDetector; - private DismissOverlayView mDismissOverlayView; - - @Override - public void onCreate(Bundle b) { - super.onCreate(b); - setContentView(R.layout.main_activity); - - WatchViewStub stub = (WatchViewStub) findViewById(R.id.stub); - stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() { - @Override - public void onLayoutInflated(WatchViewStub stub) { - mRectBackground = (RelativeLayout) findViewById(R.id.rect_layout); - mRoundBackground = (RelativeLayout) findViewById(R.id.round_layout); - } - }); - - mDismissOverlayView = (DismissOverlayView) findViewById(R.id.dismiss_overlay); - mGestureDetector = new GestureDetectorCompat(this, new LongPressListener()); - } - - /** - * Animates the layout when clicked. The animation used depends on whether the - * device is round or rectangular. - */ - public void onLayoutClicked(View view) { - if (mRectBackground != null) { - ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.7f, 1.0f, 0.7f, - Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); - scaleAnimation.setDuration(300); - scaleAnimation.setRepeatCount(1); - scaleAnimation.setRepeatMode(Animation.REVERSE); - mRectBackground.startAnimation(scaleAnimation); - } - if (mRoundBackground != null) { - mRoundBackground.animate().rotationBy(360).setDuration(300).start(); - } - } - - @Override - public boolean dispatchTouchEvent(MotionEvent event) { - return mGestureDetector.onTouchEvent(event) || super.dispatchTouchEvent(event); - } - - private class LongPressListener extends GestureDetector.SimpleOnGestureListener { - @Override - public void onLongPress(MotionEvent event) { - mDismissOverlayView.show(); - } - } -} diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-hdpi/ic_launcher.png b/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-hdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 589f229d1..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-hdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-mdpi/ic_launcher.png b/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-mdpi/ic_launcher.png Binary files differdeleted file mode 100755 index 77dd57139..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-mdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png b/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index fe34ebe13..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png b/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differdeleted file mode 100755 index ab80bcd13..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable-xxhdpi/ic_launcher.png +++ /dev/null diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/rect_background.xml b/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/rect_background.xml deleted file mode 100644 index eeda78fa0..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/rect_background.xml +++ /dev/null @@ -1,23 +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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="rectangle"> - <corners android:radius="@dimen/rect_corner_radius"/> - <gradient android:startColor="@color/green" - android:endColor="@color/blue" - android:angle="45"/> -</shape> diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/round_background.xml b/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/round_background.xml deleted file mode 100644 index 432b0d24a..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/drawable/round_background.xml +++ /dev/null @@ -1,22 +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. ---> - -<shape xmlns:android="http://schemas.android.com/apk/res/android" - android:shape="ring" - android:useLevel="false" > - <gradient android:startColor="@color/green" - android:endColor="@color/blue"/> -</shape> diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/main_activity.xml b/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/main_activity.xml deleted file mode 100644 index e9745bc6e..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/main_activity.xml +++ /dev/null @@ -1,36 +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" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <android.support.wearable.view.WatchViewStub - xmlns:app="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/stub" - app:rectLayout="@layout/rect_layout" - app:roundLayout="@layout/round_layout"/> - - <android.support.wearable.view.DismissOverlayView - android:id="@+id/dismiss_overlay" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - -</FrameLayout> - diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/rect_layout.xml b/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/rect_layout.xml deleted file mode 100644 index 7b0006cbe..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/rect_layout.xml +++ /dev/null @@ -1,31 +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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/rect_layout" - android:background="@drawable/rect_background" - android:onClick="onLayoutClicked"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/rect_string" - android:textColor="@color/red" - android:textSize="@dimen/text_size" - android:gravity="center" - android:layout_centerInParent="true"/> -</RelativeLayout> diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/round_layout.xml b/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/round_layout.xml deleted file mode 100644 index d7a55f6d2..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/layout/round_layout.xml +++ /dev/null @@ -1,31 +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" - android:layout_width="match_parent" - android:layout_height="match_parent" - android:id="@+id/round_layout" - android:background="@drawable/round_background" - android:onClick="onLayoutClicked"> - <TextView - android:layout_width="@dimen/round_text_view_width" - android:layout_height="wrap_content" - android:text="@string/round_string" - android:textColor="@color/red" - android:textSize="@dimen/text_size" - android:gravity="center" - android:layout_centerInParent="true"/> -</RelativeLayout> diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/dimens.xml b/samples/wearable/WatchViewStub/Wearable/src/main/res/values/dimens.xml deleted file mode 100644 index 37148a2d4..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/dimens.xml +++ /dev/null @@ -1,20 +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. ---> -<resources> - <dimen name="rect_corner_radius">20dp</dimen> - <dimen name="round_text_view_width">150dp</dimen> - <dimen name="text_size">24sp</dimen> -</resources> diff --git a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/strings.xml b/samples/wearable/WatchViewStub/Wearable/src/main/res/values/strings.xml deleted file mode 100644 index 00cc6c641..000000000 --- a/samples/wearable/WatchViewStub/Wearable/src/main/res/values/strings.xml +++ /dev/null @@ -1,23 +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. ---> - -<resources> - - <string name="app_name">WatchViewStub Sample</string> - <string name="round_string">Your screen is round!</string> - <string name="rect_string">Your screen is rectangular!</string> - -</resources> diff --git a/samples/wearable/WatchViewStub/_index.html b/samples/wearable/WatchViewStub/_index.html deleted file mode 100644 index 0e01e304e..000000000 --- a/samples/wearable/WatchViewStub/_index.html +++ /dev/null @@ -1,26 +0,0 @@ -<p><b>About:</b> This sample demonstrates how to specify different layouts for round and rectangular -screens. The layouts used in this sample are as follows: - <ul> - <li>Round: The background is a blue/green ring surrounding red text.</li> - <li>Rect: The background is a blue/breen rounded rectangle with red text on top.</li> - </ul> -Additionally, a unique animation is played when the user clicks on the layout, depending on whether -the screen is round or rectangular: - <ul> - <li>Round: The layout rotates 360 degrees.</li> - <li>Rect: The layout shrinks to 70% and then grows back to 100%.</li> - </ul> -</p> -<p><b>How to run:</b> Install the Wearable APK on the wearable, go to the voice menu (either by -saying "OK Google" or tapping the home screen) and select the "Start..." option. Then, select -"WatchViewStub Sample" from the submenu.</p> -<p><b>Wearable APIs used:</b> WatchViewStub, DismissOverlayView</p> -<p><b>Screenshots:</b> - <figure> - <img src="screenshots/watch_view_stub_round.png" alt="Round layout" width="180" - height="180"> - <img src="screenshots/watch_view_stub_rectangular.png" alt="Rectangular layout" width="140" - height="140"> - <figcaption>The layout that is inflated depends on the shape of your wearable.</figcaption> - </figure> -</p> diff --git a/samples/wearable/WatchViewStub/build.gradle b/samples/wearable/WatchViewStub/build.gradle deleted file mode 100644 index 43dbcd071..000000000 --- a/samples/wearable/WatchViewStub/build.gradle +++ /dev/null @@ -1,15 +0,0 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -allprojects { - repositories { - mavenCentral() - } -} - diff --git a/samples/wearable/WatchViewStub/gradle.properties b/samples/wearable/WatchViewStub/gradle.properties deleted file mode 100644 index 5d08ba75b..000000000 --- a/samples/wearable/WatchViewStub/gradle.properties +++ /dev/null @@ -1,18 +0,0 @@ -# Project-wide Gradle settings. - -# IDE (e.g. Android Studio) users: -# Settings specified in this file will override any Gradle settings -# configured through the IDE. - -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html - -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. -# Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true
\ No newline at end of file diff --git a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/WatchViewStub/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/WatchViewStub/gradlew b/samples/wearable/WatchViewStub/gradlew deleted file mode 100755 index 91a7e269e..000000000 --- a/samples/wearable/WatchViewStub/gradlew +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/WatchViewStub/gradlew.bat b/samples/wearable/WatchViewStub/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/WatchViewStub/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_rectangular.png b/samples/wearable/WatchViewStub/screenshots/watch_view_stub_rectangular.png Binary files differdeleted file mode 100644 index 939cb18da..000000000 --- a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_rectangular.png +++ /dev/null diff --git a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_round.png b/samples/wearable/WatchViewStub/screenshots/watch_view_stub_round.png Binary files differdeleted file mode 100644 index 3055f6d00..000000000 --- a/samples/wearable/WatchViewStub/screenshots/watch_view_stub_round.png +++ /dev/null diff --git a/samples/wearable/WatchViewStub/settings.gradle b/samples/wearable/WatchViewStub/settings.gradle deleted file mode 100644 index 1d97d30e1..000000000 --- a/samples/wearable/WatchViewStub/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -include ':Wearable' diff --git a/samples/wearable/build.gradle b/samples/wearable/build.gradle deleted file mode 100644 index 6101d4da9..000000000 --- a/samples/wearable/build.gradle +++ /dev/null @@ -1,46 +0,0 @@ -buildscript { - ext.topDir = file('../../../../../') - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' - } -} - -List<String> samples = [ - "AgendaData", - "DataLayer", - "DelayedConfirmation", - "ElizaChat", - "EmbeddedApp", - "FindMyPhone", - "Flashlight", - "Geofencing", - "GridViewPager", - "JumpingJack", - "Notifications", - "Quiz", - "RecipeAssistant", - "SkeletonWearableApp", - "SynchronizedNotifications", - "Timer", - "WatchViewStub", -] - -List<String> taskNames = [ - "clean", - "build", -] - -taskNames.each { taskName -> - def task = project.hasProperty(taskName) ? project.tasks[taskName] : project.task(taskName) - samples.each { sample -> - File sampleDir = new File(sample) - task.dependsOn project.task([type: GradleBuild], "${sample}_${taskName}", { - buildFile = "${sample}/build.gradle" - dir = sample - tasks = [taskName] - }) - } -} diff --git a/samples/wearable/gradle.properties b/samples/wearable/gradle.properties deleted file mode 100644 index 3372dc3fe..000000000 --- a/samples/wearable/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m diff --git a/samples/wearable/gradle/wrapper/gradle-wrapper.jar b/samples/wearable/gradle/wrapper/gradle-wrapper.jar Binary files differdeleted file mode 100644 index 8c0fb64a8..000000000 --- a/samples/wearable/gradle/wrapper/gradle-wrapper.jar +++ /dev/null diff --git a/samples/wearable/gradle/wrapper/gradle-wrapper.properties b/samples/wearable/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 1e61d1fd3..000000000 --- a/samples/wearable/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Wed Apr 10 15:27:10 PDT 2013 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip diff --git a/samples/wearable/gradlew b/samples/wearable/gradlew deleted file mode 100755 index d8910a5b8..000000000 --- a/samples/wearable/gradlew +++ /dev/null @@ -1,174 +0,0 @@ -#!/usr/bin/env bash - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn ( ) { - echo "$*" -} - -die ( ) { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; -esac - -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -# Change the project's .gradle to the android out dir. -ANDROID_GRADLE_ROOT="$APP_HOME/../../../out/host/gradle/tools/updater" -if [[ -z "$ANDROID_CACHE_DIR" ]]; then - ANDROID_CACHE_DIR="$ANDROID_GRADLE_ROOT/.gradle" -fi - -# Change the local user directories to be under the android out dir -export GRADLE_USER_HOME="$ANDROID_GRADLE_ROOT/.gradle" -export M2_HOME="$ANDROID_GRADLE_ROOT/.m2" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/wearable/gradlew.bat b/samples/wearable/gradlew.bat deleted file mode 100755 index aec99730b..000000000 --- a/samples/wearable/gradlew.bat +++ /dev/null @@ -1,90 +0,0 @@ -@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windowz variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/samples/wearable/settings.gradle b/samples/wearable/settings.gradle deleted file mode 100644 index e69de29bb..000000000 --- a/samples/wearable/settings.gradle +++ /dev/null diff --git a/sdk/build_tools_source.prop_template b/sdk/build_tools_source.prop_template index b83af7f4b..c9bfc2fe9 100644 --- a/sdk/build_tools_source.prop_template +++ b/sdk/build_tools_source.prop_template @@ -1,3 +1,3 @@ Pkg.UserSrc=false -Pkg.Revision=${PLATFORM_SDK_VERSION}.0.1 +Pkg.Revision=${PLATFORM_SDK_VERSION}.0.2 |
