diff --git a/src/org/keynote/godtools/android/SnuffyPWActivity.java b/src/org/keynote/godtools/android/SnuffyPWActivity.java index 55f9b84423..880e89ea94 100755 --- a/src/org/keynote/godtools/android/SnuffyPWActivity.java +++ b/src/org/keynote/godtools/android/SnuffyPWActivity.java @@ -6,6 +6,7 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; +import android.content.res.TypedArray; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Bundle; @@ -119,7 +120,7 @@ protected void onCreate(Bundle savedInstanceState) mConfigFileName = getIntent().getStringExtra("ConfigFileName"); mPackageStatus = getIntent().getStringExtra("Status"); // live = draft mPageLeft = getIntent().getIntExtra("PageLeft", 0); - mPageTop = getIntent().getIntExtra("PageTop", 0); + mPageTop = actionBarHeightWithFallback(); mPageWidth = getIntent().getIntExtra("PageWidth", 320); // set defaults but they will not be used mPageHeight = getIntent().getIntExtra("PageHeight", 480); // caller will always determine these and pass them in Log.i("ScreenSize", "Left = " + mPageLeft + ", Top = " + mPageTop + ", Width = " + mPageWidth + ", Height = " + mPageHeight); @@ -185,6 +186,19 @@ public void registrationFailed() } } + /* + * Falls back to the height passed in through the intent extra if no action bar is found. + */ + private int actionBarHeightWithFallback() + { + final TypedArray styledAttributes = getApplicationContext().getTheme().obtainStyledAttributes( + new int[] { android.R.attr.actionBarSize }); + final int actionBarSize = (int) styledAttributes.getDimension(0, 0); + + styledAttributes.recycle(); + return actionBarSize != 0 ? actionBarSize : getIntent().getIntExtra("PageTop", 0); + } + private void handleLanguagesWithAlternateFonts() { if (LanguagesNotSupportedByDefaultFont.contains(mAppLanguage))