-Fixed activity not available exception when setting title on subscription fragments when used as front pager.

This commit is contained in:
John Zhen Mo 2018-03-25 10:26:24 -07:00
parent 20c1f12da8
commit b546df7b95
2 changed files with 5 additions and 3 deletions

View File

@ -79,7 +79,9 @@ public final class BookmarkFragment
@Override @Override
public void setUserVisibleHint(boolean isVisibleToUser) { public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser); super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) setTitle(getString(R.string.tab_bookmarks)); if (activity != null && isVisibleToUser) {
setTitle(activity.getString(R.string.tab_bookmarks));
}
} }
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////

View File

@ -104,8 +104,8 @@ public class SubscriptionFragment extends BaseStateFragment<List<SubscriptionEnt
@Override @Override
public void setUserVisibleHint(boolean isVisibleToUser) { public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser); super.setUserVisibleHint(isVisibleToUser);
if (isVisibleToUser) { if (activity != null && isVisibleToUser) {
setTitle(getString(R.string.tab_subscriptions)); setTitle(activity.getString(R.string.tab_subscriptions));
} }
} }