private void initView() { final ViewPager pager = (ViewPager) this.findViewById(R.id.pager); mPagerAdapter = new BrowserTabsAdapter(getFragmentManager()); pager.setAdapter(mPagerAdapter); mPagerAdapter.setViewPager(pager); pager.setOffscreenPageLimit(2); mDrawerLayout = (DrawerLayout) this.findViewById(R.id.drawer); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); final int themeId = ThemeUtils.getInteger(getTheme(), R.attr.themeId, PureFM.THEME_ID_DARK); mDrawerToggle = new BrowserActivityDrawerToggle( this, this.mDrawerLayout, themeId == PureFM.THEME_ID_LIGHT ? R.drawable.holo_light_ic_drawer : R.drawable.holo_dark_ic_drawer, R.string.menu_bookmarks, R.string.app_name); mDrawerLayout.setDrawerListener(mDrawerToggle); mDrawerList = (ListView) this.findViewById(R.id.drawerList); mDrawerList.setAdapter(mBookmarksAdapter = new BookmarksAdapter(this)); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_SETTINGS) { if (resultCode == Activity.RESULT_OK) { mPagerAdapter.notifyDataSetChanged(); } } }
private void restoreSavedState(final Bundle savedState) { if (savedState != null) { final Parcelable adapterState = savedState.getParcelable(EXTRA_SAVED_FRAGMENT_ADAPTER_STATE); if (adapterState != null) { if (mPagerAdapter != null) { mPagerAdapter.restoreManualState(adapterState); } } } }
public void invalidateList() { mPagerAdapter.notifyDataSetChanged(); }
@Override protected void onSaveInstanceState(@NonNull final Bundle outState) { super.onSaveInstanceState(outState); outState.putParcelable(EXTRA_SAVED_FRAGMENT_ADAPTER_STATE, mPagerAdapter.saveManualState()); }