am a57632fe: Fix bugs around removing and attaching WebViews.

Merge commit 'a57632fee792d6078a7a61006f5a866c38addd33' into eclair-mr2-plus-aosp

* commit 'a57632fee792d6078a7a61006f5a866c38addd33':
  Fix bugs around removing and attaching WebViews.
This commit is contained in:
Leon Scroggins
2009-11-16 14:37:58 -08:00
committed by Android Git Automerger
2 changed files with 15 additions and 21 deletions

View File

@@ -178749,7 +178749,7 @@
synchronized="false" synchronized="false"
static="false" static="false"
final="false" final="false"
deprecated="not deprecated" deprecated="deprecated"
visibility="public" visibility="public"
> >
<parameter name="parent" type="android.view.View"> <parameter name="parent" type="android.view.View">
@@ -178764,7 +178764,7 @@
synchronized="false" synchronized="false"
static="false" static="false"
final="false" final="false"
deprecated="not deprecated" deprecated="deprecated"
visibility="public" visibility="public"
> >
<parameter name="p" type="android.view.View"> <parameter name="p" type="android.view.View">

View File

@@ -3572,39 +3572,33 @@ public class WebView extends AbsoluteLayout
return copiedSomething; return copiedSomething;
} }
// Set this as a hierarchy change listener so we can know when this view
// is removed and still have access to our parent.
@Override @Override
protected void onAttachedToWindow() { protected void onAttachedToWindow() {
super.onAttachedToWindow(); super.onAttachedToWindow();
ViewParent parent = getParent(); if (hasWindowFocus()) onWindowFocusChanged(true);
if (parent instanceof ViewGroup) {
ViewGroup p = (ViewGroup) parent;
p.setOnHierarchyChangeListener(this);
}
} }
@Override @Override
protected void onDetachedFromWindow() { protected void onDetachedFromWindow() {
clearTextEntry();
super.onDetachedFromWindow(); super.onDetachedFromWindow();
ViewParent parent = getParent();
if (parent instanceof ViewGroup) {
ViewGroup p = (ViewGroup) parent;
p.setOnHierarchyChangeListener(null);
}
// Clean up the zoom controller // Clean up the zoom controller
mZoomButtonsController.setVisible(false); mZoomButtonsController.setVisible(false);
} }
// Implementation for OnHierarchyChangeListener /**
* @deprecated WebView no longer needs to implement
* ViewGroup.OnHierarchyChangeListener. This method does nothing now.
*/
@Deprecated
public void onChildViewAdded(View parent, View child) {} public void onChildViewAdded(View parent, View child) {}
public void onChildViewRemoved(View p, View child) { /**
if (child == this) { * @deprecated WebView no longer needs to implement
clearTextEntry(); * ViewGroup.OnHierarchyChangeListener. This method does nothing now.
} */
} @Deprecated
public void onChildViewRemoved(View p, View child) {}
/** /**
* @deprecated WebView should not have implemented * @deprecated WebView should not have implemented