Skip to content

Commit

Permalink
Release v0.5.2
Browse files Browse the repository at this point in the history
- Changed anti banding to auto from 60hz
- Can now use White Balance and Scenes together
- White Balance and Scenes are automatically reapplied after taking a
picture
- Swiping down in the settings now return to camera instead of closing
app
- White Balance and Scenes are applied much faster (down to .2 seconds
from 1 second)
  • Loading branch information
w9jds committed Apr 17, 2014
1 parent ae8bc6f commit 6eccfe2
Show file tree
Hide file tree
Showing 32 changed files with 296 additions and 605 deletions.
3 changes: 3 additions & 0 deletions .idea/dictionaries/w9jds.xml

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

705 changes: 184 additions & 521 deletions .idea/workspace.xml

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.w9jds.gallery4glass"
android:versionCode="20"
android:versionName="0.5.1-beta">
android:versionCode="21"
android:versionName="0.5.2-beta">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Expand All @@ -25,6 +25,9 @@
android:allowBackup="true"
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.gallery4glass.MainActivity"
android:immersive="true"
Expand Down Expand Up @@ -73,7 +76,7 @@

</activity>

<!--<activity android:name=".Services.LiveCardService"/>-->
<service android:name=".Services.LiveCardService"/>

</application>

Expand Down
Binary file modified Gallery4Glass.apk
Binary file not shown.
Binary file modified out/production/Gallery4Glass/Gallery4Glass.apk
Binary file not shown.
Binary file modified out/production/Gallery4Glass/Gallery4Glass.unaligned.apk
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
157 changes: 87 additions & 70 deletions src/com/w9jds/gallery4glass/CameraActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.FileObserver;
import android.os.Handler;
import android.provider.MediaStore;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
Expand All @@ -22,6 +24,7 @@

import com.google.analytics.tracking.android.EasyTracker;
import com.google.analytics.tracking.android.MapBuilder;
import com.google.android.glass.media.CameraManager;
import com.google.android.glass.media.Sounds;
import com.google.android.glass.touchpad.Gesture;
import com.google.android.glass.touchpad.GestureDetector;
Expand All @@ -46,18 +49,18 @@ public class CameraActivity extends Activity implements CameraBridgeViewBase.CvC
{
public static final String ACTION_WINK = "com.google.glass.action.EYE_GESTURE";


public static String msColorEffect = Camera.Parameters.EFFECT_NONE;
private boolean inSettings = false;
private Camera.Parameters mcpParams;
//create an adapter for the cardscrollviewer
private csaAdapter mcvAdapter;
// Declare a new Gesture Detector
private GestureDetector mGestureDetector;
private GestureDetector mCameraGestureDetector;
// Declare a new Camera Preview Surface
private OpenCVSurface mPreviewSurface;
//create an audio manager for sounds
private AudioManager maManager;
// Zoom level of the camera
private int mnZoom = 0;
// private int mnZoom = 0;

@Override
public void onCreate(Bundle bSavedInstanceState)
Expand All @@ -70,7 +73,7 @@ public void onCreate(Bundle bSavedInstanceState)
OpenCVLoader.initDebug();

// Turn on Gestures
mGestureDetector = createGestureDetector(this);
mCameraGestureDetector = createCameraGestureDetector(this);

//create audio manager
maManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
Expand All @@ -94,20 +97,16 @@ public boolean onCreateOptionsMenu(Menu menu)
public boolean onOptionsItemSelected(android.view.MenuItem iItem)
{
CardScrollView csvCardsView;
final Camera cCamera;
Camera.Parameters params;

switch (iItem.getItemId())
{
case R.id.scene_menu_item:

cCamera = mPreviewSurface.getCamera();

params = cCamera.getParameters();
//disable preview
inSettings = true;
mPreviewSurface.disableView();

//add a card to the card scroll view for each supported Scenes that is available
final List<String> lsScenes = params.getSupportedSceneModes();
final List<String> lsScenes = mcpParams.getSupportedSceneModes();

//create a new card scroll viewer for this context
csvCardsView = new CardScrollView(this);
Expand Down Expand Up @@ -135,13 +134,11 @@ public void run()
{
Camera cCamera = mPreviewSurface.getCamera();

Camera.Parameters cParams = cCamera.getParameters();
mcpParams.setSceneMode(lsScenes.get(position));

cParams.setSceneMode(lsScenes.get(position));

cCamera.setParameters(cParams);
cCamera.setParameters(mcpParams);
}
}, 2000);
}, 200);

}
});
Expand All @@ -153,13 +150,10 @@ public void run()

case R.id.white_balance_menu_item:

cCamera = mPreviewSurface.getCamera();

params = cCamera.getParameters();
inSettings = true;
mPreviewSurface.disableView();
//add a card to the card scroll view for each supported White Balances that is available
final List<String> lsWhites = params.getSupportedWhiteBalance();

final List<String> lsWhites = mcpParams.getSupportedWhiteBalance();

//create a new card scroll viewer for this context
csvCardsView = new CardScrollView(this);
Expand All @@ -186,13 +180,11 @@ public void run()
{
Camera cCamera = mPreviewSurface.getCamera();

Camera.Parameters cParams = cCamera.getParameters();
mcpParams.setWhiteBalance(lsWhites.get(position));

cParams.setWhiteBalance(lsWhites.get(position));

cCamera.setParameters(cParams);
cCamera.setParameters(mcpParams);
}
}, 2000);
}, 200);

}
});
Expand All @@ -206,11 +198,11 @@ public void run()
//
// cCamera = mPreviewSurface.getCamera();
//
// params = cCamera.getParameters();
// mcpParams = cCamera.getParameters();
// mPreviewSurface.disableView();
//
// //add a card to the card scroll view for each supported Scenes that is available
// final List<String> lsEffects = params.getSupportedColorEffects();
// final List<String> lsEffects = mcpParams.getSupportedColorEffects();
//
// //create a new card scroll viewer for this context
// csvCardsView = new CardScrollView(this);
Expand Down Expand Up @@ -238,15 +230,11 @@ public void run()
// {
// Camera cCamera = mPreviewSurface.getCamera();
//
// Camera.Parameters cParams = cCamera.getParameters();
//
// cParams.setColorEffect(lsEffects.get(position));
//
// cCamera.setParameters(cParams);
// cCamera.startPreview();
// mcpParams.setColorEffect(lsEffects.get(position));
//
// cCamera.setParameters(mcpParams);
// }
// }, 1000);
// }, 200);
//
// }
// });
Expand All @@ -255,7 +243,7 @@ public void run()
// setContentView(csvCardsView);
//
// return true;

//
default:
return super.onOptionsItemSelected(iItem);
}
Expand All @@ -279,6 +267,9 @@ public void onStop()

private void setPreviewSurface()
{
if (inSettings)
inSettings = false;

setContentView(R.layout.opencvpreview_layout);

mPreviewSurface = (OpenCVSurface) findViewById(R.id.camera_preview_opencv);
Expand Down Expand Up @@ -314,7 +305,7 @@ protected void onPause()
mPreviewSurface.disableView();
}

private GestureDetector createGestureDetector(final Context cContext)
private GestureDetector createCameraGestureDetector(final Context cContext)
{
GestureDetector gestureDetector = new GestureDetector(cContext);

Expand All @@ -329,12 +320,6 @@ public boolean onGesture(Gesture gGesture)
{
if (gGesture == Gesture.TAP)
{
EasyTracker.getInstance(getApplicationContext()).send(MapBuilder.createEvent(
"Camera",
"Taken",
"picture_taken",
null).build());

// Play the tap sound
maManager.playSoundEffect(Sounds.TAP);
// Get the camera from the preview surface
Expand All @@ -350,36 +335,43 @@ else if (gGesture == Gesture.SWIPE_DOWN)
{
// Play the dismiss sound
maManager.playSoundEffect(Sounds.DISMISSED);
// If the preview surface isn't null release the camera
if (mPreviewSurface != null)
mPreviewSurface.disableView();
// Close activity
finish();

if (!inSettings)
{
// If the preview surface isn't null release the camera
if (mPreviewSurface != null)
mPreviewSurface.disableView();
// Close activity
finish();
}
else
setPreviewSurface();

return true;

}

else if (gGesture == Gesture.SWIPE_RIGHT)
{
// // Get the camera from the preview surface
// Camera cCamera = mPreviewSurface.getCamera();
//
// if ((mnZoom + 5) < cCamera.getParameters().getMaxZoom())
// else if (gGesture == Gesture.SWIPE_RIGHT)
// {
// if ((mnZoom + 5) < mcpParams.getMaxZoom())
// {
// // Zoom the camera in 5
// Camera.Parameters camParms = cCamera.getParameters();
// camParms.setZoom(mnZoom += 5);
// cCamera.setParameters(camParms);
// // Get the camera from the preview surface
// Camera cCamera = mPreviewSurface.getCamera();
//
// mcpParams.setZoom(mnZoom += 5);
// cCamera.setParameters(mcpParams);
// }
}
// }

else if (gGesture == Gesture.SWIPE_LEFT)
{
// else if (gGesture == Gesture.SWIPE_LEFT)
// {
// // Get the camera from the preview surface
// Camera cCamera = mPreviewSurface.getCamera();
//
// if (mnZoom != 0)
// //zoom the camera out 5
// cCamera.startSmoothZoom(mnZoom -= 1);
}
// }

else if (gGesture == Gesture.TWO_SWIPE_RIGHT)
{
Expand Down Expand Up @@ -410,13 +402,15 @@ public void onShutter()

final transient private Camera.PictureCallback jpgPictureCallback = new Camera.PictureCallback()
{
/**
* After taking picture, onPictureTaken() will be called where image
* will be saved.
*/
@Override
public void onPictureTaken(final byte[] data, final Camera camera)
{
EasyTracker.getInstance(getApplicationContext()).send(MapBuilder.createEvent(
"Camera",
"Taken",
"picture_taken",
null).build());

new SavePhotoTask().execute(data);
setPreviewSurface();
}
Expand All @@ -425,8 +419,8 @@ public void onPictureTaken(final byte[] data, final Camera camera)
@Override
public boolean onGenericMotionEvent(MotionEvent event)
{
if (mGestureDetector != null)
return mGestureDetector.onMotionEvent(event);
if (mCameraGestureDetector != null)
return mCameraGestureDetector.onMotionEvent(event);

return false;
}
Expand All @@ -446,7 +440,6 @@ public boolean onKeyDown(int keyCode, KeyEvent event)

return true;
}

else
return super.onKeyDown(keyCode, event);
}
Expand Down Expand Up @@ -500,7 +493,31 @@ public void onDestroy()
@Override
public void onCameraViewStarted(int width, int height)
{
if (mcpParams != null)
{
new Handler().postDelayed(new Runnable()
{
@Override
public void run()
{
Camera cCamera = mPreviewSurface.getCamera();
cCamera.setParameters(mcpParams);
}
}, 200);
}

else
{
new Handler().postDelayed(new Runnable()
{
@Override
public void run()
{
Camera cCamera = mPreviewSurface.getCamera();
mcpParams = cCamera.getParameters();
}
}, 200);
}
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/com/w9jds/gallery4glass/Classes/StorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public StorageService(Context context)
mContext = context;
try
{

mTableContainers = mClient.getTable("blobcontainers");
mTableBlobs = mClient.getTable("blobs");
}
Expand Down
Loading

0 comments on commit 6eccfe2

Please sign in to comment.