Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 42 commits into from
Closed
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
98421d4
Initial progress towards Glass demo.
barbeau Mar 13, 2014
13cce8f
Add GDK library required for building in Android Studio.
barbeau Mar 28, 2014
04afa4d
Setup of arrivals lists for display on Glass - I think showing this m…
barbeau Mar 28, 2014
45ac2fe
Build buildTools version to match main project.
barbeau Apr 4, 2014
db0fdc3
Working Glassware! Will show the arrival list of the stop closest to…
barbeau Apr 9, 2014
14a4567
Fixed card layout, added stop name and icon to card. Changed stops r…
barbeau Apr 10, 2014
cce25db
Add icon and label for Activity, added "immersive=true" per immersion…
barbeau Apr 10, 2014
ccf6e19
Changed style of selected list item to the OneBusAway green, refactor…
barbeau Apr 10, 2014
a64cbb4
Enable experimental regions by default.
barbeau Apr 10, 2014
87a54ad
Refactor some of location logic into service, which can now pass a gi…
barbeau Apr 11, 2014
71bbf77
Change to a darker green (holo green dark) for the list selection col…
barbeau Apr 11, 2014
dc29f9c
Add a progress bar in the GlassArrivalListActivity. Next step is to …
barbeau Apr 11, 2014
a599757
Consolidate to using just the ListActivity (i.e., remove the Service)…
barbeau Apr 15, 2014
bfc9915
Initialize LoaderManager in OnCreate() to try and speed things up. O…
barbeau Apr 15, 2014
11da6dc
Fix bug where regions were always loaded from the server.
barbeau Apr 15, 2014
ab3aa13
Trigger immediate refresh of dataset when we initialize the loader.
barbeau Apr 15, 2014
a9340f7
Added development permission, which is now required with the XE16 upd…
barbeau Apr 16, 2014
c486b6a
Update to the latest GDK version based on Kitkat (API 19), including …
barbeau Apr 16, 2014
58ecbfa
Add the android:required=false attribute for maps to the manifest. T…
barbeau Apr 18, 2014
a42c693
Add LocationListener if getLastKnownLocation() returns null (which se…
barbeau Apr 18, 2014
ac4b41c
Remove gdk.jar file, since this is no longer needed for the project t…
barbeau Apr 18, 2014
d72215e
Remove sample glass card, since its not being used.
barbeau Apr 18, 2014
820a98b
Add message for no arrivals in the next X minutes.
barbeau Apr 18, 2014
36ca3fe
Per the Glassware Review Team, change voice command to "show me trans…
barbeau Apr 18, 2014
5164eda
Fix https://github.com/CUTR-at-USF/onebusaway-android/issues/1 - impl…
barbeau Apr 25, 2014
b5bec58
Change the Card layout to bring it in line with recommendations discu…
barbeau Apr 25, 2014
0204374
Add better error handling with user-facing messages when something go…
barbeau Apr 26, 2014
a1edf32
Initial work on arrow that will point towards the selected stop.
barbeau Apr 26, 2014
0148e8f
Change to fixed size of arrow view.
barbeau Apr 26, 2014
428d5c3
Working arrow that points to north, refactor sensor code for list vie…
barbeau Apr 28, 2014
8e61f3f
Refactor OrientationManager from Singleton into normal class that's i…
barbeau Apr 28, 2014
04e9d69
Refactor helper class name for orientation, so its not confused with …
barbeau Apr 28, 2014
a837768
Working distance measure, using LocationHelper to get ongoing best lo…
barbeau Apr 28, 2014
32eda9e
First attempt at working arrow pointing to closest bus stop. Add mag…
barbeau Apr 28, 2014
63f9dc6
Increase margin above card footer that contains stop name.
barbeau Apr 29, 2014
e149f16
Add fading edges to ListView to more closely match "ok, glass" list a…
barbeau Apr 29, 2014
a5f0098
Add mod function to make sure heading stays between 0-360 when calcul…
barbeau May 2, 2014
5de5c34
Replace code with pre-existing method.
barbeau May 3, 2014
8bddf74
Move distance and arrow so they are bottom-aligned with stop name and…
barbeau May 5, 2014
5da9f29
Add space between distance and miles abbreviation.
barbeau May 5, 2014
916c241
Update Gradle, Android Gradle Plugin, and buildToolsVersion to work w…
barbeau Feb 25, 2015
c3c8848
Code cleanup
barbeau Feb 25, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions glass-progress-bar/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build
/secure.properties
/gradle.properties
11 changes: 11 additions & 0 deletions glass-progress-bar/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.andrusiv.google.glass.progressbar"
android:versionCode="1"
android:versionName="1.0">

<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="15"/>

</manifest>
93 changes: 93 additions & 0 deletions glass-progress-bar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Google Glass Progress Bar

As of now, Google Glass GDK API has no Progress Bar view.
So I extracted this from GlassHome.apk (from https://github.com/zhuowei/Xenologer).

Progress & indeterminate slider:

<p align="center">
<img src="http://i.imgur.com/5KsQKDs.gif">
</p>

Message dialog with success sound:

<p align="center">
<img src="http://i.imgur.com/Ns1VP5O.gif">
</p>


## Features

1. __Progress bar__, which is used by all native apps.
2. Supports default progress.
3. Supports indeterminate progress.
4. Supports __MessageDialog with success sound__ found in Glass apps.


## Setup


1. Add this library project to your project.
2. (optional) override progress bar height in your own `res/values/dimens.xml` --> `<dimen name="slider_bar_height">12.0px</dimen>`
3. (optional) override message dialog background dimming in `res/values/dimens.xml` --> `<item type="dimen" name="background_dim_amount">0.75</item>`

## Use it!
### For progress bar
1. Add progress bar view to your layout:
```xml
<com.google.glass.widget.SliderView
android:id="@+id/indeterm_slider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" />
```

2. Start it from activity:
```java
mIndeterm.startIndeterminate();
mProgress.startProgress(10 * 1000); // progress which lasts 10 seconds
```


### For Message Dialog
1. Use it in code:

```java
MessageDialog localDialog = new MessageDialog.Builder(ctx)
.setTemporaryIcon(R.drawable.ic_sync_50)
.setTemporaryMessage(R.string.dlg_temp_message)
.setTemporarySecondaryMessage(R.string.dlg_temp_secondary_message)
.setIcon(R.drawable.ic_done_50)
.setMessage(R.string.dlg_message)
.setSecondaryMessage(R.string.dlg_secondary_message)
.setDismissable(true)
.setAutoHide(true)
.setListener(new MessageDialog.SimpleListener() {
public boolean onConfirmed() {
Log.d(TAG, "onConfirm");
Toast.makeText(ctx, "onConfirmed", Toast.LENGTH_LONG).show();
return true;
}
public void onDismissed() {
Log.d(TAG, "onDismissed");
Toast.makeText(ctx, "onDismissed", Toast.LENGTH_LONG).show();
}
public void onDone() {
Log.d(TAG, "onDone");
Toast.makeText(ctx, "onDone", Toast.LENGTH_LONG).show();
}
}).build();
localDialog.show();
```

## Example

Look in `testwithlibrary` folder.

## Disclaimer

Google Glass is in Explorer Stage. That's why I tried to find the answer to this SO question http://stackoverflow.com/questions/20237873/google-glass-gdk-progress-indicator and a workaround for this issue https://code.google.com/p/google-glass-api/issues/detail?id=271

This is just for educational purposes and should not be used in any production apps until Google releases something similar officially.

I hope, Google will publish a set of Google Glass Views in the future releases of GDK. We really need them! Especially that awesome progress bar!
40 changes: 40 additions & 0 deletions glass-progress-bar/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll push an update for this shortly.

}
}

apply plugin: 'android-library'

android {
compileSdkVersion "Google Inc.:Glass Development Kit Preview:19"
buildToolsVersion "19.0.3"

defaultConfig {
minSdkVersion 15
targetSdkVersion 15
versionCode 1
versionName "1.0"
}

sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'

// this configuration allow use to support eclipse structured projects
// all these can support multiple dirs such as res2
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}

dependencies {
}
14 changes: 14 additions & 0 deletions glass-progress-bar/res/anim/hide_contextual.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/activity_animation_duration_ms"
android:shareInterpolator="@android:anim/decelerate_interpolator">

<alpha
android:fromAlpha="1.0"
android:toAlpha="0.0"/>

<translate
android:fromYDelta="0.0%p"
android:toYDelta="50.0%p"/>

</set>
14 changes: 14 additions & 0 deletions glass-progress-bar/res/anim/show_contextual.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@integer/activity_animation_duration_ms"
android:shareInterpolator="@android:anim/accelerate_interpolator">

<alpha
android:fromAlpha="0.0"
android:toAlpha="1.0"/>

<translate
android:fromYDelta="50.0%p"
android:toYDelta="0.0%p"/>

</set>
Binary file added glass-progress-bar/res/drawable/bar_candy0001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0002.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0003.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0004.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0005.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0006.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0007.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0008.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0009.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0010.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0011.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0012.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0013.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0014.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0015.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0016.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0017.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0018.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0019.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0020.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0021.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0022.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0023.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0024.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0025.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added glass-progress-bar/res/drawable/bar_candy0026.png
Binary file added glass-progress-bar/res/drawable/bar_candy0027.png
Binary file added glass-progress-bar/res/drawable/bar_candy0028.png
Binary file added glass-progress-bar/res/drawable/bar_candy0029.png
Binary file added glass-progress-bar/res/drawable/bar_candy0030.png
95 changes: 95 additions & 0 deletions glass-progress-bar/res/drawable/slider_indeterminate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<animation-list
android:oneshot="false"
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:duration="33"
android:drawable="@drawable/bar_candy0001"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0002"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0003"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0004"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0005"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0006"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0007"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0008"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0009"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0010"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0011"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0012"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0013"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0014"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0015"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0016"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0017"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0018"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0019"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0020"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0021"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0022"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0023"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0024"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0025"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0026"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0027"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0028"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0029"/>
<item
android:duration="33"
android:drawable="@drawable/bar_candy0030"/>
</animation-list>
54 changes: 54 additions & 0 deletions glass-progress-bar/res/layout/message_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ms_dialog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center">

<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="70.0px"
android:layout_marginRight="10.0px"
android:adjustViewBounds="true"
android:maxWidth="124.0px"
android:minWidth="70.0px"/>

<TextView
android:id="@+id/label"
style="@style/LargeOverlayText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"/>
</LinearLayout>

<TextView
android:id="@+id/secondary_label"
style="@style/SmallOverlayText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="40.0px"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:singleLine="true"
android:visibility="gone"/>

<com.google.glass.widget.SliderView
android:id="@+id/slider"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:visibility="gone"/>

</RelativeLayout>
35 changes: 35 additions & 0 deletions glass-progress-bar/res/layout/message_dialog_expanded.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ms_dialog"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="30.0px">

<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"/>

<TextView
android:id="@+id/label"
style="@style/MediumOverlayText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"/>

<TextView
android:id="@+id/secondary_label"
style="@style/SmallOverlayText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:singleLine="true"/>

</LinearLayout>
18 changes: 18 additions & 0 deletions glass-progress-bar/res/layout/slider.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="@dimen/slider_bar_height">

<View
android:id="@id/slider_control"
android:layout_width="0.0px"
android:layout_height="@dimen/slider_bar_height"
android:background="@android:color/white"/>

<ImageView
android:id="@id/indeterminate_slider"
android:layout_width="fill_parent"
android:layout_height="@dimen/slider_bar_height"
android:background="@drawable/slider_indeterminate"/>

</FrameLayout>
Binary file added glass-progress-bar/res/raw/sound_dismiss.ogg
Binary file not shown.
Binary file added glass-progress-bar/res/raw/sound_error.ogg
Binary file not shown.
Binary file added glass-progress-bar/res/raw/sound_success.ogg
Binary file not shown.
Loading