diff options
author | Angus Kong <shkong@google.com> | 2013-08-05 15:30:05 -0700 |
---|---|---|
committer | Angus Kong <shkong@google.com> | 2013-08-05 15:31:05 -0700 |
commit | d475c670423404931e1b7281ac2dcb430490c27b (patch) | |
tree | a4b688adcacc8192a596e538e5fc7f51865cc8c9 /src/com/android/camera | |
parent | 26d2fb1a5cffea83b9ef6c264cdd1d0e56aeff87 (diff) | |
download | android_packages_apps_Snap-d475c670423404931e1b7281ac2dcb430490c27b.tar.gz android_packages_apps_Snap-d475c670423404931e1b7281ac2dcb430490c27b.tar.bz2 android_packages_apps_Snap-d475c670423404931e1b7281ac2dcb430490c27b.zip |
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
Diffstat (limited to 'src/com/android/camera')
-rw-r--r-- | src/com/android/camera/CameraActivity.java | 39 |
1 files changed, 20 insertions, 19 deletions
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(); } |