Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7290784a authored by Suresh Kamasala's avatar Suresh Kamasala
Browse files

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
parent 005feabd
Loading
Loading
Loading
Loading
+27 −9
Original line number Diff line number Diff line
@@ -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,6 +214,17 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext
    @Override
    protected void onResume() {
        super.onResume();
        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();
@@ -221,6 +234,11 @@ public class AbstractGalleryActivity extends Activity implements GalleryContext
                            }
                    mGLRootView.onResume();
                    mOrientationManager.resume();
                   }}, delay);
             }
          };
        Thread delayThread = new Thread(delayTask);
        delayThread.start();
    }

    @Override
+10 −1
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ public class MovieActivity extends Activity {
            @Override
            public void onCompletion() {
                if (mFinishOnCompletion) {
                    finish();
                    finishActivity();
                    mControlResumed = false;
                    Bookmarker mBookmarker = new Bookmarker(MovieActivity.this);
                    mBookmarker.setBookmark(mMovieItem.getUri(), 0, 1);
@@ -801,4 +801,13 @@ public class MovieActivity extends Activity {
            actionBar.setTitle(title);
        }
    }
    @Override
    public void onBackPressed() {
        finishActivity();
    }
    private void finishActivity(){
        MovieActivity.this.finish();
        overridePendingTransition(0,0);
        return;
    }
}