Fix for touch event on old view
This change removes the old view before
reattaching the new view to the fmraelayout
It helps in propogating events such as touch
event to the correct webview.
Change-Id: I19b3d2bc0a869f7dc2bbc353f50d9bf9f9740976
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index aad9492..089c7f0 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -424,8 +424,17 @@
// container to the content view.
FrameLayout wrapper =
(FrameLayout) container.findViewById(R.id.webview_wrapper);
- if (wrapper != mainView.getView().getParent())
+ ViewGroup parentView = (ViewGroup)mainView.getView().getParent();
+
+ if (wrapper != parentView) {
+ // clean up old view before attaching new view
+ // this helping in fixing issues such touch event
+ // getting triggered on old view instead of new one
+ if (parentView != null) {
+ parentView.removeView(mainView.getView());
+ }
wrapper.addView(mainView.getView());
+ }
ViewGroup parent = (ViewGroup) container.getParent();
if (parent != mContentView) {
if (parent != null) {