Browse Source

Fixed layout bug in full screen mode

master
Anthony Restaino 9 years ago
parent
commit
3e8f3b2702
  1. 5
      app/src/main/AndroidManifest.xml
  2. 49
      app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java
  3. 13
      app/src/main/res/layout/activity_main.xml

5
app/src/main/AndroidManifest.xml

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

49
app/src/main/java/acr/browser/lightning/activity/BrowserActivity.java

@ -128,32 +128,20 @@ import butterknife.ButterKnife; @@ -128,32 +128,20 @@ import butterknife.ButterKnife;
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";
// Static Layout
@Bind(R.id.drawer_layout)
DrawerLayout mDrawerLayout;
@Bind(R.id.content_frame)
FrameLayout mBrowserFrame;
@Bind(R.id.left_drawer)
ViewGroup mDrawerLeft;
@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;
@Bind(Window.ID_ANDROID_CONTENT) View mRoot;
@Bind(R.id.drawer_layout) DrawerLayout mDrawerLayout;
@Bind(R.id.content_frame) FrameLayout mBrowserFrame;
@Bind(R.id.left_drawer) ViewGroup mDrawerLeft;
@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
@ -231,7 +219,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -231,7 +219,6 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
abstract Observable<Void> updateCookiePreference();
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -257,6 +244,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -257,6 +244,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
mPresenter = new BrowserPresenter(this, isIncognito());
initialize();
}
private synchronized void initialize() {
@ -399,7 +387,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -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());
}
@ -1029,10 +1017,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -1029,10 +1017,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
return true;
}
@Override
public void onConfigurationChanged(final Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Log.d(TAG, "onConfigurationChanged");
if (mFullScreen) {
showActionBar();
mBrowserFrame.setTranslationY(0);
@ -1696,6 +1687,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -1696,6 +1687,7 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
Log.d(TAG, "onWindowFocusChanged");
if (hasFocus) {
setFullscreen(mIsFullScreen, mIsImmersive);
}
@ -1883,12 +1875,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements @@ -1883,12 +1875,13 @@ public abstract class BrowserActivity extends ThemableBrowserActivity implements
* laid out in order to set the correct height.
*/
private void setTabHeight() {
if (mUiLayout.getHeight() == 0) {
mUiLayout.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
if (mRoot.getHeight() == 0) {
mRoot.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED);
}
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 {
mBrowserFrame.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}

13
app/src/main/res/layout/activity_main.xml

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

Loading…
Cancel
Save