Fix crash with profile and context

This commit is contained in:
Thomas 2024-01-15 16:48:57 +01:00
parent 7e36abb24d
commit e20fdafaa5
2 changed files with 15 additions and 5 deletions

View file

@ -68,12 +68,13 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
private Status focusedStatus; private Status focusedStatus;
private String focusedStatusURI; private String focusedStatusURI;
private boolean checkRemotely; private boolean checkRemotely;
private ActivityConversationBinding binding;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
ActivityConversationBinding binding = ActivityConversationBinding.inflate(getLayoutInflater()); binding = ActivityConversationBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot()); setContentView(binding.getRoot());
setSupportActionBar(binding.toolbar); setSupportActionBar(binding.toolbar);
ActionBar actionBar = getSupportActionBar(); ActionBar actionBar = getSupportActionBar();
@ -93,7 +94,7 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
manageTopBarScrolling(binding.toolbar, sharedpreferences); manageTopBarScrolling(binding.toolbar, sharedpreferences);
displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false); displayCW = sharedpreferences.getBoolean(getString(R.string.SET_EXPAND_CW), false);
focusedStatus = null; // or other values focusedStatus = null; // or other values
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
Bundle args = getIntent().getExtras(); Bundle args = getIntent().getExtras();
if (args != null) { if (args != null) {
@ -126,6 +127,9 @@ public class ContextActivity extends BaseActivity implements FragmentMastodonCon
loadRemotelyConversation(true); loadRemotelyConversation(true);
invalidateOptionsMenu(); invalidateOptionsMenu();
} }
if(currentAccount != null) {
MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account);
}
} }

View file

@ -61,7 +61,9 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
case 0 -> { case 0 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline(); fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
if(account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id); bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
}
bundle.putBoolean(Helper.ARG_SHOW_PINNED, true); bundle.putBoolean(Helper.ARG_SHOW_PINNED, true);
bundle.putBoolean(Helper.ARG_SHOW_REPLIES, false); bundle.putBoolean(Helper.ARG_SHOW_REPLIES, false);
bundle.putBoolean(Helper.ARG_SHOW_REBLOGS, true); bundle.putBoolean(Helper.ARG_SHOW_REBLOGS, true);
@ -72,7 +74,9 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
case 1 -> { case 1 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline(); fragmentMastodonTimeline = new FragmentMastodonTimeline();
bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE); bundle.putSerializable(Helper.ARG_TIMELINE_TYPE, Timeline.TimeLineEnum.ACCOUNT_TIMELINE);
if(account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id); bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
}
bundle.putBoolean(Helper.ARG_SHOW_PINNED, false); bundle.putBoolean(Helper.ARG_SHOW_PINNED, false);
bundle.putBoolean(Helper.ARG_SHOW_REPLIES, true); bundle.putBoolean(Helper.ARG_SHOW_REPLIES, true);
bundle.putBoolean(Helper.ARG_SHOW_REBLOGS, false); bundle.putBoolean(Helper.ARG_SHOW_REBLOGS, false);
@ -82,7 +86,9 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
} }
case 2 -> { case 2 -> {
FragmentMediaProfile fragmentMediaProfile = new FragmentMediaProfile(); FragmentMediaProfile fragmentMediaProfile = new FragmentMediaProfile();
if(account != null) {
bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id); bundle.putSerializable(Helper.ARG_CACHED_ACCOUNT_ID, account.id);
}
bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely); bundle.putBoolean(Helper.ARG_CHECK_REMOTELY, checkRemotely);
fragmentMediaProfile.setArguments(bundle); fragmentMediaProfile.setArguments(bundle);
return fragmentMediaProfile; return fragmentMediaProfile;