Skip to content

Commit

Permalink
MWHAHAHA This application now displays all of your pictures you
Browse files Browse the repository at this point in the history
currently have on glass! Sideload to try it out. (More coming soon)
  • Loading branch information
w9jds committed Dec 6, 2013
1 parent 0e78902 commit 4d1b393
Show file tree
Hide file tree
Showing 17 changed files with 68 additions and 55 deletions.
3 changes: 1 addition & 2 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
android:label="@string/app_name" >
<activity
android:name="com.w9jds.glassshare.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:label="@string/app_name" >

<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
Expand Down
5 changes: 3 additions & 2 deletions bin/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@
android:minSdkVersion="15"
android:targetSdkVersion="15" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name="com.w9jds.glassshare.MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
android:label="@string/app_name" >

<intent-filter>
<action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
Expand Down
Binary file modified bin/GlassShare.apk
Binary file not shown.
Binary file modified bin/classes.dex
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/MainActivity$csaAdapter.class
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/MainActivity.class
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/R$id.class
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/R$layout.class
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/R$menu.class
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/R$string.class
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/R$style.class
Binary file not shown.
Binary file modified bin/classes/com/w9jds/glassshare/R$xml.class
Binary file not shown.
Binary file modified bin/resources.ap_
Binary file not shown.
13 changes: 7 additions & 6 deletions gen/com/w9jds/glassshare/R.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,14 @@ public static final class drawable {
public static final int ic_world_50=0x7f02004b;
}
public static final class id {
public static final int delete_menu_item=0x7f090001;
public static final int share_menu_item=0x7f090002;
public static final int cardImage=0x7f090001;
public static final int delete_menu_item=0x7f090002;
public static final int share_menu_item=0x7f090003;
public static final int testImage=0x7f090000;
}
public static final class layout {
public static final int activity_main=0x7f030000;
public static final int card_layout=0x7f030001;
}
public static final class menu {
public static final int main=0x7f080000;
Expand All @@ -116,8 +118,7 @@ public static final class string {
public static final int share=0x7f060002;
}
public static final class style {
/** <style name="CustomTheme" parent="@android:style/Theme.DeviceDefault"/>
/**
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
Expand All @@ -129,8 +130,8 @@ public static final class style {
API 14 theme customizations can go here.
*/
public static final int AppBaseTheme=0x7f070000;
public static final int AppTheme=0x7f070001;
public static final int AppBaseTheme=0x7f070001;
public static final int CustomTheme=0x7f070000;
}
public static final class xml {
public static final int my_voice_trigger=0x7f040000;
Expand Down
14 changes: 14 additions & 0 deletions res/layout/card_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ImageView
android:id="@+id/cardImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>


</LinearLayout>
6 changes: 3 additions & 3 deletions res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<!-- <style name="CustomTheme" parent="@android:style/Theme.DeviceDefault"/> -->
<style name="CustomTheme" parent="@android:style/Theme.DeviceDefault"/>

<style name="AppBaseTheme" parent="android:Theme"/>
<style name="AppTheme" parent="AppBaseTheme"/>
<!-- <style name="AppBaseTheme" parent="android:Theme"/>
<style name="AppTheme" parent="AppBaseTheme"/> -->

</resources>
82 changes: 40 additions & 42 deletions src/com/w9jds/glassshare/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,74 +1,48 @@
package com.w9jds.glassshare;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.ArrayList;
import java.util.Locale;

import com.google.android.glass.app.Card;
import com.google.android.glass.timeline.LiveCard;
import com.google.android.glass.widget.CardScrollAdapter;
import com.google.android.glass.widget.CardScrollView;

import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.provider.MediaStore.Images;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

@SuppressLint("DefaultLocale")
public class MainActivity extends Activity
{

public static final String CAMERA_IMAGE_BUCKET_NAME = Environment.getExternalStorageDirectory().toString() + "/DCIM/Camera";
public static final String CAMERA_IMAGE_BUCKET_ID = getBucketId(CAMERA_IMAGE_BUCKET_NAME);

private ArrayList<Card> mlcCards = new ArrayList<Card>();
private ArrayList<String> mlsPaths = new ArrayList<String>();

@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

ImageView testView = (ImageView) findViewById(R.id.testImage);


mlsPaths = getCameraImages(this);

testView.setImageBitmap(Bitmap.createScaledBitmap(BitmapFactory.decodeFile(mlsPaths.get(0)), 640, 470, true));

// for (int i = 0; i < mlsPaths.size(); i++)
// {
// Bitmap bImg = Bitmap.createScaledBitmap(BitmapFactory.decodeFile(mlsPaths.get(i)), 640, 470, true);
// Card newCard = new Card(this);
// newCard.setFullScreenImages(true);
// newCard.addImage(getImageUri(this, bImg));
// mlcCards.add(newCard);
// }

// CardScrollView csvCardsView = new CardScrollView(this);
// csaAdapter cvAdapter = new csaAdapter();
// csvCardsView.setAdapter(cvAdapter);
// csvCardsView.activate();
// setContentView(csvCardsView);
CardScrollView csvCardsView = new CardScrollView(this);
csaAdapter cvAdapter = new csaAdapter(this);
csvCardsView.setAdapter(cvAdapter);
csvCardsView.activate();
setContentView(csvCardsView);
}

// public Uri getImageUri(Context cContext, Bitmap bImage)
// {
// String path = Images.Media.insertImage(cContext.getContentResolver(), bImage, null, null);
// return Uri.parse(path);
// }

public static String getBucketId(String path)
{
return String.valueOf(path.toLowerCase().hashCode());
Expand Down Expand Up @@ -118,8 +92,26 @@ public boolean onOptionsItemSelected(android.view.MenuItem item)
}
};

// private class ClickListener implements OnItemClickListener
// {
// @Override
// public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3)
// {
// // TODO Auto-generated method stub
// openOptionsMenu();
//
// }
// }

private class csaAdapter extends CardScrollAdapter
{
{
private Context mcContext;

public csaAdapter(Context cContext)
{
mcContext = cContext;
}

@Override
public int findIdPosition(Object id)
{
Expand All @@ -129,26 +121,32 @@ public int findIdPosition(Object id)
@Override
public int findItemPosition(Object item)
{
return mlcCards.indexOf(item);
return mlsPaths.indexOf(item);
}

@Override
public int getCount()
{
return mlcCards.size();
return mlsPaths.size();
}

@Override
public Object getItem(int position)
{
return mlcCards.get(position);
return mlsPaths.get(position);
}

@Override
public View getView(int position, View convertView, ViewGroup parent)
{
return mlcCards.get(position).toView();
LayoutInflater inflater = (LayoutInflater) mcContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View vCard = inflater.inflate(R.layout.card_layout, parent, false);

ImageView ivPic = (ImageView) vCard.findViewById(R.id.cardImage);
ivPic.setImageBitmap(Bitmap.createScaledBitmap(BitmapFactory.decodeFile(mlsPaths.get(position)), 640, 470, true));

return vCard;
}
}
}

}

0 comments on commit 4d1b393

Please sign in to comment.