Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix dialog sizing on devices with small (QVGA) screens.

This fixes dialog sizing on devices with small screens. In particular,
the bottom buttons will now be visible and no longer hang off the screen.
  • Loading branch information...
commit 5d44d0ce3df029356796bfce4e5356f1db76410a 1 parent c3ad0db
Jim Brusstar jimbru authored
Showing with 12 additions and 8 deletions.
  1. +12 −8 facebook/src/com/facebook/android/FbDialog.java
20 facebook/src/com/facebook/android/FbDialog.java
View
@@ -20,6 +20,7 @@
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Typeface;
@@ -41,8 +42,8 @@
public class FbDialog extends Dialog {
static final int FB_BLUE = 0xFF6D84B4;
- static final float[] DIMENSIONS_LANDSCAPE = {460, 260};
- static final float[] DIMENSIONS_PORTRAIT = {280, 420};
+ static final float[] DIMENSIONS_DIFF_LANDSCAPE = {20, 60};
+ static final float[] DIMENSIONS_DIFF_PORTRAIT = {40, 60};
static final FrameLayout.LayoutParams FILL =
new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
@@ -76,13 +77,16 @@ protected void onCreate(Bundle savedInstanceState) {
setUpTitle();
setUpWebView();
Display display = getWindow().getWindowManager().getDefaultDisplay();
- final float scale = getContext().getResources().getDisplayMetrics().density;
+ final float scale =
+ getContext().getResources().getDisplayMetrics().density;
+ int orientation =
+ getContext().getResources().getConfiguration().orientation;
float[] dimensions =
- (display.getWidth() < display.getHeight())
- ? DIMENSIONS_PORTRAIT : DIMENSIONS_LANDSCAPE;
- addContentView(mContent, new FrameLayout.LayoutParams(
- (int) (dimensions[0] * scale + 0.5f),
- (int) (dimensions[1] * scale + 0.5f)));
+ (orientation == Configuration.ORIENTATION_LANDSCAPE)
+ ? DIMENSIONS_DIFF_LANDSCAPE : DIMENSIONS_DIFF_PORTRAIT;
+ addContentView(mContent, new LinearLayout.LayoutParams(
+ display.getWidth() - ((int) (dimensions[0] * scale + 0.5f)),
+ display.getHeight() - ((int) (dimensions[1] * scale + 0.5f))));
}
private void setUpTitle() {
Please sign in to comment.
Something went wrong with that request. Please try again.