Permalink
Browse files

Merge remote-tracking branch 'martinlong1978/viewnotattached'

  • Loading branch information...
aleb committed Apr 3, 2012
2 parents 70fe1cd + 838d2c0 commit cb7562458a6a8d2c60f1aaf704c6c41220d1e5f0
Showing with 20 additions and 2 deletions.
  1. +20 −2 facebook/src/com/facebook/android/FbDialog.java
@@ -58,13 +58,27 @@
private WebView mWebView;
private FrameLayout mContent;
+ private boolean detached = false;
+
public FbDialog(Context context, String url, DialogListener listener) {
super(context, android.R.style.Theme_Translucent_NoTitleBar);
mUrl = url;
mListener = listener;
}
@Override
+ public void onDetachedFromWindow() {
+ detached = true;
+ super.onDetachedFromWindow();
+ }
+
+ @Override
+ public void dismiss() {
+ if (!detached) {
+ super.dismiss();
+ }
+ }
+
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mSpinner = new ProgressDialog(getContext());
@@ -177,13 +191,17 @@ public void onReceivedError(WebView view, int errorCode,
public void onPageStarted(WebView view, String url, Bitmap favicon) {
Util.logd("Facebook-WebView", "Webview loading URL: " + url);
super.onPageStarted(view, url, favicon);
- mSpinner.show();
+ if (!detached) {
+ mSpinner.show();
+ }
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
- mSpinner.dismiss();
+ if (!detached) {
+ mSpinner.dismiss();
+ }
/*
* Once webview is fully loaded, set the mContent background to be transparent
* and make visible the 'x' image.

0 comments on commit cb75624

Please sign in to comment.