From c13706b60d4486fbd562ac727da491e94936a37e Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 11 Sep 2024 22:23:07 -0500 Subject: [PATCH] Save filter state across rotation (cherry picked from commit 791358b2fd92eee4c53c61e0826535537382f105) --- .../eu/siacs/conversations/ui/ConversationsActivity.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index d1bb927e3f..1582384913 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -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);