Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/Pretz/facebook-android-sdk

  • Loading branch information...
commit eb9cd3fbd4e5638cab9fedf978e7f555ba69a8ee 2 parents 11ab89f + 4d6d0f0
Steven Soneff authored
Showing with 13 additions and 10 deletions.
  1. +13 −10 facebook/src/com/facebook/android/FbDialog.java
View
23 facebook/src/com/facebook/android/FbDialog.java
@@ -16,8 +16,6 @@
package com.facebook.android;
-import com.facebook.android.Facebook.DialogListener;
-
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
@@ -34,17 +32,19 @@
import android.view.Window;
import android.webkit.WebView;
import android.webkit.WebViewClient;
+import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
-import android.widget.FrameLayout.LayoutParams;
+
+import com.facebook.android.Facebook.DialogListener;
public class FbDialog extends Dialog {
static final int FB_BLUE = 0xFF6D84B4;
- static final LayoutParams DEFAULT_LANDSCAPE = new LayoutParams(460, 260);
- static final LayoutParams DEFAULT_PORTRAIT = new LayoutParams(280, 420);
- static final LayoutParams FILL =
- new LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
+ static final float[] DIMENSIONS_LANDSCAPE = {460, 260};
+ static final float[] DIMENSIONS_PORTRAIT = {280, 420};
+ static final FrameLayout.LayoutParams FILL =
+ new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
static final int MARGIN = 4;
static final int PADDING = 2;
@@ -57,7 +57,7 @@
private WebView mWebView;
private LinearLayout mContent;
private TextView mTitle;
-
+
public FbDialog(Context context, String url, DialogListener listener) {
super(context);
mUrl = url;
@@ -76,8 +76,11 @@ protected void onCreate(Bundle savedInstanceState) {
setUpTitle();
setUpWebView();
Display display = getWindow().getWindowManager().getDefaultDisplay();
- addContentView(mContent, display.getWidth() < display.getHeight() ?
- DEFAULT_PORTRAIT : DEFAULT_LANDSCAPE);
+ final float scale = getContext().getResources().getDisplayMetrics().density;
+ 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)));
}
private void setUpTitle() {
Please sign in to comment.
Something went wrong with that request. Please try again.