Fixed layout bug in full screen mode

This commit is contained in:
Anthony Restaino 2016-03-14 23:31:53 -04:00
parent 8bcb3668c0
commit 3e8f3b2702
3 changed files with 31 additions and 36 deletions

View File

@ -34,7 +34,8 @@
android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:configChanges="orientation|screenSize|keyboardHidden|keyboard"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@style/Theme.LightTheme"> android:theme="@style/Theme.LightTheme"
android:windowSoftInputMode="adjustResize|adjustPan">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN"/> <action android:name="android.intent.action.MAIN"/>
@ -150,4 +151,4 @@
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -128,32 +128,20 @@ import butterknife.ButterKnife;
public abstract class BrowserActivity extends ThemableBrowserActivity implements BrowserView, UIController, OnClickListener, OnLongClickListener { public abstract class BrowserActivity extends ThemableBrowserActivity implements BrowserView, UIController, OnClickListener, OnLongClickListener {
private static final String TAG = BrowserActivity.class.getSimpleName();
private static final String INTENT_PANIC_TRIGGER = "info.guardianproject.panic.action.TRIGGER"; private static final String INTENT_PANIC_TRIGGER = "info.guardianproject.panic.action.TRIGGER";
// Static Layout // Static Layout
@Bind(R.id.drawer_layout) @Bind(Window.ID_ANDROID_CONTENT) View mRoot;
DrawerLayout mDrawerLayout; @Bind(R.id.drawer_layout) DrawerLayout mDrawerLayout;
@Bind(R.id.content_frame) FrameLayout mBrowserFrame;
@Bind(R.id.content_frame) @Bind(R.id.left_drawer) ViewGroup mDrawerLeft;
FrameLayout mBrowserFrame; @Bind(R.id.right_drawer) ViewGroup mDrawerRight;
@Bind(R.id.ui_layout) ViewGroup mUiLayout;
@Bind(R.id.left_drawer) @Bind(R.id.toolbar_layout) ViewGroup mToolbarLayout;
ViewGroup mDrawerLeft; @Bind(R.id.progress_view) AnimatedProgressBar mProgressBar;
@Bind(R.id.search_bar) RelativeLayout mSearchBar;
@Bind(R.id.right_drawer)
ViewGroup mDrawerRight;
@Bind(R.id.ui_layout)
ViewGroup mUiLayout;
@Bind(R.id.toolbar_layout)
ViewGroup mToolbarLayout;
@Bind(R.id.progress_view)
AnimatedProgressBar mProgressBar;
@Bind(R.id.search_bar)
RelativeLayout mSearchBar;
// Toolbar Views // Toolbar Views
@ -231,7 +219,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
abstract Observable<Void> updateCookiePreference(); abstract Observable<Void> updateCookiePreference();
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -257,6 +244,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
mPresenter = new BrowserPresenter(this, isIncognito()); mPresenter = new BrowserPresenter(this, isIncognito());
initialize(); initialize();
} }
private synchronized void initialize() { private synchronized void initialize() {
@ -399,7 +387,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
} }
} }
boolean isPanicTrigger(Intent intent) { static boolean isPanicTrigger(@Nullable Intent intent) {
return intent != null && INTENT_PANIC_TRIGGER.equals(intent.getAction()); return intent != null && INTENT_PANIC_TRIGGER.equals(intent.getAction());
} }
@ -1029,10 +1017,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
return true; return true;
} }
@Override @Override
public void onConfigurationChanged(final Configuration newConfig) { public void onConfigurationChanged(final Configuration newConfig) {
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
Log.d(TAG, "onConfigurationChanged");
if (mFullScreen) { if (mFullScreen) {
showActionBar(); showActionBar();
mBrowserFrame.setTranslationY(0); mBrowserFrame.setTranslationY(0);
@ -1696,6 +1687,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
@Override @Override
public void onWindowFocusChanged(boolean hasFocus) { public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus); super.onWindowFocusChanged(hasFocus);
Log.d(TAG, "onWindowFocusChanged");
if (hasFocus) { if (hasFocus) {
setFullscreen(mIsFullScreen, mIsImmersive); setFullscreen(mIsFullScreen, mIsImmersive);
} }
@ -1883,12 +1875,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
* laid out in order to set the correct height. * laid out in order to set the correct height.
*/ */
private void setTabHeight() { private void setTabHeight() {
if (mUiLayout.getHeight() == 0) { if (mRoot.getHeight() == 0) {
mUiLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED); mRoot.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
} }
if (mFullScreen) { if (mFullScreen) {
mBrowserFrame.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, mUiLayout.getHeight())); int height = mRoot.getHeight() - mUiLayout.getTop();
mBrowserFrame.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, height));
} else { } else {
mBrowserFrame.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); mBrowserFrame.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
} }

View File

@ -1,10 +1,11 @@
<!-- Copyright 2014 ACR Development --> <!-- Copyright 2014 ACR Development -->
<LinearLayout android:id="@+id/main_layout" <LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/main_layout"
android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent" android:layout_width="match_parent"
android:background="@null" android:layout_height="match_parent"
android:orientation="vertical"> android:background="@null"
android:orientation="vertical">
<android.support.v4.widget.DrawerLayout <android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout" android:id="@+id/drawer_layout"