From 58f8a6a9293322db4b129ebaa81f62badcf08789 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Tue, 26 Jan 2021 22:39:01 +0100 Subject: [PATCH] Fix bottomsheet misplacing after fullscreen change --- CHANGELOG.md | 1 + .../card_locker/LoyaltyCardViewActivity.java | 9 ------ .../res/layout/loyalty_card_view_layout.xml | 15 +++++---- .../LoyaltyCardViewActivityTest.java | 32 +++++++++++++++++-- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1885518c4..83bc0c5ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ Changes: - Add support for scaling the barcode when moving to top to fit even more small scanners +- Fix bottom sheet jumping after switching to fullscreen ## v1.7.1 (2021-01-18) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index f40e4bb36..c856f66ea 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -378,8 +378,6 @@ public class LoyaltyCardViewActivity extends AppCompatActivity maximizeButton.setVisibility(View.GONE); barcodeImage.setVisibility(View.GONE); } - - Log.d(TAG, String.valueOf(bottomSheet.getTop())); } @Override @@ -545,7 +543,6 @@ public class LoyaltyCardViewActivity extends AppCompatActivity cardIdFieldView.setVisibility(View.GONE); bottomSheet.setVisibility(View.GONE); behavior.setState(BottomSheetBehavior.STATE_COLLAPSED); - Log.d(TAG, String.valueOf(bottomSheet.getTop())); editButton.hide(); // Set Android to fullscreen mode @@ -583,7 +580,6 @@ public class LoyaltyCardViewActivity extends AppCompatActivity // Show other UI elements cardIdFieldView.setVisibility(View.VISIBLE); makeBottomSheetVisibleIfUseful(); - Log.d(TAG, String.valueOf(bottomSheet.getTop())); editButton.show(); // Unset fullscreen mode @@ -593,11 +589,6 @@ public class LoyaltyCardViewActivity extends AppCompatActivity & ~View.SYSTEM_UI_FLAG_FULLSCREEN ); - // FIXME: Figure out why the bottom sheet gets paddingTop 24px sometimes - // For some reason bottom sheet can get a 24px padding top after we enter and then leave fullscreen mode - // No clue why - // Android library bug? - // Set current state barcodeIsFullscreen = false; } diff --git a/app/src/main/res/layout/loyalty_card_view_layout.xml b/app/src/main/res/layout/loyalty_card_view_layout.xml index d93c8d720..959faa2f9 100644 --- a/app/src/main/res/layout/loyalty_card_view_layout.xml +++ b/app/src/main/res/layout/loyalty_card_view_layout.xml @@ -6,8 +6,7 @@ android:id="@+id/coordinator_layout" android:layout_width="fill_parent" android:layout_height="fill_parent" - android:fitsSystemWindows="true" - > + android:fitsSystemWindows="true"> + tools:visibility="visible" + android:fitsSystemWindows="true">