Merge remote-tracking branch 'upstream/master'

This commit is contained in:
sk 2023-07-17 21:35:24 +02:00
commit 4e28f011dd
1 changed files with 33 additions and 6 deletions

View File

@ -324,6 +324,13 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
fab.setOnClickListener(this::onFabClick); fab.setOnClickListener(this::onFabClick);
fab.setOnLongClickListener(v->UiUtils.pickAccountForCompose(getActivity(), accountID, getPrefilledText())); fab.setOnLongClickListener(v->UiUtils.pickAccountForCompose(getActivity(), accountID, getPrefilledText()));
if(savedInstanceState!=null){
postsFragment=(AccountTimelineFragment) getChildFragmentManager().getFragment(savedInstanceState, "posts");
postsWithRepliesFragment=(AccountTimelineFragment) getChildFragmentManager().getFragment(savedInstanceState, "postsWithReplies");
mediaFragment=(AccountTimelineFragment) getChildFragmentManager().getFragment(savedInstanceState, "media");
pinnedPostsFragment=(PinnedPostsListFragment) getChildFragmentManager().getFragment(savedInstanceState, "pinnedPosts");
}
if(loaded){ if(loaded){
bindHeaderView(); bindHeaderView();
dataLoaded(); dataLoaded();
@ -462,19 +469,24 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
public void dataLoaded(){ public void dataLoaded(){
if(getActivity()==null) if(getActivity()==null)
return; return;
Bundle args=new Bundle();
args.putString("account", accountID);
args.putParcelable("profileAccount", Parcels.wrap(account));
args.putBoolean("__is_tab", true);
if(postsFragment==null){ if(postsFragment==null){
postsFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.DEFAULT, true); postsFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.DEFAULT, true);
}
if(postsWithRepliesFragment==null){
postsWithRepliesFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.INCLUDE_REPLIES, false); postsWithRepliesFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.INCLUDE_REPLIES, false);
}
if(mediaFragment==null){
mediaFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.MEDIA, false); mediaFragment=AccountTimelineFragment.newInstance(accountID, account, GetAccountStatuses.Filter.MEDIA, false);
}
Bundle args=new Bundle(); if(pinnedPostsFragment==null){
args.putString("account", accountID);
args.putParcelable("profileAccount", Parcels.wrap(account));
args.putBoolean("__is_tab", true);
pinnedPostsFragment=new PinnedPostsListFragment(); pinnedPostsFragment=new PinnedPostsListFragment();
pinnedPostsFragment.setArguments(args); pinnedPostsFragment.setArguments(args);
setFields(fields);
} }
setFields(fields);
pager.getAdapter().notifyDataSetChanged(); pager.getAdapter().notifyDataSetChanged();
super.dataLoaded(); super.dataLoaded();
} }
@ -529,6 +541,21 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
}); });
} }
@Override
public void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
if(postsFragment==null)
return;
if(postsFragment.isAdded())
getChildFragmentManager().putFragment(outState, "posts", postsFragment);
if(postsWithRepliesFragment.isAdded())
getChildFragmentManager().putFragment(outState, "postsWithReplies", postsWithRepliesFragment);
if(mediaFragment.isAdded())
getChildFragmentManager().putFragment(outState, "media", mediaFragment);
if(pinnedPostsFragment.isAdded())
getChildFragmentManager().putFragment(outState, "pinnedPosts", pinnedPostsFragment);
}
@Override @Override
public void onConfigurationChanged(Configuration newConfig){ public void onConfigurationChanged(Configuration newConfig){
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);