Call GLRootView onPause and onResume

This commit is contained in:
seven332 committed 2016-05-02 13:20:35 +08:00
1 parent e6638b6f56
commit 2a324c4d89
1 file changed
+25 -4
@@ -99,6 +99,8 @@ public class GalleryActivity extends EhActivity
private GalleryInfo mGalleryInfo;
private int mPage;
@Nullable
private GLRootView mGLRootView;
@Nullable
private GalleryView mGalleryView;
@@ -259,9 +261,9 @@ public class GalleryActivity extends EhActivity
mGalleryProvider.start();
setContentView(R.layout.activity_gallery);
GLRootView glRootView = (GLRootView) ViewUtils.$$(this, R.id.gl_root_view);
mGalleryProvider.setGLRoot(glRootView);
mUploader = new ImageTexture.Uploader(glRootView);
mGLRootView = (GLRootView) ViewUtils.$$(this, R.id.gl_root_view);
mGalleryProvider.setGLRoot(mGLRootView);
mUploader = new ImageTexture.Uploader(mGLRootView);
int startPage;
if (savedInstanceState == null) {
@@ -273,7 +275,7 @@ public class GalleryActivity extends EhActivity
mGalleryView = new GalleryView(this, new GalleryAdapter(), this,
Settings.getReadingDirection(), Settings.getPageScaling(),
Settings.getStartPosition(), startPage);
glRootView.setContentPane(mGalleryView);
mGLRootView.setContentPane(mGalleryView);
// System UI helper
if (Settings.getReadingFullscreen()) {
@@ -343,6 +345,7 @@ public class GalleryActivity extends EhActivity
@Override
protected void onDestroy() {
super.onDestroy();
mGLRootView = null;
mGalleryView = null;
if (mUploader != null) {
mUploader.clear();
@@ -366,6 +369,24 @@ public class GalleryActivity extends EhActivity
SimpleHandler.getInstance().removeCallbacks(mHideSliderRunnable);
}
@Override
protected void onPause() {
super.onPause();
if (mGLRootView != null) {
mGLRootView.onPause();
}
}
@Override
protected void onResume() {
super.onResume();
if (mGLRootView != null) {
mGLRootView.onResume();
}
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);