From 238e1da14fbd8dc7bd8ec390d4b5b4797b702d02 Mon Sep 17 00:00:00 2001 From: David Luhmer Date: Sat, 28 Oct 2023 11:33:47 +0200 Subject: [PATCH] cleanup Signed-off-by: David Luhmer --- .../NewsDetailActivity.java | 1 - .../NewsReaderListActivity.java | 41 ++++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java index d07648a4e..310b3023f 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsDetailActivity.java @@ -427,7 +427,6 @@ public void updateActionBarIcons() { @Override public void onBackPressed() { - Log.v(TAG,"NewsDetailActivity onBackPressed() Called"); if (!handlePodcastBackPressed()) super.onBackPressed(); } diff --git a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java index f46d5365d..35cb98b67 100644 --- a/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java +++ b/News-Android-App/src/main/java/de/luhmer/owncloudnewsreader/NewsReaderListActivity.java @@ -149,26 +149,6 @@ public class NewsReaderListActivity extends PodcastFragmentActivity implements @VisibleForTesting(otherwise = PROTECTED) public ActivityNewsreaderBinding binding; - OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) { - // we need to handle two cases: - // - The user has the "Open Sidebar on Backpress" option enabled - // - the callback need to be set because we want to close the podcast pane on back navigation (in case it's open) - // - set callback will be enabled/disabled based on whether the podcast pane is open/closed - // - The user has the "Open Sidebar on Backpress" option disabled - // - the callback needs to check first if the podcast is open - if so - close it and on - // the next back navigation open the sidebar - and then close the app - // - once the podcast pane is open - the callback will be disabled - // - the event listener (onDrawerClosed) will enable the back pressed callback again - @Override - public void handleOnBackPressed() { - Log.d(TAG, "handleOnBackPressed() 1"); - if (!handlePodcastBackPressed()) { - Log.d(TAG, "handleOnBackPressed() 2"); - binding.drawerLayout.openDrawer(GravityCompat.START); - setEnabled(false); - } - } - }; //private ServiceConnection mConnection = null; @@ -292,6 +272,27 @@ public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState prev } }; + OnBackPressedCallback onBackPressedCallback = new OnBackPressedCallback(true) { + // we need to handle two cases: + // - The user has the "Open Sidebar on Backpress" option enabled + // - the callback need to be set because we want to close the podcast pane on back navigation (in case it's open) + // - set callback will be enabled/disabled based on whether the podcast pane is open/closed + // - The user has the "Open Sidebar on Backpress" option disabled + // - the callback needs to check first if the podcast is open - if so - close it and on + // the next back navigation open the sidebar - and then close the app + // - once the podcast pane is open - the callback will be disabled + // - the event listener (onDrawerClosed) will enable the back pressed callback again + @Override + public void handleOnBackPressed() { + Log.d(TAG, "handleOnBackPressed() 1"); + if (!handlePodcastBackPressed()) { + Log.d(TAG, "handleOnBackPressed() 2"); + binding.drawerLayout.openDrawer(GravityCompat.START); + setEnabled(false); + } + } + }; + @Override protected void onCreate(Bundle savedInstanceState) { ((NewsReaderApplication) getApplication()).getAppComponent().injectActivity(this);