1
0
mirror of https://github.com/TwidereProject/Twidere-Android synced 2025-01-30 08:25:01 +01:00
This commit is contained in:
Mariotaku Lee 2016-02-08 20:36:52 +08:00
parent ad49044257
commit 7e7940fb16

View File

@ -281,7 +281,9 @@ public final class MediaViewerActivity extends AbsMediaViewerActivity implements
public boolean onPrepareOptionsMenu(Menu menu) {
final ViewPager viewPager = findViewPager();
final PagerAdapter adapter = viewPager.getAdapter();
final Object object = adapter.instantiateItem(viewPager, viewPager.getCurrentItem());
final int currentItem = viewPager.getCurrentItem();
if (currentItem < 0 || currentItem >= adapter.getCount()) return false;
final Object object = adapter.instantiateItem(viewPager, currentItem);
if (!(object instanceof MediaViewerFragment)) return false;
if (object instanceof CacheDownloadMediaViewerFragment) {
CacheDownloadMediaViewerFragment f = (CacheDownloadMediaViewerFragment) object;
@ -303,6 +305,7 @@ public final class MediaViewerActivity extends AbsMediaViewerActivity implements
final ViewPager viewPager = findViewPager();
final PagerAdapter adapter = viewPager.getAdapter();
final int currentItem = viewPager.getCurrentItem();
if (currentItem < 0 || currentItem >= adapter.getCount()) return false;
final Object object = adapter.instantiateItem(viewPager, currentItem);
if (!(object instanceof MediaViewerFragment)) return false;
switch (item.getItemId()) {