mirror of
https://codeberg.org/monocles/monocles_chat.git
synced 2025-01-30 00:39:59 +01:00
Save filter state across rotation
(cherry picked from commit 791358b2fd92eee4c53c61e0826535537382f105)
This commit is contained in:
parent
7f6a2e7622
commit
c13706b60d
1 changed files with 7 additions and 1 deletions
|
@ -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.model.interfaces.IconableKt.setIconRes(settings, R.drawable.ic_settings_24dp);
|
||||||
com.mikepenz.materialdrawer.util.MaterialDrawerSliderViewExtensionsKt.addStickyDrawerItems(binding.drawer, settings);
|
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();
|
refreshUiReal();
|
||||||
if (useSavedState != null) binding.drawer.setSavedInstance(useSavedState);
|
if (useSavedState != null) binding.drawer.setSavedInstance(useSavedState);
|
||||||
accountHeader.attachToSliderView(binding.drawer);
|
accountHeader.attachToSliderView(binding.drawer);
|
||||||
if (useSavedState != null) accountHeader.withSavedInstance(useSavedState);
|
if (useSavedState != null) accountHeader.withSavedInstance(useSavedState);
|
||||||
|
|
||||||
if (binding.drawer.getSelectedItemPosition() < 1) {
|
if (mainFilter == DRAWER_ALL_CHATS && selectedTag == null) {
|
||||||
binding.drawer.setSelectedItemIdentifier(DRAWER_ALL_CHATS);
|
binding.drawer.setSelectedItemIdentifier(DRAWER_ALL_CHATS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1066,6 +1070,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
||||||
public void onSaveInstanceState(Bundle savedInstanceState) {
|
public void onSaveInstanceState(Bundle savedInstanceState) {
|
||||||
final Intent pendingIntent = pendingViewIntent.peek();
|
final Intent pendingIntent = pendingViewIntent.peek();
|
||||||
savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
|
savedInstanceState.putParcelable("intent", pendingIntent != null ? pendingIntent : getIntent());
|
||||||
|
savedInstanceState.putLong("mainFilter", mainFilter);
|
||||||
|
savedInstanceState.putSerializable("selectedTag", selectedTag);
|
||||||
savedInstanceState = binding.drawer.saveInstanceState(savedInstanceState);
|
savedInstanceState = binding.drawer.saveInstanceState(savedInstanceState);
|
||||||
savedInstanceState = accountHeader.saveInstanceState(savedInstanceState);
|
savedInstanceState = accountHeader.saveInstanceState(savedInstanceState);
|
||||||
super.onSaveInstanceState(savedInstanceState);
|
super.onSaveInstanceState(savedInstanceState);
|
||||||
|
|
Loading…
Add table
Reference in a new issue