summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/Camera.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/Camera.java')
-rw-r--r--src/com/android/camera/Camera.java48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index a6775ae..079528b 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -759,7 +759,19 @@ public class Camera extends Activity implements View.OnClickListener,
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
- mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+ // To reduce startup time, we run some service creation code in another thread.
+ // We make sure the services are loaded at the end of onCreate().
+ Thread loadServiceThread = new Thread(new Runnable() {
+ public void run() {
+ mLocationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
+ mOrientationListener = new OrientationListener(Camera.this) {
+ public void onOrientationChanged(int orientation) {
+ mLastOrientation = orientation;
+ }
+ };
+ }
+ });
+ loadServiceThread.start();
mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
mContentResolver = getContentResolver();
@@ -816,25 +828,25 @@ public class Camera extends Activity implements View.OnClickListener,
afd.getLength());
if (mClickSound != null) {
- mClickSound.setAudioStreamType(AudioManager.STREAM_SYSTEM);
+ mClickSound.setAudioStreamType(AudioManager.STREAM_ALARM);
mClickSound.prepare();
}
} catch (Exception ex) {
Log.w(TAG, "Couldn't create click sound", ex);
}
- mOrientationListener = new OrientationListener(this) {
- public void onOrientationChanged(int orientation) {
- mLastOrientation = orientation;
- }
- };
-
mFocusIndicator = findViewById(R.id.focus_indicator);
mFocusBlinkAnimation = AnimationUtils.loadAnimation(this, R.anim.auto_focus_blink);
mFocusBlinkAnimation.setRepeatCount(Animation.INFINITE);
mFocusBlinkAnimation.setRepeatMode(Animation.REVERSE);
mPostCaptureAlert = findViewById(R.id.post_picture_panel);
+
+ // Make sure the services are loaded.
+ try {
+ loadServiceThread.join();
+ } catch (InterruptedException ex) {
+ }
}
@Override
@@ -1268,10 +1280,7 @@ public class Camera extends Activity implements View.OnClickListener,
private void restartPreview() {
VideoPreview surfaceView = mSurfaceView;
- if (surfaceView == null ||
- surfaceView.getWidth() == 0 || surfaceView.getHeight() == 0) {
- return;
- }
+
// make sure the surfaceview fills the whole screen when previewing
surfaceView.setAspectRatio(VideoPreview.DONT_CARE);
setViewFinder(mOriginalViewFinderWidth, mOriginalViewFinderHeight, true);
@@ -1290,9 +1299,11 @@ public class Camera extends Activity implements View.OnClickListener,
Animation a = mShowLastPictureButtonAnimation;
a.setDuration(500);
mLastPictureButton.setAnimation(a);
- } else if (mShouldTransitionThumbnails) {
+ }
+
+ if (mShouldTransitionThumbnails) {
mShouldTransitionThumbnails = false;
- mThumbnailTransition.reverseTransition(500);
+ mThumbnailTransition.startTransition(500);
}
}
@@ -1435,13 +1446,8 @@ public class Camera extends Activity implements View.OnClickListener,
private void viewLastImage() {
Uri targetUri = mLastPictureUri;
if (targetUri != null) {
- Uri thisUri = Images.Media.INTERNAL_CONTENT_URI;
- if (thisUri != null) {
- String bucket = thisUri.getQueryParameter("bucketId");
- if (bucket != null) {
- targetUri = targetUri.buildUpon().appendQueryParameter("bucketId", bucket).build();
- }
- }
+ targetUri = targetUri.buildUpon().
+ appendQueryParameter("bucketId", ImageManager.CAMERA_IMAGE_BUCKET_ID).build();
Intent intent = new Intent(Intent.ACTION_VIEW, targetUri);
intent.putExtra(MediaStore.EXTRA_SCREEN_ORIENTATION,
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);