Skip to content

Commit

Permalink
Google Drive should work (once Glass has Google Play Services)
Browse files Browse the repository at this point in the history
  • Loading branch information
w9jds committed Dec 8, 2013
1 parent 4965313 commit 7033682
Show file tree
Hide file tree
Showing 19 changed files with 143 additions and 143 deletions.
9 changes: 9 additions & 0 deletions .idea/libraries/google_play_services.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

228 changes: 107 additions & 121 deletions .idea/workspace.xml

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.w9jds.glassshare"
android:versionCode="3"
android:versionName="0.3-alpha" >
android:versionCode="4"
android:versionName="0.4-alpha" >

<uses-sdk
android:minSdkVersion="15"
Expand All @@ -17,15 +17,19 @@
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="com.w9jds.glassshare.MainActivity"
android:label="@string/app_name" >


<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data

<meta-data
android:name="com.google.android.glass.VoiceTrigger"
android:resource="@xml/my_voice_trigger" />

Expand Down
1 change: 1 addition & 0 deletions GlassShare.iml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<orderEntry type="library" exported="" name="google-http-client-gson-1.17.0-rc" level="project" />
<orderEntry type="library" exported="" name="google-oauth-client-1.17.0-rc" level="project" />
<orderEntry type="library" exported="" name="google-api-services-drive-v2-rev108-1.17.0-rc" level="project" />
<orderEntry type="library" exported="" name="google-play-services" level="project" />
</component>
</module>

Binary file modified out/production/GlassShare/GlassShare.apk
Binary file not shown.
Binary file modified out/production/GlassShare/GlassShare.unaligned.apk
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified out/production/GlassShare/com/w9jds/glassshare/R$id.class
Binary file not shown.
Binary file not shown.
Binary file modified out/production/GlassShare/com/w9jds/glassshare/R$layout.class
Binary file not shown.
Binary file modified out/production/GlassShare/com/w9jds/glassshare/R$menu.class
Binary file not shown.
Binary file modified out/production/GlassShare/com/w9jds/glassshare/R$string.class
Binary file not shown.
Binary file modified out/production/GlassShare/com/w9jds/glassshare/R$style.class
Binary file not shown.
Binary file modified out/production/GlassShare/com/w9jds/glassshare/R$xml.class
Binary file not shown.
Binary file modified out/production/GlassShare/com/w9jds/glassshare/R.class
Binary file not shown.
2 changes: 2 additions & 0 deletions res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<string name="delete">Delete</string>
<string name="share">Share</string>
<string name="upload">Save to Drive</string>

<integer name="google_play_services_version">4030500</integer>

<string name="glass_voice_trigger">Pictures</string>

Expand Down
34 changes: 16 additions & 18 deletions src/com/w9jds/glassshare/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.w9jds.glassshare;

import java.io.File;
//import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -9,13 +9,13 @@
import android.util.Log;
import com.google.android.glass.widget.CardScrollView;
import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.googleapis.extensions.android.accounts.GoogleAccountManager;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.http.FileContent;
import com.google.api.client.json.gson.GsonFactory;
import com.google.api.services.drive.Drive;
import com.google.api.services.drive.DriveScopes;
import com.google.api.services.drive.model.File;
import com.w9jds.glassshare.Adapters.csaAdapter;

import android.net.Uri;
Expand Down Expand Up @@ -150,7 +150,7 @@ public boolean onOptionsItemSelected(android.view.MenuItem item)
{
case R.id.delete_menu_item:
//pull the file from the path of the selected item
File fPic = new File(mlsPaths.get(iPosition));
java.io.File fPic = new java.io.File(mlsPaths.get(iPosition));
//delete the image
fPic.delete();
//refresh the folder
Expand Down Expand Up @@ -190,27 +190,24 @@ private void saveFileToDrive(String sPath)
{
final String msPath = sPath;

// Thread t = new Thread(new Runnable()
// {
// @Override
// public void run() {
Thread t = new Thread(new Runnable()
{
@Override
public void run() {
try
{
// File's binary content
File fContent = new File(msPath);
FileContent mediaContent = new FileContent("image/jpeg", fContent);
java.io.File fImage = new java.io.File(msPath);
FileContent fcContent = new FileContent("image/jpeg", fImage);

// File's metadata.
com.google.api.services.drive.model.File gdfBody = new com.google.api.services.drive.model.File();
gdfBody.setTitle(fContent.getName());
File gdfBody = new File();
gdfBody.setTitle(fImage.getName());
gdfBody.setMimeType("image/jpeg");

com.google.api.services.drive.model.File gdfFile = mdService.files().insert(gdfBody, mediaContent).execute();
com.google.api.services.drive.model.File gdfFile = mdService.files().insert(gdfBody, fcContent).execute();
if (gdfFile != null)
{
Log.d("GlassShareUploadTask", "Uploaded");
// showToast("Photo uploaded: " + file.getTitle());
}
}
catch (UserRecoverableAuthIOException e)
{
Expand All @@ -226,9 +223,10 @@ private void saveFileToDrive(String sPath)
{
Log.d("GlassShareUploadTask", e.toString());
}
// }
// });
// t.start();
}
});
t.start();

}

private Drive getDriveService(GoogleAccountCredential credential)
Expand Down

0 comments on commit 7033682

Please sign in to comment.