Skip to content

Commit 7f1d3b3

Browse files
committed
Add icons. Possibly fix bug where if you don't rotate the camera before
taking the picture, it gets a landscape orientation by default.
1 parent 50d099c commit 7f1d3b3

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

gen/org/cygx1/snap/R.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public static final class attr {
1212
}
1313
public static final class drawable {
1414
public static final int icon=0x7f020000;
15-
public static final int stat_sys_warning=0x7f020001;
15+
public static final int notify_success=0x7f020001;
16+
public static final int stat_sys_warning=0x7f020002;
1617
}
1718
public static final class layout {
1819
public static final int main=0x7f030000;

res/drawable-hdpi/icon.png

3.31 KB
Loading

res/drawable-ldpi/icon.png

1004 Bytes
Loading

res/drawable-ldpi/notify_success.png

1.6 KB
Loading

res/drawable-mdpi/icon.png

1.49 KB
Loading

src/org/cygx1/snap/Preview.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class Preview extends SurfaceView implements SurfaceHolder.Callback {
1515
SurfaceHolder mHolder;
1616
Camera mCamera;
1717
private OrientationEventListener mOrientationListener;
18-
private int mLastOrientation, mLastLatchedOrientation = 0;
18+
private int mLastLatchedOrientation = -1;
1919

2020
Preview(Context context) {
2121
super(context);
@@ -28,16 +28,11 @@ public class Preview extends SurfaceView implements SurfaceHolder.Callback {
2828

2929
mOrientationListener = new OrientationEventListener(context) {
3030
public void onOrientationChanged(int orientation) {
31-
if (null == mCamera) return;
32-
33-
// We keep the last known orientation. So if the user
34-
// first orient the camera then point the camera to
35-
// floor/sky, we still have the correct orientation.
31+
// Keep the last known orientation
3632
if (orientation != ORIENTATION_UNKNOWN) {
37-
mLastOrientation = orientation;
3833

3934
int latchedOrientation = roundOrientation(orientation);
40-
if (mLastLatchedOrientation != latchedOrientation) {
35+
if ((null != mCamera) && (mLastLatchedOrientation != latchedOrientation)) {
4136
Camera.Parameters parameters = mCamera.getParameters();
4237
Log.d("Snap", "Detecting rotation as " + latchedOrientation);
4338
parameters.setRotation((latchedOrientation+90)%360);

src/org/cygx1/snap/Snap.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@
4747
* detect camera orientation and tag the JPEG with the right orientation (done?)
4848
* make sure camera preview works on all devices (done?)
4949
* delete the image after sending
50-
* design an icon for the app and for the notification
50+
* silence the shutter
51+
* on error, have the notification take you to the unsent file so you can try again
52+
* handle onPause and onResume because I think lack of this causes the camera to get wedged
5153
*
5254
* DONE:
5355
* send mail from a separate thread so it doesn't block the UI
5456
* prompt for preferences on startup if they're not set
5557
* put a unique identifier in the mail subject so it doesn't continue the same gmail thread
58+
* design an icon for the app and for the notification
5659
*/
5760

5861
public class Snap extends Activity {
@@ -90,7 +93,7 @@ public void onCreate(Bundle savedInstanceState) {
9093
notifyError = new Notification(R.drawable.stat_sys_warning, "", System.currentTimeMillis());
9194
notifyError.setLatestEventInfo( context, "Snap", "Unable to send photo", contentIntent);
9295
// TODO: better success icon
93-
notifySuccess = new Notification(R.drawable.stat_sys_warning, "", System.currentTimeMillis());
96+
notifySuccess = new Notification(R.drawable.notify_success, "", System.currentTimeMillis());
9497
notifySuccess.setLatestEventInfo( context, "Snap", "Photo sent successfully", contentIntent);
9598

9699
// TL: the code below tries to invoke the built-in camera app

0 commit comments

Comments
 (0)