From 3af4d6b13990e746fe82c1ee43bb115818a7ab1b Mon Sep 17 00:00:00 2001 From: alunny Date: Fri, 30 Dec 2011 17:23:34 -0800 Subject: [PATCH] using preference=fullscreen for fullscreen view involves loading configuration before the layout is set up --- framework/src/com/phonegap/DroidGap.java | 25 +++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java index 2b92ef61..893471f8 100755 --- a/framework/src/com/phonegap/DroidGap.java +++ b/framework/src/com/phonegap/DroidGap.java @@ -319,13 +319,25 @@ public class DroidGap extends PhonegapActivity { public void onCreate(Bundle savedInstanceState) { preferences = new PreferenceSet(); + // Load PhoneGap configuration: + // white list of allowed URLs + // debug setting + this.loadConfiguration(); + LOG.d(TAG, "DroidGap.onCreate()"); super.onCreate(savedInstanceState); - getWindow().requestFeature(Window.FEATURE_NO_TITLE); - getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); - // This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket! + getWindow().requestFeature(Window.FEATURE_NO_TITLE); + + if (preferences.pref("fullscreen").equals("true")) { + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } else { + getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); + } + + // This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket! Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); @@ -335,11 +347,6 @@ public class DroidGap extends PhonegapActivity { root.setBackgroundColor(this.backgroundColor); root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT, 0.0F)); - - // Load PhoneGap configuration: - // white list of allowed URLs - // debug setting - this.loadConfiguration(); // If url was passed in to intent, then init webview, which will load the url Bundle bundle = this.getIntent().getExtras();