From 5b040a699b6224dd642bcd0d28e202d89a710390 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 15 Jul 2018 11:17:21 +0200 Subject: [PATCH] do not show an error at exoplayer setup fail, just try reinitializing later --- .../gallery/activities/ViewPagerActivity.kt | 5 +---- .../simplemobiletools/gallery/fragments/VideoFragment.kt | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 87e029a27..084ddc475 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -230,6 +230,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } refreshViewPager() + view_pager.offscreenPageLimit = 2 if (config.blackBackground) { view_pager.background = ColorDrawable(Color.BLACK) @@ -1104,10 +1105,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {} override fun onPageSelected(position: Int) { - if (view_pager.offscreenPageLimit == 1) { - view_pager.offscreenPageLimit = 2 - } - if (mPos != position) { mPos = position updateActionbarTitle() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt index 0cfc7faa5..d081fd120 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/fragments/VideoFragment.kt @@ -122,7 +122,6 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S override fun onPlayerError(error: ExoPlaybackException?) { mIsExoPlayerInitialized = false - activity?.showErrorToast(error.toString()) } override fun onLoadingChanged(isLoading: Boolean) {} @@ -472,11 +471,9 @@ class VideoFragment : ViewPagerFragment(), TextureView.SurfaceTextureListener, S }.start() } - override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) { - } + override fun onSurfaceTextureSizeChanged(surface: SurfaceTexture?, width: Int, height: Int) {} - override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) { - } + override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) {} override fun onSurfaceTextureDestroyed(surface: SurfaceTexture?): Boolean { releaseExoPlayer()