Skip to content

Commit 27d4fdf

Browse files
author
shebyimran@gmail.com
committed
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
1 parent 95d7542 commit 27d4fdf

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

app/src/main/java/fr/gaulupeau/apps/Poche/ui/ReadArticleActivity.java

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -145,23 +145,10 @@ public class ReadArticleActivity extends BaseActionBarActivity {
145145
private boolean onPageFinishedCallPostponedUntilResume;
146146
private boolean loadingFinished;
147147

148-
private ActionBar actionBar;
149148
private boolean isFullscreen;
150149
private View decorView;
151150

152151
public void onCreate(Bundle savedInstanceState) {
153-
// Grab the action bar and decorView for making reading view fullscreen
154-
actionBar = super.getSupportActionBar();
155-
decorView = getWindow().getDecorView();
156-
isFullscreen = false;
157-
158-
// Toggle stable and fullscreen layout flags so everything is overlaid by the
159-
// actionbar AND the status bar when article is opened
160-
decorView.setSystemUiVisibility(
161-
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
162-
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
163-
);
164-
165152

166153
settings = App.getInstance().getSettings();
167154

@@ -171,7 +158,7 @@ public void onCreate(Bundle savedInstanceState) {
171158
WindowManager.LayoutParams.FLAG_FULLSCREEN,
172159
WindowManager.LayoutParams.FLAG_FULLSCREEN
173160
);
174-
161+
ActionBar actionBar = super.getSupportActionBar();
175162
if(actionBar != null) actionBar.hide();
176163
}
177164

@@ -216,10 +203,22 @@ public void onCreate(Bundle savedInstanceState) {
216203
// article is loaded - update menu
217204
invalidateOptionsMenu();
218205

206+
// Grab the action bar and decorView for making reading view fullscreen
207+
decorView = getWindow().getDecorView();
208+
isFullscreen = false;
209+
210+
// Toggle stable and fullscreen layout flags so everything is overlaid by the
211+
// actionbar AND the status bar when article is opened
212+
decorView.setSystemUiVisibility(
213+
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
214+
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
215+
);
216+
217+
219218
scrollView = (ScrollView)findViewById(R.id.scroll);
220219

221-
// Hide status and action bar when scrolling down, show when scrolling up
222-
// TODO: change to a method compatible with API 14.
220+
// // Hide status and action bar when scrolling down, show when scrolling up
221+
// // TODO: change to a method compatible with API 14.
223222
if (Build.VERSION.SDK_INT >= 23 && settings.isAutoFullscreenArticleView()) {
224223
scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener(){
225224
@Override
@@ -522,14 +521,12 @@ private boolean goFullscreen(boolean gofs) {
522521
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
523522
| View.SYSTEM_UI_FLAG_FULLSCREEN
524523
);
525-
actionBar.hide();
526524
return true;
527525
} else {
528526
decorView.setSystemUiVisibility(
529527
View.SYSTEM_UI_FLAG_LAYOUT_STABLE
530528
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
531529
);
532-
actionBar.show();
533530
return false;
534531
}
535532
}

0 commit comments

Comments
 (0)