1
0
Fork 1

Save filter state across rotation

(cherry picked from commit 791358b2fd92eee4c53c61e0826535537382f105)
This commit is contained in:
Stephen Paul Weber 2024-09-11 22:23:07 -05:00 committed by Arne
parent bf467f16be
commit 3db5211231

View file

@ -368,12 +368,16 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
com.mikepenz.materialdrawer.model.interfaces.IconableKt.setIconRes(settings, R.drawable.ic_settings_24dp);
com.mikepenz.materialdrawer.util.MaterialDrawerSliderViewExtensionsKt.addStickyDrawerItems(binding.drawer, settings);
if (useSavedState != null) {
mainFilter = useSavedState.getLong("mainFilter", DRAWER_ALL_CHATS);
selectedTag = (Tag) useSavedState.getSerializable("selectedTag");
}
refreshUiReal();
if (useSavedState != null) binding.drawer.setSavedInstance(useSavedState);
accountHeader.attachToSliderView(binding.drawer);
if (useSavedState != null) accountHeader.withSavedInstance(useSavedState);
if (binding.drawer.getSelectedItemPosition() < 1) {
if (mainFilter == DRAWER_ALL_CHATS && selectedTag == null) {
binding.drawer.setSelectedItemIdentifier(DRAWER_ALL_CHATS);
}
@ -1066,6 +1070,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
public void onSaveInstanceState(Bundle savedInstanceState) {
final Intent pendingIntent = pendingViewIntent.peek();
savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
savedInstanceState.putLong("mainFilter", mainFilter);
savedInstanceState.putSerializable("selectedTag", selectedTag);
savedInstanceState = binding.drawer.saveInstanceState(savedInstanceState);
savedInstanceState = accountHeader.saveInstanceState(savedInstanceState);
super.onSaveInstanceState(savedInstanceState);