summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOwen Lin <>2009-03-24 19:38:57 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-24 19:38:57 -0700
commit07c90568c7b0568e6cb75559bd13e5d000ac040f (patch)
tree701bc51ede497e210a99b80a98829b86e8b01ecb /src
parent9bc8d1b47e5bab978cc9571ddfdedc8309a0b65d (diff)
downloadLegacyCamera-07c90568c7b0568e6cb75559bd13e5d000ac040f.zip
LegacyCamera-07c90568c7b0568e6cb75559bd13e5d000ac040f.tar.gz
LegacyCamera-07c90568c7b0568e6cb75559bd13e5d000ac040f.tar.bz2
Automated import from //branches/donutburger/...@141143,141143
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/Camera.java43
-rw-r--r--src/com/android/camera/ThumbnailController.java24
2 files changed, 32 insertions, 35 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 1e9a3a8..25d0d81 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -148,6 +148,7 @@ public class Camera extends Activity implements View.OnClickListener,
private Animation mFocusBlinkAnimation;
private View mFocusIndicator;
+ private ImageView mGpsIndicator;
private ToneGenerator mFocusToneGenerator;
@@ -160,6 +161,7 @@ public class Camera extends Activity implements View.OnClickListener,
private long mShutterCallbackTime;
private long mRawPictureCallbackTime;
private int mPicturesRemaining;
+ private boolean mRecordLocation;
private boolean mKeepAndRestartPreview;
@@ -245,6 +247,12 @@ public class Camera extends Activity implements View.OnClickListener,
// Hack to filter out 0.0,0.0 locations
return;
}
+ // If GPS is available before start camera, we won't get status
+ // update so update GPS indicator when we receive data.
+ if (mRecordLocation
+ && LocationManager.GPS_PROVIDER.equals(mProvider)) {
+ mGpsIndicator.setVisibility(View.VISIBLE);
+ }
mLastLocation.set(newLocation);
mValid = true;
}
@@ -257,8 +265,16 @@ public class Camera extends Activity implements View.OnClickListener,
}
public void onStatusChanged(String provider, int status, Bundle extras) {
- if (status == LocationProvider.OUT_OF_SERVICE) {
- mValid = false;
+ switch(status) {
+ case LocationProvider.OUT_OF_SERVICE:
+ case LocationProvider.TEMPORARILY_UNAVAILABLE: {
+ mValid = false;
+ if (mRecordLocation &&
+ LocationManager.GPS_PROVIDER.equals(provider)) {
+ mGpsIndicator.setVisibility(View.INVISIBLE);
+ }
+ break;
+ }
}
}
@@ -521,8 +537,7 @@ public class Camera extends Activity implements View.OnClickListener,
final int latchedOrientation = ImageManager.roundOrientation(mLastOrientation + 90);
- Boolean recordLocation = mPreferences.getBoolean("pref_camera_recordlocation_key", false);
- Location loc = recordLocation ? getCurrentLocation() : null;
+ Location loc = mRecordLocation ? getCurrentLocation() : null;
// Quality 75 has visible artifacts, and quality 90 looks great but the files begin to
// get large. 85 is a good compromise between the two.
mParameters.set("jpeg-quality", 85);
@@ -684,6 +699,7 @@ public class Camera extends Activity implements View.OnClickListener,
setContentView(R.layout.camera);
mSurfaceView = (VideoPreview) findViewById(R.id.camera_preview);
+ mGpsIndicator = (ImageView) findViewById(R.id.gps_indicator);
// don't set mSurfaceHolder here. We have it set ONLY within
// surfaceCreated / surfaceDestroyed, other parts of the code
@@ -949,6 +965,9 @@ public class Camera extends Activity implements View.OnClickListener,
mPausing = false;
mOrientationListener.enable();
+ mRecordLocation = mPreferences.getBoolean(
+ "pref_camera_recordlocation_key", false);
+ mGpsIndicator.setVisibility(View.INVISIBLE);
// install an intent filter to receive SD card related events.
IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
@@ -964,8 +983,7 @@ public class Camera extends Activity implements View.OnClickListener,
restartPreview();
- if (mPreferences.getBoolean("pref_camera_recordlocation_key", false))
- startReceivingLocationUpdates();
+ if (mRecordLocation) startReceivingLocationUpdates();
updateFocusIndicator();
@@ -1331,8 +1349,7 @@ public class Camera extends Activity implements View.OnClickListener,
} catch (InterruptedException ex) {
//
}
- if (mPreviewing)
- break;
+ if (mPreviewing) break;
int delay = (int) (SystemClock.elapsedRealtime() - wallTimeStart) / 1000;
if (delay >= next_warning) {
@@ -1476,16 +1493,12 @@ public class Camera extends Activity implements View.OnClickListener,
}
private Location getCurrentLocation() {
- Location l = null;
-
// go in best to worst order
for (int i = 0; i < mLocationListeners.length; i++) {
- l = mLocationListeners[i].current();
- if (l != null)
- break;
+ Location l = mLocationListeners[i].current();
+ if (l != null) return l;
}
-
- return l;
+ return null;
}
@Override
diff --git a/src/com/android/camera/ThumbnailController.java b/src/com/android/camera/ThumbnailController.java
index 7588c3d..c35c467 100644
--- a/src/com/android/camera/ThumbnailController.java
+++ b/src/com/android/camera/ThumbnailController.java
@@ -188,14 +188,13 @@ public class ThumbnailController {
// Make the mini-thumb size smaller than the button size so that the image corners
// don't peek out from the rounded corners of the frame_thumb graphic:
- final int PADDING_WIDTH = 6;
- final int PADDING_HEIGHT = 6;
+ final int PADDING_WIDTH = 12;
+ final int PADDING_HEIGHT = 12;
LayoutParams layoutParams = mButton.getLayoutParams();
final int miniThumbWidth = layoutParams.width - 2 * PADDING_WIDTH;
final int miniThumbHeight = layoutParams.height - 2 * PADDING_HEIGHT;
- mThumb = ImageManager.extractMiniThumb(original,
- miniThumbWidth, miniThumbHeight, false);
- mThumb = makeRoundedCorner(mThumb, 3, 3);
+ mThumb = ImageManager.extractMiniThumb(
+ original, miniThumbWidth, miniThumbHeight, false);
Drawable[] vignetteLayers = new Drawable[2];
vignetteLayers[0] = mFrame;
@@ -222,21 +221,6 @@ public class ThumbnailController {
}
}
- private static Bitmap makeRoundedCorner(Bitmap thumb, int rx, int ry) {
- if (thumb == null) return null;
- int width = thumb.getWidth();
- int height = thumb.getHeight();
-
- Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
- Canvas canvas = new Canvas(result);
- Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
- paint.setStyle(Paint.Style.FILL);
- canvas.drawRoundRect(new RectF(0, 0, width, height), rx, ry, paint);
- paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
- canvas.drawBitmap(thumb, 0, 0, paint);
- return result;
- }
-
public boolean isUriValid() {
if (mUri == null) return false;
try {