@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { boolean newWork = false; String link = getArguments().getString(Constants.ArgsName.LINK); Work incomingWork = (Work) getArguments().getSerializable(Constants.ArgsName.WORK); if (incomingWork != null && !incomingWork.equals(work)) { work = incomingWork; newWork = true; } else if (link != null) { if (work == null || !work.getLink().equals(link)) { work = new Work(link); newWork = true; } } pagesSize = 999; if (newWork) { clearData(); try { setDataSource(new IllustrationsParser(work)); } catch (MalformedURLException e) { Log.e(TAG, "Unknown exception", e); ErrorFragment.show(IllustrationPagerFragment.this, R.string.error); } } else { postEvent(new IllustrationsParsedEvent(adapter.getItems())); } return super.onCreateView(inflater, container, savedInstanceState); }
@Override public boolean allowBackPress() { if (getFragmentManager().getBackStackEntryCount() == 0) { AuthorFragment.show(new FragmentBuilder(getFragmentManager()), getId(), work.getAuthor()); return false; } else { return super.allowBackPress(); } }