diff options
author | John Reck <jreck@google.com> | 2011-06-30 13:25:37 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-06-30 13:25:37 -0700 |
commit | 8f5dcaa7299e9e795ef5ab1e24b716b0ec58c512 (patch) | |
tree | 1f9cad7799c8bab2defa7c0b8723ed50adbb3a23 | |
parent | e45587844efeb521540a5d36cb6d4ead51f44ceb (diff) | |
parent | 7c6e1c928ea078034e7eacf32ef5c209138001d9 (diff) | |
download | packages_apps_browser-8f5dcaa7299e9e795ef5ab1e24b716b0ec58c512.zip packages_apps_browser-8f5dcaa7299e9e795ef5ab1e24b716b0ec58c512.tar.gz packages_apps_browser-8f5dcaa7299e9e795ef5ab1e24b716b0ec58c512.tar.bz2 |
Merge "Update geolocation prompt"
-rw-r--r-- | res/drawable-hdpi/geolocation_permissions_prompt_background.9.png | bin | 0 -> 394 bytes | |||
-rw-r--r-- | res/layout/custom_screen.xml | 5 | ||||
-rwxr-xr-x | res/layout/geolocation_permissions_prompt.xml | 111 | ||||
-rw-r--r-- | res/values/colors.xml | 2 | ||||
-rw-r--r-- | src/com/android/browser/BaseUi.java | 14 | ||||
-rwxr-xr-x | src/com/android/browser/GeolocationPermissionsPrompt.java | 35 | ||||
-rw-r--r-- | src/com/android/browser/Tab.java | 1 |
7 files changed, 75 insertions, 93 deletions
diff --git a/res/drawable-hdpi/geolocation_permissions_prompt_background.9.png b/res/drawable-hdpi/geolocation_permissions_prompt_background.9.png Binary files differnew file mode 100644 index 0000000..44a2e2f --- /dev/null +++ b/res/drawable-hdpi/geolocation_permissions_prompt_background.9.png diff --git a/res/layout/custom_screen.xml b/res/layout/custom_screen.xml index 2105501..7a22530 100644 --- a/res/layout/custom_screen.xml +++ b/res/layout/custom_screen.xml @@ -14,7 +14,8 @@ limitations under the License. --> -<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"> +<merge + xmlns:android="http://schemas.android.com/apk/res/android"> <FrameLayout android:id="@+id/fullscreen_custom_content" android:visibility="gone" android:background="@color/black" @@ -36,5 +37,5 @@ android:layout_height="match_parent" /> </LinearLayout> -</FrameLayout> +</merge> diff --git a/res/layout/geolocation_permissions_prompt.xml b/res/layout/geolocation_permissions_prompt.xml index babde3a..1920c05 100755 --- a/res/layout/geolocation_permissions_prompt.xml +++ b/res/layout/geolocation_permissions_prompt.xml @@ -18,74 +18,67 @@ <com.android.browser.GeolocationPermissionsPrompt xmlns:android="http://schemas.android.com/apk/res/android" - android:fitsSystemWindows="true" android:layout_width="match_parent" - android:layout_height="wrap_content"> + android:layout_height="wrap_content" + android:background="@drawable/geolocation_permissions_prompt_background" + android:visibility="gone"> - <!-- Use an inner element as we can't show a hidden outermost element --> - <LinearLayout android:id="@+id/inner" - android:orientation="vertical" + <!-- 'google.com wants to know your location' --> + <TextView android:id="@+id/message" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@color/black" - android:paddingTop="1px" - android:visibility="gone"> + android:singleLine="true" + android:scrollHorizontally="true" + android:padding="6dip" + android:textAppearance="?android:attr/textAppearanceSmall" /> - <!-- White line --> - <View - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="1px" - android:background="@color/white" /> + <CheckBox android:id="@+id/remember" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/message" + android:layout_alignLeft="@id/message" /> + <TextView + android:paddingLeft="4dip" + android:text="@string/geolocation_permissions_prompt_remember" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textAppearance="?android:attr/textAppearanceSmall" + android:layout_alignBaseline="@id/remember" + android:layout_toRightOf="@id/remember" /> - <!-- Container for content --> + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_below="@id/remember" + android:orientation="vertical" + android:divider="?android:attr/dividerHorizontal" + android:showDividers="beginning" + android:dividerPadding="16dip" + android:background="@null"> <LinearLayout - android:orientation="vertical" + style="?android:attr/buttonBarStyle" android:layout_width="match_parent" - android:layout_height="match_parent" - android:background="@color/geolocation_permissions_prompt_background" - android:padding="6dip"> - - <!-- 'google.com wants to know your location' --> - <TextView android:id="@+id/message" - android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:paddingLeft="2dip" + android:paddingRight="2dip" + android:measureWithLargestChild="true" + android:background="@null"> + <Button + android:id="@+id/dont_share_button" + style="?android:attr/buttonBarButtonStyle" + android:layout_weight="1" + android:layout_width="0dip" android:layout_height="wrap_content" - android:textSize="14dip" - android:textColor="@color/black" /> - - <!-- Checkbox --> - <LinearLayout - android:orientation="horizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <CheckBox android:id="@+id/remember" - android:layout_width="wrap_content" - android:layout_height="wrap_content" /> - <TextView - android:paddingLeft="4dip" - android:text="@string/geolocation_permissions_prompt_remember" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:textSize="14dip" - android:textColor="@color/black" /> - </LinearLayout> - - <!-- Buttons --> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content"> - <Button android:id="@+id/share_button" - android:text="@string/geolocation_permissions_prompt_share" - android:layout_weight="1" - android:layout_width="0dip" - android:layout_height="wrap_content" /> - <Button android:id="@+id/dont_share_button" - android:text="@string/geolocation_permissions_prompt_dont_share" - android:layout_weight="1" - android:layout_width="0dip" - android:layout_height="wrap_content" /> - </LinearLayout> - + android:text="@string/geolocation_permissions_prompt_dont_share" /> + <Button + android:id="@+id/share_button" + style="?android:attr/buttonBarButtonStyle" + android:layout_weight="1" + android:layout_width="0dip" + android:layout_height="wrap_content" + android:text="@string/geolocation_permissions_prompt_share" /> </LinearLayout> </LinearLayout> + </com.android.browser.GeolocationPermissionsPrompt> diff --git a/res/values/colors.xml b/res/values/colors.xml index 322a80a..4ab971f 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -23,8 +23,6 @@ <color name="white">#ffffffff</color> <color name="black">#ff000000</color> - <color name="geolocation_permissions_prompt_background">#ffdddddd</color> - <color name="bookmarkWidgetHeader">#383847</color> <color name="bookmarkWidgetDivider">#383847</color> <color name="bookmarkWidgetItemBackground">#2b2b3c</color> 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 @@ public abstract class BaseUi implements UI, WebViewFactory, OnTouchListener { private Drawable mMixLockIcon; protected Drawable mGenericFavicon; - private FrameLayout mBrowserFrameLayout; protected FrameLayout mContentView; protected FrameLayout mCustomViewContainer; @@ -125,15 +124,14 @@ public abstract class BaseUi implements UI, WebViewFactory, OnTouchListener { 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 @@ public abstract class BaseUi implements UI, WebViewFactory, OnTouchListener { // 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 @@ public class GeolocationPermissionsPrompt extends LinearLayout { 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 @@ public class GeolocationPermissionsPrompt extends LinearLayout { 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 @@ public class GeolocationPermissionsPrompt extends LinearLayout { 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 @@ class Tab { .findViewById(R.id.geolocation_permissions_prompt); mGeolocationPermissionsPrompt = (GeolocationPermissionsPrompt) stub .inflate(); - mGeolocationPermissionsPrompt.init(); } return mGeolocationPermissionsPrompt; } |