@Override public void onStart() { super.onStart(); if (mMenu == null) { onCreateToolbar(getToolbar()); } }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); mFeedItem = getArguments().getParcelable(EXTRA_ITEM); mHandler = new Handler(Looper.getMainLooper()); mBuilder = getRendererBuilder(); }
@Override public void onPause() { super.onPause(); if (mWebView != null) { mWebView.onPause(); } }
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); mMediaController = new MediaController(view.getContext()); mMediaController.setAnchorView(view); mSurfaceView.getHolder().addCallback(this); }
@Override public void onDestroy() { super.onDestroy(); if (getArguments() != null) { getArguments().putParcelable(EXTRA_FEED_ITEM, mFeedItem); } }
@Override public void onDestroyView() { if (mWebView != null) { mWebView.destroy(); } ButterKnife.reset(this); super.onDestroyView(); }
@Override public void onStart() { super.onStart(); mWebView.loadUrl(PAGE_TEMPLATE_URL); if (mMenu == null) { onCreateToolbar(getToolbar()); } }
@Override public void onCreateToolbar(Toolbar toolbar) { super.onCreateToolbar(toolbar); if (shouldAddActionItems()) { toolbar.inflateMenu(R.menu.feeditem_overflow); mMenu = toolbar.getMenu(); configureOverflow(mFavorited); } }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Bundle args = getArguments(); mFeedItem = args.getParcelable(EXTRA_FEED_ITEM); mPageJson = getPageJson(mFeedItem); mFavorited = mFeedItem.favorited(); setHasOptionsMenu(true); }
@Override public void onStop() { super.onStop(); if (mMenu != null) { mMenu.removeItem(R.id.action_share); mMenu.removeItem(R.id.action_favorite); mMenu.removeItem(R.id.action_unfavorite); mMenu = null; } }
@Override public void onResume() { super.onResume(); if (mWebView != null) { mWebView.onResume(); } if (getTracker() != null) { getTracker().setScreenName("ArticleView"); getTracker().setPage(mFeedItem.link()); } }
@Override public void onResume() { super.onResume(); mPlayer = ExoPlayer.Factory.newInstance(2, 1000, 5000); mPlayer.addListener(this); mPlayer.seekTo(mPlayerPosition); mMediaController.setMediaPlayer(new PlayerControl(mPlayer)); mMediaController.setEnabled(true); mCallback = new RendererBuilderCallback(); mBuilder.buildRenderers(mCallback); }
@Override public void onPause() { super.onPause(); if (mPlayer != null) { mPlayer.stop(); mPlayerPosition = mPlayer.getCurrentPosition(); mPlayer.release(); mPlayer = null; } mCallback = null; mVideoRenderer = null; mShutter.setVisibility(View.VISIBLE); }
@Override public void onStop() { super.onStop(); if (mMenu != null) { mMenu.removeItem(R.id.action_share); mMenu.removeItem(R.id.action_favorite); mMenu.removeItem(R.id.action_unfavorite); mMenu = null; } if (mMediaController != null && mMediaController.isShowing()) { mMediaController.hide(); } }
@Override public void onAttach(Activity activity) { super.onAttach(activity); }
@Override public void onViewStateRestored(@Nullable Bundle savedInstanceState) { super.onViewStateRestored(savedInstanceState); mWebView.restoreState(savedInstanceState); }
@Override public void onDestroyView() { ButterKnife.reset(this); super.onDestroyView(); }
@Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); mWebView.saveState(outState); }