diff options
author | Suresh Kamasala <skamas@codeaurora.org> | 2015-02-12 18:28:22 +0530 |
---|---|---|
committer | Suresh Kamasala <skamas@codeaurora.org> | 2015-02-12 18:28:22 +0530 |
commit | 7290784ab3832a99983149e929dd5f7449656d3c (patch) | |
tree | cf6f1606571ffd5515c9e76291749564b7bd24e8 /src/com/android/gallery3d/app/AbstractGalleryActivity.java | |
parent | 005feabdc6f124da8c37c0aa72216abac9f2b5f2 (diff) | |
download | android_packages_apps_Gallery2-7290784ab3832a99983149e929dd5f7449656d3c.tar.gz android_packages_apps_Gallery2-7290784ab3832a99983149e929dd5f7449656d3c.tar.bz2 android_packages_apps_Gallery2-7290784ab3832a99983149e929dd5f7449656d3c.zip |
Galler2 : Load onResume on separate thread
Loading onResume is taking too much time
So screen transition is not happening quickly.
Loading onResume in separate thread with
Some delay and removed animation, So
screen transition can happeny smoothly.
Change-Id: I0f09128f8c948a33b72a5b4933efe7f4fbba2cb2
CRs-Fixed: 785891
Diffstat (limited to 'src/com/android/gallery3d/app/AbstractGalleryActivity.java')
-rw-r--r-- | src/com/android/gallery3d/app/AbstractGalleryActivity.java | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/src/com/android/gallery3d/app/AbstractGalleryActivity.java b/src/com/android/gallery3d/app/AbstractGalleryActivity.java index ae30cb0aa..84a9b5753 100644 --- a/src/com/android/gallery3d/app/AbstractGalleryActivity.java +++ b/src/com/android/gallery3d/app/AbstractGalleryActivity.java @@ -37,6 +37,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; +import android.os.Handler; import com.android.gallery3d.R; import com.android.gallery3d.common.ApiHelper; @@ -60,6 +61,7 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext private TransitionStore mTransitionStore = new TransitionStore(); private boolean mDisableToggleStatusBar; private PanoramaViewHelper mPanoramaViewHelper; + private static final int ONRESUME_DELAY = 50; private AlertDialog mAlertDialog = null; private BroadcastReceiver mMountReceiver = new BroadcastReceiver() { @@ -212,15 +214,31 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext @Override protected void onResume() { super.onResume(); - mGLRootView.lockRenderThread(); - try { - getStateManager().resume(); - getDataManager().resume(); - } finally { - mGLRootView.unlockRenderThread(); - } - mGLRootView.onResume(); - mOrientationManager.resume(); + delayedOnResume(ONRESUME_DELAY); + } + + private void delayedOnResume(final int delay){ + final Handler handler = new Handler(); + Runnable delayTask = new Runnable() { + @Override + public void run() { + handler.postDelayed(new Runnable() { + @Override + public void run() { + mGLRootView.lockRenderThread(); + try { + getStateManager().resume(); + getDataManager().resume(); + } finally { + mGLRootView.unlockRenderThread(); + } + mGLRootView.onResume(); + mOrientationManager.resume(); + }}, delay); + } + }; + Thread delayThread = new Thread(delayTask); + delayThread.start(); } @Override |