WIP - Issue #116 - OBA Google Glass GDK #219

Open
wants to merge 42 commits into
from

Projects

None yet

2 participants

@barbeau
Member
barbeau commented Feb 24, 2015

This is somewhat dated now (most recent work mid-2014), but I wanted to open this as a WIP so it doesn't get lost, and is more visible if someone else wants to contribute to the Glass work.

Options to install an alpha version (this PR contents):

  1. Download the current APK here, and follow these directions to install it on Glass, or...
  2. If you have the Android dev environment setup w/ GDK installed - run gradlew installDebug from root of project using command-line

OBA Glassware is activated by using voice commands "ok glass", then "show me transit times".

show_me_transit_times

It will figure out your region (Puget Sound, Tampa, Atlanta, Washington DC, or York Canada):
finding_your_transit_services

...find the closest bus stop to your real-time location, and then show you the arrival times for that stop:
arrivals_uatc6-arrow

Times are refreshed every minute until you dismiss the Activity by swiping down. You can scroll up/down the list of arrival times by tilting your head up and down. You can pause/resume scrolling the list by long pressing with two fingers on the touch pad. Tapping with two fingers will automatically scroll to the top of the list. The arrow points towards your stop from your current position and orientation (so in the example above, you'd turn to your right a little over 90 degrees to face your stop).

Long-term goal is to get the GDK version of OBA Android merged back into the main project, hopefully using Gradle build flavors and/or project modules (see also work related to Wear in #181). Main differences between the main OBA app project and this PR is that Glass does not support the Google APIs add-on (including maps and GeoPoint object) or Google Play Services, and apparently has poor support for Fragments (hence use of a ListActivity instead of ListFragment). Most of the internal infrastructure for API calls and various utilities are the same, though, and could be shared between projects.

I'd like to get feedback from others for what features they'd like to see, so please let me know what features you think would be useful.

See #116 for more details.

barbeau added some commits Mar 13, 2014
@barbeau barbeau Initial progress towards Glass demo. 98421d4
@barbeau barbeau Add GDK library required for building in Android Studio. 13cce8f
@barbeau barbeau Setup of arrivals lists for display on Glass - I think showing this m…
…odified Activity should work.
04afa4d
@barbeau barbeau Build buildTools version to match main project. 45ac2fe
@barbeau barbeau Working Glassware! Will show the arrival list of the stop closest to …
…your real-time location. Changed to use ListActivity instead of Fragments, as Fragments don't seem to be well-supported in current GDK. Still need to working on styles.
db0fdc3
@barbeau barbeau Fixed card layout, added stop name and icon to card. Changed stops re…
…quest to execute before regions task finishes, if a region already exists. Added abbreviaton for Downtown.
14a4567
@barbeau barbeau Add icon and label for Activity, added "immersive=true" per immersion… cce25db
@barbeau barbeau Changed style of selected list item to the OneBusAway green, refactor…
…ed Glass styles to have prefix of "Glass".
ccf6e19
@barbeau barbeau Enable experimental regions by default. a64cbb4
@barbeau barbeau Refactor some of location logic into service, which can now pass a gi…
…ven location to the tasks (helps with spoofing location for testing).
87a54ad
@barbeau barbeau Change to a darker green (holo green dark) for the list selection col…
…or, since it provides better contrast.
71bbf77
@barbeau barbeau Add a progress bar in the GlassArrivalListActivity. Next step is to r…
…efactor existing logic in the Service into this Activity, so we no longer need the Service.
dc29f9c
@barbeau barbeau Consolidate to using just the ListActivity (i.e., remove the Service)…
…, since the service isn't needed. Add progress messages. Loading arrival times is really slow, need to examine why.
a599757
@barbeau barbeau Initialize LoaderManager in OnCreate() to try and speed things up. On…
…ly show bus icon after arrival times are obtained.
bfc9915
@barbeau barbeau Fix bug where regions were always loaded from the server. 11da6dc
@barbeau barbeau Trigger immediate refresh of dataset when we initialize the loader. ab3aa13
@barbeau barbeau Added development permission, which is now required with the XE16 upd…
…ate when a non-production voice trigger is used.
a9340f7
@barbeau barbeau Update to the latest GDK version based on Kitkat (API 19), including …
…new build tools version.
c486b6a
@barbeau barbeau Add the android:required=false attribute for maps to the manifest. Th…
…is is required for the app to install on XE16 (a change from behavior on XE12). See http://stackoverflow.com/questions/23135957/failure-install-failed-missing-shared-library-on-glass-xe16-kitkat/
58ecbfa
@barbeau barbeau Add LocationListener if getLastKnownLocation() returns null (which se…
…ems to happen often on XE16).
a42c693
@barbeau barbeau Remove gdk.jar file, since this is no longer needed for the project t…
…o build in Android Studio 0.5.5.
ac4b41c
@barbeau barbeau Remove sample glass card, since its not being used. d72215e
@barbeau barbeau Add message for no arrivals in the next X minutes. 820a98b
@barbeau barbeau Per the Glassware Review Team, change voice command to "show me trans…
…it times", since this will be the official transit info voice command.
36ca3fe
@barbeau barbeau Fix #1 - implement sensor-based scrolling for the ListView as a worka…
…round to broken swipe-based scrolling in XE16.X.
5164eda
@barbeau barbeau Change the Card layout to bring it in line with recommendations discu…
…ssed in https://developers.google.com/glass/develop/gdk/ui-widgets#main_layout, including more padding on the edges of cards.  Make the text slightly smaller to fit in new layout dimensions, and truncate route direction so it doesn't run into the arrival time.
b5bec58
@barbeau barbeau Add better error handling with user-facing messages when something go…
…es wrong accessing the REST APIs.
0204374
@barbeau barbeau Initial work on arrow that will point towards the selected stop. a1edf32
@barbeau barbeau Change to fixed size of arrow view. 0148e8f
@barbeau barbeau Working arrow that points to north, refactor sensor code for list vie…
…w and arrow into its own centralized OrientationManager. TODO - point arrow to nearest stop location, update distance text.
428d5c3
@barbeau barbeau Refactor OrientationManager from Singleton into normal class that's i…
…nstantiated from ArrivalsListActivity, since otherwise its awkward to start/stop updates for onResume and onPause.
8e61f3f
@barbeau barbeau Refactor helper class name for orientation, so its not confused with …
…the system classes.
04e9d69
@barbeau barbeau Working distance measure, using LocationHelper to get ongoing best lo…
…cation and update other listeners. Revert accidental changes to UIHelp. TODO - point arrow to nearby stop.
a837768
@barbeau barbeau First attempt at working arrow pointing to closest bus stop. Add magn…
…etic correction for compass.
32eda9e
@barbeau barbeau Increase margin above card footer that contains stop name. 63f9dc6
@barbeau barbeau Add fading edges to ListView to more closely match "ok, glass" list a…
…ppearance.
e149f16
@barbeau barbeau Add mod function to make sure heading stays between 0-360 when calcul…
…ating heading differences with magnetic declination and bearing to stop. Force compass redraw when new location is calculated.
a5f0098
@barbeau barbeau Replace code with pre-existing method. 5de5c34
@barbeau barbeau Move distance and arrow so they are bottom-aligned with stop name and…
… bus icon.
8bddf74
@barbeau barbeau Add space between distance and miles abbreviation. 5da9f29
@cagryInside cagryInside and 1 other commented on an outdated diff Feb 25, 2015
glass-progress-bar/build.gradle
@@ -0,0 +1,40 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.9.+'
@barbeau
barbeau Feb 25, 2015 Member

@cagryInside Yes, this (and the Gradle wrapper) likely need to be updated before this will build in the most recent version of Android Studio.

@barbeau
barbeau Feb 25, 2015 Member

I'll push an update for this shortly.

@cagryInside cagryInside and 1 other commented on an outdated diff Feb 25, 2015
...ersecond/seattlebusbot/GlassArrivalsListActivity.java
+ getClosestStops(mLastKnownLocation);
+ }
+ }
+
+ // For StopsForLocation Request
+ @Override
+ public void onTaskFinished(ObaStopsForLocationResponse response) {
+ if (response.getCode() != ObaApi.OBA_OK) {
+ showErrorMessage(getString(UIHelp.getStopErrorString(this, response.getCode())));
+ return;
+ }
+
+ Log.d(TAG, "Found stops.");
+ // Find closest stop
+ ObaStop closestStop;
+ closestStop = UIHelp.getClosestStop(this, response.getStops(), mLastKnownLocation);
@cagryInside
cagryInside Feb 25, 2015 Contributor

@barbeau I would use these together:

ObaStop closestStop = UIHelp.getClosestStop(this, response.getStops(), mLastKnownLocation);
@barbeau
barbeau Feb 25, 2015 Member

Agreed! Code in this PR isn't my best work :). It's more of a shortest path to get something working on Glass.

@barbeau
Member
barbeau commented Feb 25, 2015

Thanks for the feedback @cagryInside, just pushed a few commits to fix those items.

@luqmaan luqmaan referenced this pull request in luqmaan/awesome-transit Aug 14, 2015
Merged

Update OBA native app links #11

@barbeau barbeau added this to the Future milestone Dec 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment