From 9ba07982bffce0fa20bce021813fe38ab27f4e47 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Wed, 8 Sep 2021 20:04:19 +0200 Subject: [PATCH] Don't reset group on back button press --- CHANGELOG.md | 1 + .../protect/card_locker/MainActivity.java | 25 ++++++------------- 2 files changed, 8 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e58df18c9..ebf069c4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Improved support for screen readers - Don't crash when trying to open a video from gallery - Swipe support on loyalty card view screen +- Don't reset group on back button press ## v2.4.0 - 81 (2021-08-29) diff --git a/app/src/main/java/protect/card_locker/MainActivity.java b/app/src/main/java/protect/card_locker/MainActivity.java index 1e9b95d36..73fd68e05 100644 --- a/app/src/main/java/protect/card_locker/MainActivity.java +++ b/app/src/main/java/protect/card_locker/MainActivity.java @@ -356,27 +356,16 @@ public class MainActivity extends CatimaAppCompatActivity implements LoyaltyCard @Override public void onBackPressed() { - if (mMenu == null) - { - super.onBackPressed(); - return; - } + if (mMenu != null) { + SearchView searchView = (SearchView) mMenu.findItem(R.id.action_search).getActionView(); - SearchView searchView = (SearchView) mMenu.findItem(R.id.action_search).getActionView(); - - if (!searchView.isIconified()) - { - searchView.setIconified(true); - } else { - TabLayout groupsTabLayout = findViewById(R.id.groups); - - if (groupsTabLayout.getVisibility() == View.VISIBLE && selectedTab != 0) { - selectedTab = 0; - groupsTabLayout.selectTab(groupsTabLayout.getTabAt(0)); - } else { - super.onBackPressed(); + if (!searchView.isIconified()) { + searchView.setIconified(true); + return; } } + + super.onBackPressed(); } private void updateLoyaltyCardList(String filterText, Object tag)