Update geolocation prompt

 Bug: 4975201
 Cleanup and Holo'd

Change-Id: Ia4c31f411fa6fd2f3fd05ce92f4f4b8592cc3520
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index d364378..3ab0098 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -88,7 +88,6 @@
     private Drawable mMixLockIcon;
     protected Drawable mGenericFavicon;
 
-    private FrameLayout mBrowserFrameLayout;
     protected FrameLayout mContentView;
     protected FrameLayout mCustomViewContainer;
 
@@ -125,15 +124,14 @@
 
         FrameLayout frameLayout = (FrameLayout) mActivity.getWindow()
                 .getDecorView().findViewById(android.R.id.content);
-        mBrowserFrameLayout = (FrameLayout) LayoutInflater.from(mActivity)
-                .inflate(R.layout.custom_screen, null);
-        mContentView = (FrameLayout) mBrowserFrameLayout.findViewById(
+        LayoutInflater.from(mActivity)
+                .inflate(R.layout.custom_screen, frameLayout);
+        mContentView = (FrameLayout) frameLayout.findViewById(
                 R.id.main_content);
-        mErrorConsoleContainer = (LinearLayout) mBrowserFrameLayout
+        mErrorConsoleContainer = (LinearLayout) frameLayout
                 .findViewById(R.id.error_console);
-        mCustomViewContainer = (FrameLayout) mBrowserFrameLayout
+        mCustomViewContainer = (FrameLayout) frameLayout
                 .findViewById(R.id.fullscreen_custom_content);
-        frameLayout.addView(mBrowserFrameLayout, COVER_SCREEN_PARAMS);
         setFullscreen(BrowserSettings.getInstance().useFullscreen());
         mGenericFavicon = res.getDrawable(
                 R.drawable.app_web_browser_sm);
@@ -384,7 +382,7 @@
             // The tab consists of a container view, which contains the main
             // WebView, as well as any other UI elements associated with the tab.
             container = mActivity.getLayoutInflater().inflate(R.layout.tab,
-                    null);
+                    mContentView, false);
             tab.setViewContainer(container);
         }
         if (tab.getWebView() != webView) {
diff --git a/src/com/android/browser/GeolocationPermissionsPrompt.java b/src/com/android/browser/GeolocationPermissionsPrompt.java
index 95c5415..afbf39f 100755
--- a/src/com/android/browser/GeolocationPermissionsPrompt.java
+++ b/src/com/android/browser/GeolocationPermissionsPrompt.java
@@ -17,22 +17,18 @@
 package com.android.browser;
 
 import android.content.Context;
-import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.util.AttributeSet;
 import android.view.Gravity;
-import android.view.LayoutInflater;
 import android.view.View;
-import android.webkit.WebView;
 import android.webkit.GeolocationPermissions;
 import android.widget.Button;
 import android.widget.CheckBox;
-import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
-public class GeolocationPermissionsPrompt extends LinearLayout {
-    private LinearLayout mInner;
+public class GeolocationPermissionsPrompt extends RelativeLayout {
     private TextView mMessage;
     private Button mShareButton;
     private Button mDontShareButton;
@@ -48,22 +44,26 @@
         super(context, attrs);
     }
 
-    void init() {
-        mInner = (LinearLayout) findViewById(R.id.inner);
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        init();
+    }
+
+    private void init() {
         mMessage = (TextView) findViewById(R.id.message);
         mShareButton = (Button) findViewById(R.id.share_button);
         mDontShareButton = (Button) findViewById(R.id.dont_share_button);
         mRemember = (CheckBox) findViewById(R.id.remember);
 
-        final GeolocationPermissionsPrompt me = this;
         mShareButton.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
-                me.handleButtonClick(true);
+                handleButtonClick(true);
             }
         });
         mDontShareButton.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {
-                me.handleButtonClick(false);
+                handleButtonClick(false);
             }
         });
     }
@@ -79,21 +79,21 @@
         setMessage("http".equals(uri.getScheme()) ?  mOrigin.substring(7) : mOrigin);
         // The checkbox should always be intially checked.
         mRemember.setChecked(true);
-        showDialog(true);
+        setVisibility(View.VISIBLE);
     }
 
     /**
      * Hides the prompt.
      */
     public void hide() {
-        showDialog(false);
+        setVisibility(View.GONE);
     }
 
     /**
      * Handles a click on one the buttons by invoking the callback.
      */
     private void handleButtonClick(boolean allow) {
-        showDialog(false);
+        hide();
 
         boolean remember = mRemember.isChecked();
         if (remember) {
@@ -117,11 +117,4 @@
             getResources().getString(R.string.geolocation_permissions_prompt_message),
             origin));
     }
-
-    /**
-     * Shows or hides the prompt.
-     */
-    private void showDialog(boolean shown) {
-        mInner.setVisibility(shown ? View.VISIBLE : View.GONE);
-    }
 }
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index e672e2b..a705c07 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -1654,7 +1654,6 @@
                     .findViewById(R.id.geolocation_permissions_prompt);
             mGeolocationPermissionsPrompt = (GeolocationPermissionsPrompt) stub
                     .inflate();
-            mGeolocationPermissionsPrompt.init();
         }
         return mGeolocationPermissionsPrompt;
     }