From 27d4fdfcd69f0243762d559c14c070a73d8560a8 Mon Sep 17 00:00:00 2001 From: "shebyimran@gmail.com" Date: Mon, 1 Oct 2018 14:48:04 +1000 Subject: [PATCH] fixed actionbar colour issue - was getting decorview before the activity was loaded. Removed the actionBar.hide() and show() calls, un-neccessary with the decorView stuff --- .../apps/Poche/ui/ReadArticleActivity.java | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java index ec7efd7a9..3cabcd362 100644 --- a/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java +++ b/app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java @@ -145,23 +145,10 @@ public class ReadArticleActivity extends BaseActionBarActivity { private boolean onPageFinishedCallPostponedUntilResume; private boolean loadingFinished; - private ActionBar actionBar; private boolean isFullscreen; private View decorView; public void onCreate(Bundle savedInstanceState) { - // Grab the action bar and decorView for making reading view fullscreen - actionBar = super.getSupportActionBar(); - decorView = getWindow().getDecorView(); - isFullscreen = false; - - // Toggle stable and fullscreen layout flags so everything is overlaid by the - // actionbar AND the status bar when article is opened - decorView.setSystemUiVisibility( - View.SYSTEM_UI_FLAG_LAYOUT_STABLE - | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN - ); - settings = App.getInstance().getSettings(); @@ -171,7 +158,7 @@ public void onCreate(Bundle savedInstanceState) { WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN ); - + ActionBar actionBar = super.getSupportActionBar(); if(actionBar != null) actionBar.hide(); } @@ -216,10 +203,22 @@ public void onCreate(Bundle savedInstanceState) { // article is loaded - update menu invalidateOptionsMenu(); + // Grab the action bar and decorView for making reading view fullscreen + decorView = getWindow().getDecorView(); + isFullscreen = false; + + // Toggle stable and fullscreen layout flags so everything is overlaid by the + // actionbar AND the status bar when article is opened + decorView.setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + ); + + scrollView = (ScrollView)findViewById(R.id.scroll); - // Hide status and action bar when scrolling down, show when scrolling up - // TODO: change to a method compatible with API 14. +// // Hide status and action bar when scrolling down, show when scrolling up +// // TODO: change to a method compatible with API 14. if (Build.VERSION.SDK_INT >= 23 && settings.isAutoFullscreenArticleView()) { scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener(){ @Override @@ -522,14 +521,12 @@ private boolean goFullscreen(boolean gofs) { | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN ); - actionBar.hide(); return true; } else { decorView.setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ); - actionBar.show(); return false; } }