From 32b417895072c6bff38fc748fbc1081ab6cc2a9d Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Fri, 27 Dec 2019 17:40:12 +0100 Subject: [PATCH] Fix some warnings --- .../card_locker/LoyaltyCardViewActivity.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java index 12340315e..ea889a161 100644 --- a/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java +++ b/app/src/main/java/protect/card_locker/LoyaltyCardViewActivity.java @@ -197,8 +197,14 @@ public class LoyaltyCardViewActivity extends AppCompatActivity } // Make notification area light if dark icons are needed - window.getDecorView().setSystemUiVisibility(backgroundNeedsDarkIcons ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0); - window.setStatusBarColor(Color.TRANSPARENT); + if(Build.VERSION.SDK_INT >= 23) + { + window.getDecorView().setSystemUiVisibility(backgroundNeedsDarkIcons ? View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR : 0); + } + if(Build.VERSION.SDK_INT >= 21) + { + window.setStatusBarColor(Color.TRANSPARENT); + } // Set shadow colour of store text so even same color on same color would be readable storeName.setShadowLayer(1, 1, 1, backgroundNeedsDarkIcons ? Color.BLACK : Color.WHITE); @@ -217,14 +223,7 @@ public class LoyaltyCardViewActivity extends AppCompatActivity @Override public void onGlobalLayout() { - if (Build.VERSION.SDK_INT < 16) - { - barcodeImage.getViewTreeObserver().removeGlobalOnLayoutListener(this); - } - else - { - barcodeImage.getViewTreeObserver().removeOnGlobalLayoutListener(this); - } + barcodeImage.getViewTreeObserver().removeOnGlobalLayoutListener(this); Log.d(TAG, "ImageView size now known"); new BarcodeImageWriterTask(barcodeImage, cardIdString, format).execute();