From 3d11536f496c6fd6ab0bd29b487c6c5cd84df40b Mon Sep 17 00:00:00 2001 From: Angus Kong Date: Mon, 5 Aug 2013 15:30:05 -0700 Subject: Load the FilmStrip data in onCreate() The loading should be done in onCreate() so it won't waste time loading the data which has been loaded everytime the app is brought to the foreground. bug:10189998 Change-Id: I5b9158b206f96b065f6f18a5ab7da3ca14b9e52a --- src/com/android/camera/CameraActivity.java | 39 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'src/com') diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java index 0ed48d721..7f71d5f31 100644 --- a/src/com/android/camera/CameraActivity.java +++ b/src/com/android/camera/CameraActivity.java @@ -279,6 +279,7 @@ public class CameraActivity extends Activity mCameraPreviewData = new CameraPreviewData(rootLayout, FilmStripView.ImageData.SIZE_FULL, FilmStripView.ImageData.SIZE_FULL); + // Put a CameraPreviewData at the first position. mWrappedDataAdapter = new FixedFirstDataAdapter( new CameraDataAdapter(new ColorDrawable( getResources().getColor(R.color.photo_placeholder))), @@ -296,6 +297,25 @@ public class CameraActivity extends Activity mOrientationListener = new MyOrientationEventListener(this); mMainHandler = new Handler(getMainLooper()); bindMediaSaveService(); + + if (!mSecureCamera) { + mDataAdapter = mWrappedDataAdapter; + mDataAdapter.requestLoad(getContentResolver()); + } else { + // Put a lock placeholder as the last image by setting its date to 0. + ImageView v = (ImageView) getLayoutInflater().inflate( + R.layout.secure_album_placeholder, null); + mDataAdapter = new FixedLastDataAdapter( + mWrappedDataAdapter, + new LocalData.LocalViewData( + v, + v.getDrawable().getIntrinsicWidth(), + v.getDrawable().getIntrinsicHeight(), + 0, 0)); + // Flush out all the original data. + mDataAdapter.flush(); + } + mFilmStripView.setDataAdapter(mDataAdapter); } private void setRotationAnimation() { @@ -343,25 +363,6 @@ public class CameraActivity extends Activity public void onStart() { super.onStart(); - // The loading is done in background and will update the filmstrip later. - if (!mSecureCamera) { - mDataAdapter = mWrappedDataAdapter; - mDataAdapter.requestLoad(getContentResolver()); - mFilmStripView.setDataAdapter(mDataAdapter); - } else { - // Put a lock placeholder as the last image by setting its date to 0. - ImageView v = (ImageView) getLayoutInflater().inflate( - R.layout.secure_album_placeholder, null); - mDataAdapter = new FixedLastDataAdapter( - mWrappedDataAdapter, - new LocalData.LocalViewData( - v, - v.getDrawable().getIntrinsicWidth(), - v.getDrawable().getIntrinsicHeight(), - 0, 0)); - // Flush out all the original data. - mDataAdapter.flush(); - } mPanoramaViewHelper.onStart(); } -- cgit v1.2.3