@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.activity;
package com.vincent.wearabledemo;

import android.app.AlertDialog;
import android.content.Context;
@@ -30,16 +30,16 @@
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.wearable.PutDataMapRequest;
import com.google.android.gms.wearable.PutDataRequest;
import com.google.android.gms.wearable.Wearable;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;
import com.vincent.wearabledemo.R;
import com.vincent.wearabledemo.Utils.PolyHelper;
import com.vincent.wearabledemo.handler.JSONAddrHandler;
import com.vincent.wearabledemo.view.DrawOverlay;
import com.vincent.wearabledemo.view.SearchOverlay;

import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
@@ -55,15 +55,21 @@
import org.json.JSONObject;

import java.io.IOException;
import java.text.DecimalFormat;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

public class MapActivity extends com.google.android.maps.MapActivity implements LocationListener {

public class MapActivity extends com.google.android.maps.MapActivity implements
LocationListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener
{
private MapView mapView;
private MapController mapControl;
private GeoPoint GP;
@@ -75,13 +81,30 @@ public class MapActivity extends com.google.android.maps.MapActivity implements

private boolean enableTool;
private boolean requestGPS;
private boolean countable;

private int screenWidth;
private int screenHeight;
private double screenSize;
private EditText typingText;
private SearchOverlay searchOverlay;
private DrawOverlay drawOverlay;
private List<Map<String, String>> directionList;
private TextView debugText;

private ArrayList<Poi> pois;
private String previousPath = "";
private boolean isPathChanged;

private GoogleApiClient gac;

private static final String DATA_TEXT_KEY = "path_text";
private static final String DATA_IMG_KEY = "path_image";
private static final String DATA_PATH = "/demo";

private static final int PATH_GO_STRAIGHT = 0;
private static final int PATH_TURN_RIGHT = 1;
private static final int PATH_TURN_LEFT = 2;

@Override
protected void onCreate(Bundle savedInstanceState)
@@ -92,9 +115,16 @@ protected void onCreate(Bundle savedInstanceState)

mapView = (MapView) findViewById(R.id.MapView);
typingText = (EditText) findViewById(R.id.searchTextInput);
debugText = (TextView) findViewById(R.id.debugText);

findMapControl();
getScreenInfo();

gac = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wearable.API)
.build();
}

private void getScreenInfo()
@@ -418,7 +448,7 @@ public void routeFromSearchPoint(String searchLat, String searchLng)
else {
double lat = myLocation.getLatitude();
double lng = myLocation.getLongitude();
Log.i("MyPosition", ""+lat +" "+ lng);
Log.i("MyPosition", ""+lat +" , "+ lng);

mapMove((int)(lat * 1E6),
(int)(lng * 1E6));
@@ -512,8 +542,9 @@ protected void onPostExecute(String routeResult)

public void getDirectionInfo(String routeInJSON)
{
List<Map<String, String>> dirList = new ArrayList<>();
directionList = new ArrayList<>();
List<String> infoList = new ArrayList<>();
pois = new ArrayList<>();
try
{
JSONObject jb = new JSONObject(routeInJSON);
@@ -567,7 +598,13 @@ public void getDirectionInfo(String routeInJSON)

listItem.put("path", path);

dirList.add(listItem);
directionList.add(listItem);

String pathGoOn = "";
if (listItem.containsKey("pathGoOn"))
pathGoOn = listItem.get("pathGoOn");

putPoi(path, startLocation.getString("lat"), startLocation.getString("lng"), pathGoOn);
}
JSONObject Dis = leg.getJSONObject("distance");
JSONObject Dur = leg.getJSONObject("duration");
@@ -585,7 +622,6 @@ public void getDirectionInfo(String routeInJSON)
infoList.add(Distance); //2
infoList.add(Summary); //3

//directionList = dirList;
//pathInfoList = infoList;

//directionPop();
@@ -596,14 +632,47 @@ public void getDirectionInfo(String routeInJSON)
}
}

public void putPoi(String pathName, String lat, String lng, String pathInfo)
{
double Lat = Double.valueOf(lat);
double Lng = Double.valueOf(lng);

pois.add(new Poi(pathName, Lat, Lng, pathInfo));
countable = true;

Log.d("POI SIZE", "" + pois.size());

triggerLocationChange();
}

private void triggerLocationChange()
{
for (Poi poi : pois)
{
poi.setDistance(distance(
myLocation.getLatitude(),
myLocation.getLongitude(),
poi.LAT,
poi.LNG));
}
distanceSort(pois);
setNearestView();

Log.d("Location - Me & POI", myLocation.getLatitude()
+ ","
+ myLocation.getLongitude()
+ "\n"
+ pois.get(0).LAT + "," + pois.get(0).LNG);
}

public void mapMove(int lat, int lng)
{
GP = new GeoPoint(lat, lng);

mapControl.animateTo(GP);

if (mapView.getZoomLevel() < 17)
mapControl.setZoom(17);
if (mapView.getZoomLevel() < 18)
mapControl.setZoom(18);

/*
if (alreadyPop)
@@ -618,6 +687,87 @@ public void mapMove(int lat, int lng)
*/
}

private void distanceSort(ArrayList<Poi> poi)
{
Collections.sort(poi, new Comparator<Poi>() {
@Override
public int compare(Poi poi1, Poi poi2) {
return poi1.DISTANCE < poi2.DISTANCE ? -1 : 1;
}
});
}

public double distance(double lat1, double lng1, double lat2, double lng2)
{
double redLat1 = lat1 * Math.PI / 180;
double redLat2 = lat2 * Math.PI / 180;
double l = redLat1 - redLat2;
double p = (lng1 * Math.PI / 180) - (lng2 * Math.PI /180);

double distance = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(l/2), 2)
+ Math.cos(redLat1) * Math.cos(redLat2)
* Math.pow(Math.sin(p/2), 2)));
distance = distance * 6378137.0;
distance = Math.round(distance * 10000) / 10000;

return distance;
}

private String distanceText(double distance)
{
if (distance < 1000)
return String.valueOf((int)distance) + "m";
else
return new DecimalFormat("#.00").format(distance / 1000) + "km";
}

public void setNearestView()
{
String nearestPath = pois.get(0).PATH_NAME;

if (!nearestPath.equals(previousPath))
{
previousPath = nearestPath;
isPathChanged = true;
}
String nearestDis = distanceText(pois.get(0).DISTANCE);

debugText.setText(nearestPath + " - " + nearestDis);

if (isPathChanged && pois.get(0).DISTANCE < 100)
{
String pathText = nearestPath.substring(nearestPath.indexOf("-")+1);
int directionOf = PATH_GO_STRAIGHT;

if (pathText.contains("右轉"))
directionOf = PATH_TURN_RIGHT;
else if (pathText.contains("左轉"))
directionOf = PATH_TURN_LEFT;

sendPathUpdateToWear(pathText, directionOf);

Log.d("NEED UPDATE!!!", pathText + directionOf);

isPathChanged = false;
}
}

private void sendPathUpdateToWear(String pathText, int pathImg)
{
if (gac.isConnected())
{
PutDataMapRequest putDataMapReq = PutDataMapRequest.create(DATA_PATH);

putDataMapReq.getDataMap().putString(DATA_TEXT_KEY, pathText);
putDataMapReq.getDataMap().putInt(DATA_IMG_KEY, pathImg);

PutDataRequest putDataReq = putDataMapReq.asPutDataRequest();
Wearable.DataApi.putDataItem(gac, putDataReq);

Log.i("DataItemPut!", pathText + " - " + pathImg);
}
}

@Override
protected void onResume()
{
@@ -641,6 +791,9 @@ protected void onResume()
Log.i("onState", "Resume else");
}
toastShort("LocationProvider : " + providerType);

gac.connect();
Log.d("GAC_Status", "GAC Connected!!");
}

@Override
@@ -662,27 +815,30 @@ protected void onPause()
myLayer.disableCompass();
Log.i("onState", "Pause");
}
gac.disconnect();
Log.d("GAC_Status", "GAC Disconnected!!");
}

@Override
public void onLocationChanged(Location location)
{
Log.v("mapLocation", location.toString());
Log.v("MapLocation", location.toString());
myLocation = location;

/*
if (countable && !(""+myLocation).equals("null"))
{
for (Poi poi : pois)
{
poi.setDistance(distance(location.getLatitude(),
poi.setDistance(distance(
location.getLatitude(),
location.getLongitude(),
poi.getLatitude(),
poi.getLongitude()));
poi.LAT,
poi.LNG));
}
distanceSort(pois);
setNearestView();
}
/*
if (mapFocusMove)
{
GP = new GeoPoint((int)(location.getLatitude()*1E6), (int)(location.getLongitude()*1E6));
@@ -712,6 +868,23 @@ public void onProviderDisabled(String provider) {
toastShort("DisabledProvider : " + provider);
}


@Override
public void onConnected(Bundle bundle) {
Log.d("GAC_Status", "onConnected: " + bundle);
}

@Override
public void onConnectionSuspended(int i) {
Log.d("GAC_Status", "onDisconnected: " + i);
}

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.d("GAC_Status", "ConnectionFailed: " + connectionResult);
}


public void toastShort (String message)
{
View toastRoot = getLayoutInflater().inflate(R.layout.toast, null);
@@ -1,13 +1,11 @@
package com.vincent.wearabledemo.fragment;
package com.vincent.wearabledemo;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.vincent.wearabledemo.R;

public class MapFragment extends Fragment {

private static final String ARG_SECTION_NUMBER = "section_number";
@@ -0,0 +1,22 @@
package com.vincent.wearabledemo;

public class Poi {

public String PATH_NAME;
public double LAT;
public double LNG;
public String PATH_INFO;
public double DISTANCE;

public Poi(String pathName, double latitude, double longitude, String pathInfo)
{
PATH_NAME = pathName;
LAT = latitude;
LNG = longitude;
PATH_INFO = pathInfo;
}

public void setDistance(double distance) {
DISTANCE = distance;
}
}
@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.Utils;
package com.vincent.wearabledemo;

import com.google.android.maps.GeoPoint;

@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.view;
package com.vincent.wearabledemo;

import android.app.Activity;
import android.app.AlertDialog;
@@ -15,7 +15,7 @@
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.OverlayItem;
import com.vincent.wearabledemo.R;
import com.vincent.wearabledemo.activity.MapActivity;
import com.vincent.wearabledemo.MapActivity;

import java.util.ArrayList;
import java.util.List;
@@ -1,15 +1,11 @@
package com.vincent.wearabledemo.adapter;
package com.vincent.wearabledemo;


import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.vincent.wearabledemo.R;
import com.vincent.wearabledemo.fragment.AdvancedFeature;
import com.vincent.wearabledemo.fragment.BasicNotificationFragment;

public class SectionsPagerAdapter extends FragmentPagerAdapter
{
private Context context;

This file was deleted.

@@ -3,7 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.vincent.wearabledemo.activity.MapActivity"
tools:context="com.vincent.wearabledemo.MapActivity"
android:orientation="vertical">

<LinearLayout
@@ -2,7 +2,7 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.vincent.wearabledemo.activity.MapActivity">
tools:context="com.vincent.wearabledemo.MapActivity">

<item
android:id="@+id/action_settings"
@@ -3,32 +3,26 @@ apply plugin: 'com.android.application'
android {
signingConfigs {
BrackRelease {
keyAlias 'Brack'
keyPassword 'android'
storeFile file('C:/Users/Brack/.android/release.keystore')
storePassword 'android'
}
MapDebug {
storeFile file('C:/Users/Brack/.android/debug.keystore')
keyAlias 'androiddebugkey'
keyAlias 'brack'
keyPassword 'android'
storeFile file('C:/Users/vincent.chang/.android/release.keystore')
storePassword 'android'
}
}
compileSdkVersion 22
compileSdkVersion "Google Inc.:Google APIs:22"
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.vincent.wearabledemo"
minSdkVersion 20
targetSdkVersion 22
versionCode 1
versionName "1.0"
signingConfig signingConfigs.MapDebug
signingConfig signingConfigs.BrackRelease
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.BrackRelease
}
}
productFlavors {
@@ -1,20 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vincent.wearabledemo" >
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vincent.wearabledemo">

<uses-feature android:name="android.hardware.type.watch" />

<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>

<permission
android:name="com.vincent.wearabledemo.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.vincent.wearabledemo.permission.MAPS_RECEIVE"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="com.vincent.wearabledemo.permission.MAPS_RECEIVE" />

<application
android:allowBackup="true"
@@ -24,52 +22,51 @@
<uses-library
android:name="com.google.android.wearable"
android:required="false" />

<!--
<service
android:name= ".service.DataSyncService" >
<intent-filter>
<action android:name= "com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>

-->
<activity
android:name=".activity.WearActivity"
android:name=".WearActivity"
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=".activity.AmbientActivity"
android:name=".AmbientActivity"
android:allowEmbedded="true"
android:exported="true"
android:label="@string/title_ambient_activity"
android:taskAffinity="" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity
android:name=".activity.CardActivity"
android:name=".CardActivity"
android:label="@string/title_card_activity" >
</activity>

<activity
android:name=".activity.ListActivity"
android:name=".ListActivity"
android:label="@string/title_list_activity" >
</activity>

<activity
android:name=".activity.PickerActivity"
android:name=".PickerActivity"
android:label="@string/title_picker_activity" >
</activity>

<activity
android:name=".PathPromptActivity"
android:label="@string/title_path_prompt_activity" >
</activity>

</application>

</manifest>
@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.activity;
package com.vincent.wearabledemo;

import android.graphics.Color;
import android.os.Bundle;
@@ -9,8 +9,6 @@
import android.widget.TextView;
import android.widget.Toast;

import com.vincent.wearabledemo.R;

public class AmbientActivity extends WearableActivity {

private static final String DATA_KEY = "Brack";
@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.activity;
package com.vincent.wearabledemo;

import android.os.Bundle;
import android.support.wearable.activity.WearableActivity;
@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.service;
package com.vincent.wearabledemo;

import android.content.Intent;
import android.os.Bundle;
@@ -10,7 +10,6 @@
import com.google.android.gms.wearable.DataMap;
import com.google.android.gms.wearable.DataMapItem;
import com.google.android.gms.wearable.WearableListenerService;
import com.vincent.wearabledemo.activity.WearActivity;

public class DataSyncService extends WearableListenerService {

@@ -54,7 +53,7 @@ private void updating(int count)
testData.putString(DATA_KEY, String.valueOf(count));
intent.putExtras(testData);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
startActivity(intent);


Log.i("Update Count", "" + count);
@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.adapter;
package com.vincent.wearabledemo;


import android.app.Fragment;
@@ -9,8 +9,6 @@
import android.support.wearable.view.FragmentGridPagerAdapter;
import android.view.Gravity;

import com.vincent.wearabledemo.R;

import java.util.List;

public class GridPagerAdapter extends FragmentGridPagerAdapter {
@@ -1,14 +1,10 @@
package com.vincent.wearabledemo.activity;
package com.vincent.wearabledemo;

import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.WearableListView;
import android.util.Log;

import com.vincent.wearabledemo.R;

import com.vincent.wearabledemo.adapter.ListAdapter;

public class ListActivity extends Activity implements WearableListView.ClickListener {

String[] dataSet = {"Sample Item 01", "Sample Item 02", "Sample Item 03", "Sample Item 04", "Sample Item 05"};
@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.adapter;
package com.vincent.wearabledemo;

import android.content.Context;
import android.support.wearable.view.WearableListView;
@@ -0,0 +1,189 @@
package com.vincent.wearabledemo;

import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.Vibrator;
import android.util.Log;
import android.util.TypedValue;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

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.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.Wearable;

public class PathPromptActivity extends Activity implements
DataApi.DataListener,
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener
{
private int screenHeight;

private TextView promptText;
private ImageView promptImage;

private GoogleApiClient gac;

private static final String DATA_TEXT_KEY = "path_text";
private static final String DATA_IMG_KEY = "path_image";
private static final String DATA_PATH = "/demo";

private static final int PATH_GO_STRAIGHT = 0;
private static final int PATH_TURN_RIGHT = 1;
private static final int PATH_TURN_LEFT = 2;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.path_prompt_activity);

promptText = (TextView) findViewById(R.id.path_prompt_text);
promptImage = (ImageView) findViewById(R.id.path_prompt_image);

gac = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wearable.API)
.build();

getScreenInfo();
setTextLayout();
}

private void getScreenInfo()
{
WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
int screenWidth = wm.getDefaultDisplay().getWidth();
screenHeight = wm.getDefaultDisplay().getHeight();

Log.i("ScreenDisplay", "" + screenWidth + " x " + screenHeight);
}

private void setTextLayout()
{
int requestHeight = (int) (screenHeight * 0.28);

LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT, getPixels(requestHeight));

promptText.setLayoutParams(params);

Log.i("TextLayoutHeight", "" + promptText.getLayoutParams().height);
}

public static int getPixels(int dipValue)
{
Resources res = Resources.getSystem();
int px = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dipValue, res.getDisplayMetrics());
Log.i("Dip to Pixels~~", "" + dipValue + " to " + px);
return px;
}

@Override
public void onDataChanged(DataEventBuffer dataEventBuffer)
{
for (DataEvent event: dataEventBuffer)
{
if (event.getType() == DataEvent.TYPE_CHANGED)
{
DataItem items = event.getDataItem();

if (items.getUri().getPath().compareTo(DATA_PATH) == 0)
{
DataMap dataMap = DataMapItem.fromDataItem(items).getDataMap();
updateText(dataMap.getString(DATA_TEXT_KEY));
updateImage(dataMap.getInt(DATA_IMG_KEY));

vibrate();

Log.d("PromptUpdate!!!", dataMap.getString(DATA_TEXT_KEY) + " "
+ dataMap.getInt(DATA_IMG_KEY));
}
}
else if (event.getType() == DataEvent.TYPE_DELETED) {
Log.i("Item Deleted!", "DELETED!!!!!!!");
}
}
}

private void updateText(final String text)
{
runOnUiThread(new Runnable() {
@Override
public void run() {
promptText.setText(text);
}
});
}

private void updateImage(final int imgKey)
{
runOnUiThread(new Runnable() {
@Override
public void run() {
switch (imgKey)
{
case PATH_GO_STRAIGHT:
promptImage.setImageResource(R.mipmap.arrow_straight);
break;
case PATH_TURN_RIGHT:
promptImage.setImageResource(R.mipmap.arrow_turn_right);
break;
case PATH_TURN_LEFT:
promptImage.setImageResource(R.mipmap.arrow_turn_left);
break;
}
}
});
}

private void vibrate()
{
Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE);
long[] vibrationPattern = {0, 500, 50, 300};
//-1 - don't repeat
final int indexInPatternToRepeat = -1;
vibrator.vibrate(vibrationPattern, indexInPatternToRepeat);
}

@Override
protected void onResume() {
super.onResume();
gac.connect();
Log.d("PathGAC_Status", "GAC Connected!!");
}

@Override
protected void onPause() {
super.onPause();
Wearable.DataApi.removeListener(gac, this);
gac.disconnect();
Log.d("PathGAC_Status", "GAC Disconnected!!");
}

@Override
public void onConnected(Bundle bundle) {
Wearable.DataApi.addListener(gac, this);
Log.d("PathGAC_Status", "onConnected: " + bundle);
}

@Override
public void onConnectionSuspended(int i) {
Log.d("PathGAC_Status", "onDisconnected: " + i);
}

@Override
public void onConnectionFailed(ConnectionResult connectionResult) {
Log.d("PathGAC_Status", "ConnectionFailed: " + connectionResult);
}
}
@@ -1,13 +1,9 @@
package com.vincent.wearabledemo.activity;
package com.vincent.wearabledemo;

import android.app.Activity;
import android.os.Bundle;
import android.support.wearable.view.GridViewPager;

import com.vincent.wearabledemo.R;

import com.vincent.wearabledemo.adapter.GridPagerAdapter;

public class PickerActivity extends Activity {

@Override
@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.activity;
package com.vincent.wearabledemo;

import android.app.Activity;
import android.app.Notification;
@@ -20,7 +20,6 @@
import com.google.android.gms.wearable.DataMap;
import com.google.android.gms.wearable.DataMapItem;
import com.google.android.gms.wearable.Wearable;
import com.vincent.wearabledemo.R;

public class WearActivity extends Activity implements
DataApi.DataListener,
@@ -61,7 +60,8 @@ public void testBtnClick(View v)
//Intent intent = new Intent(this, AmbientActivity.class);
//Intent intent = new Intent(this, CardActivity.class);
//Intent intent = new Intent(this, ListActivity.class);
Intent intent = new Intent(this, PickerActivity.class);
//Intent intent = new Intent(this, PickerActivity.class);
Intent intent = new Intent(this, PathPromptActivity.class);

startActivity(intent);

@@ -1,4 +1,4 @@
package com.vincent.wearabledemo.view;
package com.vincent.wearabledemo;

import android.content.Context;
import android.graphics.drawable.GradientDrawable;
@@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
tools:context="com.vincent.wearabledemo.activity.AmbientActivity"
tools:context="com.vincent.wearabledemo.AmbientActivity"
tools:deviceIds="wear"
android:padding="10dp">

@@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/cardContainer"
tools:context="com.vincent.wearabledemo.activity.CardActivity"
tools:context="com.vincent.wearabledemo.CardActivity"
tools:deviceIds="wear">

<android.support.wearable.view.CardScrollView
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>

<com.vincent.wearabledemo.view.WearableListItemLayout
<com.vincent.wearabledemo.WearableListItemLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center_vertical"
android:layout_width="match_parent"
@@ -24,4 +24,4 @@
android:textColor="@color/green"
android:textSize="16sp"/>

</com.vincent.wearabledemo.view.WearableListItemLayout>
</com.vincent.wearabledemo.WearableListItemLayout>
@@ -7,7 +7,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listContainer"
tools:context="com.vincent.wearabledemo.activity.ListActivity"
tools:context="com.vincent.wearabledemo.ListActivity"
tools:deviceIds="wear"
android:padding="10dp"
android:background="@android:drawable/alert_light_frame">
@@ -0,0 +1,41 @@
<android.support.wearable.view.BoxInsetLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pathContainer"
tools:context="com.vincent.wearabledemo.activity.PahtPromptActivity"
tools:deviceIds="wear">

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".WearActivity"
tools:deviceIds="wear_square"
android:gravity="center">

<TextView
android:layout_width="match_parent"
android:layout_height="40dp"
android:textAppearance="@android:style/TextAppearance.Holo.Medium"
android:id="@+id/path_prompt_text"
android:background="@color/md_grey_800"
android:textColor="@color/md_white_1000"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:gravity="center" />

<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/path_prompt_image"
android:padding="20dp" />

</LinearLayout>

</android.support.wearable.view.BoxInsetLayout>

@@ -4,7 +4,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/pickerContainer"
tools:context="com.vincent.wearabledemo.activity.PickerActivity"
tools:context="com.vincent.wearabledemo.PickerActivity"
tools:deviceIds="wear"
android:padding="10dp">

@@ -10,14 +10,6 @@
tools:deviceIds="wear_square"
android:gravity="center">

<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/TestBtn"
android:src="@android:drawable/ic_dialog_info"
android:onClick="testBtnClick"
android:layout_marginBottom="10dp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -26,4 +18,12 @@
android:background="@android:color/darker_gray"
android:textColor="@android:color/primary_text_light" />

<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/TestBtn"
android:src="@android:drawable/ic_dialog_info"
android:onClick="testBtnClick"
android:layout_marginBottom="10dp" />

</LinearLayout>
@@ -1,7 +1,7 @@
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.vincent.wearabledemo.activity.ListActivity">
tools:context="com.vincent.wearabledemo.ListActivity">
<item
android:id="@+id/action_settings"
android:title="@string/action_settings"
@@ -1,7 +1,7 @@
<menu
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.vincent.wearabledemo.activity.PickerActivity">
tools:context="com.vincent.wearabledemo.PickerActivity">
<item
android:id="@+id/action_settings"
android:title="@string/action_settings"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,301 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->

<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
<color name="md_red_300">#E57373</color>
<color name="md_red_400">#EF5350</color>
<color name="md_red_500">#F44336</color>
<color name="md_red_600">#E53935</color>
<color name="md_red_700">#D32F2F</color>
<color name="md_red_800">#C62828</color>
<color name="md_red_900">#B71C1C</color>
<color name="md_red_A100">#FF8A80</color>
<color name="md_red_A200">#FF5252</color>
<color name="md_red_A400">#FF1744</color>
<color name="md_red_A700">#D50000</color>

<!-- pinks -->
<color name="md_pink_50">#FCE4EC</color>
<color name="md_pink_100">#F8BBD0</color>
<color name="md_pink_200">#F48FB1</color>
<color name="md_pink_300">#F06292</color>
<color name="md_pink_400">#EC407A</color>
<color name="md_pink_500">#E91E63</color>
<color name="md_pink_600">#D81B60</color>
<color name="md_pink_700">#C2185B</color>
<color name="md_pink_800">#AD1457</color>
<color name="md_pink_900">#880E4F</color>
<color name="md_pink_A100">#FF80AB</color>
<color name="md_pink_A200">#FF4081</color>
<color name="md_pink_A400">#F50057</color>
<color name="md_pink_A700">#C51162</color>

<!-- purples -->
<color name="md_purple_50">#F3E5F5</color>
<color name="md_purple_100">#E1BEE7</color>
<color name="md_purple_200">#CE93D8</color>
<color name="md_purple_300">#BA68C8</color>
<color name="md_purple_400">#AB47BC</color>
<color name="md_purple_500">#9C27B0</color>
<color name="md_purple_600">#8E24AA</color>
<color name="md_purple_700">#7B1FA2</color>
<color name="md_purple_800">#6A1B9A</color>
<color name="md_purple_900">#4A148C</color>
<color name="md_purple_A100">#EA80FC</color>
<color name="md_purple_A200">#E040FB</color>
<color name="md_purple_A400">#D500F9</color>
<color name="md_purple_A700">#AA00FF</color>

<!-- deep purples -->
<color name="md_deep_purple_50">#EDE7F6</color>
<color name="md_deep_purple_100">#D1C4E9</color>
<color name="md_deep_purple_200">#B39DDB</color>
<color name="md_deep_purple_300">#9575CD</color>
<color name="md_deep_purple_400">#7E57C2</color>
<color name="md_deep_purple_500">#673AB7</color>
<color name="md_deep_purple_600">#5E35B1</color>
<color name="md_deep_purple_700">#512DA8</color>
<color name="md_deep_purple_800">#4527A0</color>
<color name="md_deep_purple_900">#311B92</color>
<color name="md_deep_purple_A100">#B388FF</color>
<color name="md_deep_purple_A200">#7C4DFF</color>
<color name="md_deep_purple_A400">#651FFF</color>
<color name="md_deep_purple_A700">#6200EA</color>

<!-- indigo -->
<color name="md_indigo_50">#E8EAF6</color>
<color name="md_indigo_100">#C5CAE9</color>
<color name="md_indigo_200">#9FA8DA</color>
<color name="md_indigo_300">#7986CB</color>
<color name="md_indigo_400">#5C6BC0</color>
<color name="md_indigo_500">#3F51B5</color>
<color name="md_indigo_600">#3949AB</color>
<color name="md_indigo_700">#303F9F</color>
<color name="md_indigo_800">#283593</color>
<color name="md_indigo_900">#1A237E</color>
<color name="md_indigo_A100">#8C9EFF</color>
<color name="md_indigo_A200">#536DFE</color>
<color name="md_indigo_A400">#3D5AFE</color>
<color name="md_indigo_A700">#304FFE</color>

<!--blue-->
<color name="md_blue_50">#E3F2FD</color>
<color name="md_blue_100">#BBDEFB</color>
<color name="md_blue_200">#90CAF9</color>
<color name="md_blue_300">#64B5F6</color>
<color name="md_blue_400">#42A5F5</color>
<color name="md_blue_500">#2196F3</color>
<color name="md_blue_600">#1E88E5</color>
<color name="md_blue_700">#1976D2</color>
<color name="md_blue_800">#1565C0</color>
<color name="md_blue_900">#0D47A1</color>
<color name="md_blue_A100">#82B1FF</color>
<color name="md_blue_A200">#448AFF</color>
<color name="md_blue_A400">#2979FF</color>
<color name="md_blue_A700">#2962FF</color>

<!-- light blue-->
<color name="md_light_blue_50">#E1F5FE</color>
<color name="md_light_blue_100">#B3E5FC</color>
<color name="md_light_blue_200">#81D4fA</color>
<color name="md_light_blue_300">#4fC3F7</color>
<color name="md_light_blue_400">#29B6FC</color>
<color name="md_light_blue_500">#03A9F4</color>
<color name="md_light_blue_600">#039BE5</color>
<color name="md_light_blue_700">#0288D1</color>
<color name="md_light_blue_800">#0277BD</color>
<color name="md_light_blue_900">#01579B</color>
<color name="md_light_blue_A100">#80D8FF</color>
<color name="md_light_blue_A200">#40C4FF</color>
<color name="md_light_blue_A400">#00B0FF</color>
<color name="md_light_blue_A700">#0091EA</color>

<!-- cyan -->
<color name="md_cyan_50">#E0F7FA</color>
<color name="md_cyan_100">#B2EBF2</color>
<color name="md_cyan_200">#80DEEA</color>
<color name="md_cyan_300">#4DD0E1</color>
<color name="md_cyan_400">#26C6DA</color>
<color name="md_cyan_500">#00BCD4</color>
<color name="md_cyan_600">#00ACC1</color>
<color name="md_cyan_700">#0097A7</color>
<color name="md_cyan_800">#00838F</color>
<color name="md_cyan_900">#006064</color>
<color name="md_cyan_A100">#84FFFF</color>
<color name="md_cyan_A200">#18FFFF</color>
<color name="md_cyan_A400">#00E5FF</color>
<color name="md_cyan_A700">#00B8D4</color>

<!-- teal -->
<color name="md_teal_50">#E0F2F1</color>
<color name="md_teal_100">#B2DFDB</color>
<color name="md_teal_200">#80CBC4</color>
<color name="md_teal_300">#4DB6AC</color>
<color name="md_teal_400">#26A69A</color>
<color name="md_teal_500">#009688</color>
<color name="md_teal_600">#00897B</color>
<color name="md_teal_700">#00796B</color>
<color name="md_teal_800">#00695C</color>
<color name="md_teal_900">#004D40</color>
<color name="md_teal_A100">#A7FFEB</color>
<color name="md_teal_A200">#64FFDA</color>
<color name="md_teal_A400">#1DE9B6</color>
<color name="md_teal_A700">#00BFA5</color>

<!-- green -->
<color name="md_green_50">#E8F5E9</color>
<color name="md_green_100">#C8E6C9</color>
<color name="md_green_200">#A5D6A7</color>
<color name="md_green_300">#81C784</color>
<color name="md_green_400">#66BB6A</color>
<color name="md_green_500">#4CAF50</color>
<color name="md_green_600">#43A047</color>
<color name="md_green_700">#388E3C</color>
<color name="md_green_800">#2E7D32</color>
<color name="md_green_900">#1B5E20</color>
<color name="md_green_A100">#B9F6CA</color>
<color name="md_green_A200">#69F0AE</color>
<color name="md_green_A400">#00E676</color>
<color name="md_green_A700">#00C853</color>

<!--light green-->
<color name="md_light_green_50">#F1F8E9</color>
<color name="md_light_green_100">#DCEDC8</color>
<color name="md_light_green_200">#C5E1A5</color>
<color name="md_light_green_300">#AED581</color>
<color name="md_light_green_400">#9CCC65</color>
<color name="md_light_green_500">#8BC34A</color>
<color name="md_light_green_600">#7CB342</color>
<color name="md_light_green_700">#689F38</color>
<color name="md_light_green_800">#558B2F</color>
<color name="md_light_green_900">#33691E</color>
<color name="md_light_green_A100">#CCFF90</color>
<color name="md_light_green_A200">#B2FF59</color>
<color name="md_light_green_A400">#76FF03</color>
<color name="md_light_green_A700">#64DD17</color>

<!-- lime-->
<color name="md_lime_50">#F9FBE7</color>
<color name="md_lime_100">#F0F4C3</color>
<color name="md_lime_200">#E6EE9C</color>
<color name="md_lime_300">#DCE775</color>
<color name="md_lime_400">#D4E157</color>
<color name="md_lime_500">#CDDC39</color>
<color name="md_lime_600">#C0CA33</color>
<color name="md_lime_700">#A4B42B</color>
<color name="md_lime_800">#9E9D24</color>
<color name="md_lime_900">#827717</color>
<color name="md_lime_A100">#F4FF81</color>
<color name="md_lime_A200">#EEFF41</color>
<color name="md_lime_A400">#C6FF00</color>
<color name="md_lime_A700">#AEEA00</color>

<!--yellow -->
<color name="md_yellow_50">#FFFDE7</color>
<color name="md_yellow_100">#FFF9C4</color>
<color name="md_yellow_200">#FFF590</color>
<color name="md_yellow_300">#FFF176</color>
<color name="md_yellow_400">#FFEE58</color>
<color name="md_yellow_500">#FFEB3B</color>
<color name="md_yellow_600">#FDD835</color>
<color name="md_yellow_700">#FBC02D</color>
<color name="md_yellow_800">#F9A825</color>
<color name="md_yellow_900">#F57F17</color>
<color name="md_yellow_A100">#FFFF82</color>
<color name="md_yellow_A200">#FFFF00</color>
<color name="md_yellow_A400">#FFEA00</color>
<color name="md_yellow_A700">#FFD600</color>

<!--amber-->
<color name="md_amber_50">#FFF8E1</color>
<color name="md_amber_100">#FFECB3</color>
<color name="md_amber_200">#FFE082</color>
<color name="md_amber_300">#FFD54F</color>
<color name="md_amber_400">#FFCA28</color>
<color name="md_amber_500">#FFC107</color>
<color name="md_amber_600">#FFB300</color>
<color name="md_amber_700">#FFA000</color>
<color name="md_amber_800">#FF8F00</color>
<color name="md_amber_900">#FF6F00</color>
<color name="md_amber_A100">#FFE57F</color>
<color name="md_amber_A200">#FFD740</color>
<color name="md_amber_A400">#FFC400</color>
<color name="md_amber_A700">#FFAB00</color>

<!--orange-->
<color name="md_orange_50">#FFF3E0</color>
<color name="md_orange_100">#FFE0B2</color>
<color name="md_orange_200">#FFCC80</color>
<color name="md_orange_300">#FFB74D</color>
<color name="md_orange_400">#FFA726</color>
<color name="md_orange_500">#FF9800</color>
<color name="md_orange_600">#FB8C00</color>
<color name="md_orange_700">#F57C00</color>
<color name="md_orange_800">#EF6C00</color>
<color name="md_orange_900">#E65100</color>
<color name="md_orange_A100">#FFD180</color>
<color name="md_orange_A200">#FFAB40</color>
<color name="md_orange_A400">#FF9100</color>
<color name="md_orange_A700">#FF6D00</color>

<!--deep orange-->
<color name="md_deep_orange_50">#FBE9A7</color>
<color name="md_deep_orange_100">#FFCCBC</color>
<color name="md_deep_orange_200">#FFAB91</color>
<color name="md_deep_orange_300">#FF8A65</color>
<color name="md_deep_orange_400">#FF7043</color>
<color name="md_deep_orange_500">#FF5722</color>
<color name="md_deep_orange_600">#F4511E</color>
<color name="md_deep_orange_700">#E64A19</color>
<color name="md_deep_orange_800">#D84315</color>
<color name="md_deep_orange_900">#BF360C</color>
<color name="md_deep_orange_A100">#FF9E80</color>
<color name="md_deep_orange_A200">#FF6E40</color>
<color name="md_deep_orange_A400">#FF3D00</color>
<color name="md_deep_orange_A700">#DD2600</color>

<!--brown -->
<color name="md_brown_50">#EFEBE9</color>
<color name="md_brown_100">#D7CCC8</color>
<color name="md_brown_200">#BCAAA4</color>
<color name="md_brown_300">#A1887F</color>
<color name="md_brown_400">#8D6E63</color>
<color name="md_brown_500">#795548</color>
<color name="md_brown_600">#6D4C41</color>
<color name="md_brown_700">#5D4037</color>
<color name="md_brown_800">#4E342E</color>
<color name="md_brown_900">#3E2723</color>

<!--grey-->
<color name="md_grey_50">#FAFAFA</color>
<color name="md_grey_100">#F5F5F5</color>
<color name="md_grey_200">#EEEEEE</color>
<color name="md_grey_300">#E0E0E0</color>
<color name="md_grey_400">#BDBDBD</color>
<color name="md_grey_500">#9E9E9E</color>
<color name="md_grey_600">#757575</color>
<color name="md_grey_700">#616161</color>
<color name="md_grey_800">#424242</color>
<color name="md_grey_900">#212121</color>
<color name="md_black_1000">#000000</color>
<color name="md_white_1000">#ffffff</color>

<!--blue grey-->
<color name="md_blue_grey_50">#ECEFF1</color>
<color name="md_blue_grey_100">#CFD8DC</color>
<color name="md_blue_grey_200">#B0BBC5</color>
<color name="md_blue_grey_300">#90A4AE</color>
<color name="md_blue_grey_400">#78909C</color>
<color name="md_blue_grey_500">#607D8B</color>
<color name="md_blue_grey_600">#546E7A</color>
<color name="md_blue_grey_700">#455A64</color>
<color name="md_blue_grey_800">#37474F</color>
<color name="md_blue_grey_900">#263238</color>

</resources>
@@ -7,6 +7,7 @@
<string name="card_title">Custom Card</string>
<string name="card_text">Piece of a cake</string>
<string name="title_list_activity">ListActivity</string>
<string name="title_path_prompt_activity">PathPromptActivity</string>

<string name="action_settings">Settings</string>
<string name="title_picker_activity">PickerActivity</string>
@@ -82,14 +82,14 @@
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
</content>
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
<orderEntry type="jdk" jdkName="Android 5.1.1 Google APIs" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" name="play-services-wearable-7.5.0" level="project" />
<orderEntry type="library" exported="" name="play-services-base-7.5.0" level="project" />
<orderEntry type="library" exported="" name="recyclerview-v7-22.0.0" level="project" />
<orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" />
<orderEntry type="library" exported="" name="wearable-1.2.0" level="project" />
<orderEntry type="library" exported="" name="wearable-1.0.0" level="project" />
<orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
<orderEntry type="library" exported="" name="wearable-1.0.0" level="project" />
</component>
</module>