mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
FeedModel null checks. Fixes https://github.com/austinhuang0131/barinsta/issues/293
This commit is contained in:
parent
cc930c65b7
commit
d1a9393249
@ -233,6 +233,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
feedModel = (FeedModel) feedModelSerializable;
|
feedModel = (FeedModel) feedModelSerializable;
|
||||||
|
if (feedModel == null) return;
|
||||||
if (feedModel.getItemType() == MediaItemType.MEDIA_TYPE_SLIDER) {
|
if (feedModel.getItemType() == MediaItemType.MEDIA_TYPE_SLIDER) {
|
||||||
sliderPosition = arguments.getInt(ARG_SLIDER_POSITION, 0);
|
sliderPosition = arguments.getInt(ARG_SLIDER_POSITION, 0);
|
||||||
}
|
}
|
||||||
@ -258,7 +259,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
|
public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
|
||||||
setupToolbar();
|
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,6 +322,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onSaveInstanceState(@NonNull final Bundle outState) {
|
public void onSaveInstanceState(@NonNull final Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
if (feedModel == null) return;
|
||||||
if (feedModel.getItemType() == MediaItemType.MEDIA_TYPE_SLIDER) {
|
if (feedModel.getItemType() == MediaItemType.MEDIA_TYPE_SLIDER) {
|
||||||
outState.putInt(ARG_SLIDER_POSITION, sliderPosition);
|
outState.putInt(ARG_SLIDER_POSITION, sliderPosition);
|
||||||
}
|
}
|
||||||
@ -411,6 +412,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
if (feedModel == null) return;
|
||||||
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
||||||
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) != null;
|
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) != null;
|
||||||
if (!wasPaused && (sharedProfilePicElement != null || sharedMainPostElement != null)) {
|
if (!wasPaused && (sharedProfilePicElement != null || sharedMainPostElement != null)) {
|
||||||
@ -668,14 +670,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
|
|||||||
binding.profilePic.setOnClickListener(v -> navigateToProfile("@" + profileModel.getUsername()));
|
binding.profilePic.setOnClickListener(v -> navigateToProfile("@" + profileModel.getUsername()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupToolbar() {
|
|
||||||
// fragmentActivity.fitSystemWindows(true);
|
|
||||||
// final ActionBar actionBar = fragmentActivity.getSupportActionBar();
|
|
||||||
// if (actionBar == null) return;
|
|
||||||
// actionBar.setTitle(null);
|
|
||||||
// actionBar.setSubtitle(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setupTitles() {
|
private void setupTitles() {
|
||||||
final ProfileModel profileModel = feedModel.getProfileModel();
|
final ProfileModel profileModel = feedModel.getProfileModel();
|
||||||
if (profileModel == null) {
|
if (profileModel == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user