Merge "Import revised translations." into honeycomb
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 9ceaf82..1dc53f6 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -189,9 +189,9 @@
android:configChanges="orientation|keyboardHidden" android:windowSoftInputMode="stateHidden">
</activity>
- <!-- Bookmark list homescreen widget -->
+ <!-- Bookmark thumbnail homescreen widget -->
<receiver
- android:name=".widget.BookmarkListWidgetProvider"
+ android:name=".widget.BookmarkThumbnailWidgetProvider"
android:label="@string/bookmarks">
<intent-filter>
<action
@@ -201,10 +201,10 @@
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
- android:resource="@xml/bookmarklistwidget_info" />
+ android:resource="@xml/bookmarkthumbnailwidget_info" />
</receiver>
<service
- android:name=".widget.BookmarkListWidgetService"
+ android:name=".widget.BookmarkThumbnailWidgetService"
android:exported="true" />
<!-- Makes .BrowserActivity the search target for any activity in Browser -->
diff --git a/res/drawable-hdpi/bookmarks_widget_thumb_selector_pressed.9.png b/res/drawable-hdpi/bookmarks_widget_thumb_selector_pressed.9.png
new file mode 100644
index 0000000..a329b19
--- /dev/null
+++ b/res/drawable-hdpi/bookmarks_widget_thumb_selector_pressed.9.png
Binary files differ
diff --git a/res/drawable-hdpi/border_thumb_bookmarks_widget_holo.9.png b/res/drawable-hdpi/border_thumb_bookmarks_widget_holo.9.png
new file mode 100644
index 0000000..ab0ece8
--- /dev/null
+++ b/res/drawable-hdpi/border_thumb_bookmarks_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/gradient_overlay_bg_bookmark_widget_holo.png b/res/drawable-hdpi/gradient_overlay_bg_bookmark_widget_holo.png
deleted file mode 100644
index c530cc5..0000000
--- a/res/drawable-hdpi/gradient_overlay_bg_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-hdpi/ic_bookmark_widget_bookmark_holo_dark.png b/res/drawable-hdpi/ic_bookmark_widget_bookmark_holo_dark.png
new file mode 100644
index 0000000..d7c9bd9
--- /dev/null
+++ b/res/drawable-hdpi/ic_bookmark_widget_bookmark_holo_dark.png
Binary files differ
diff --git a/res/drawable-hdpi/overlay_url_bookmark_widget_holo.9.png b/res/drawable-hdpi/overlay_url_bookmark_widget_holo.9.png
new file mode 100644
index 0000000..570d238
--- /dev/null
+++ b/res/drawable-hdpi/overlay_url_bookmark_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-hdpi/thumb_bookmark_widget_folder_back_holo.png b/res/drawable-hdpi/thumb_bookmark_widget_folder_back_holo.png
new file mode 100644
index 0000000..9ca04c1
--- /dev/null
+++ b/res/drawable-hdpi/thumb_bookmark_widget_folder_back_holo.png
Binary files differ
diff --git a/res/drawable-hdpi/thumb_bookmark_widget_folder_holo.png b/res/drawable-hdpi/thumb_bookmark_widget_folder_holo.png
new file mode 100644
index 0000000..e221fd2
--- /dev/null
+++ b/res/drawable-hdpi/thumb_bookmark_widget_folder_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/app_web_browser_sm.png b/res/drawable-mdpi/app_web_browser_sm.png
index dbb460a..21245c2 100644
--- a/res/drawable-mdpi/app_web_browser_sm.png
+++ b/res/drawable-mdpi/app_web_browser_sm.png
Binary files differ
diff --git a/res/drawable-mdpi/bg_bookmark_widget_holo.9.png b/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
index ac56bbe..d95f8d3 100644
--- a/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
+++ b/res/drawable-mdpi/bg_bookmark_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/bookmarks_widget_thumb_selector_pressed.9.png b/res/drawable-mdpi/bookmarks_widget_thumb_selector_pressed.9.png
new file mode 100644
index 0000000..6ec1576
--- /dev/null
+++ b/res/drawable-mdpi/bookmarks_widget_thumb_selector_pressed.9.png
Binary files differ
diff --git a/res/drawable-mdpi/border_thumb_bookmarks_widget_holo.9.png b/res/drawable-mdpi/border_thumb_bookmarks_widget_holo.9.png
new file mode 100644
index 0000000..486e5e8
--- /dev/null
+++ b/res/drawable-mdpi/border_thumb_bookmarks_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/gradient_overlay_bg_bookmark_widget_holo.png b/res/drawable-mdpi/gradient_overlay_bg_bookmark_widget_holo.png
deleted file mode 100644
index 1673338..0000000
--- a/res/drawable-mdpi/gradient_overlay_bg_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/header_bg_bookmark_widget_holo.png b/res/drawable-mdpi/header_bg_bookmark_widget_holo.png
deleted file mode 100644
index 9c3f7a6..0000000
--- a/res/drawable-mdpi/header_bg_bookmark_widget_holo.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_bookmark_widget_bookmark_holo_dark.png b/res/drawable-mdpi/ic_bookmark_widget_bookmark_holo_dark.png
new file mode 100644
index 0000000..70477aa
--- /dev/null
+++ b/res/drawable-mdpi/ic_bookmark_widget_bookmark_holo_dark.png
Binary files differ
diff --git a/res/drawable-mdpi/overlay_url_bookmark_widget_holo.9.png b/res/drawable-mdpi/overlay_url_bookmark_widget_holo.9.png
new file mode 100644
index 0000000..a72900d
--- /dev/null
+++ b/res/drawable-mdpi/overlay_url_bookmark_widget_holo.9.png
Binary files differ
diff --git a/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png b/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png
index 8c9614b..6b387a0 100644
--- a/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png
+++ b/res/drawable-mdpi/stripes_overlay_bg_bookmark_widget_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/thumb_bookmark_widget_folder_back_holo.png b/res/drawable-mdpi/thumb_bookmark_widget_folder_back_holo.png
new file mode 100644
index 0000000..e75e53f
--- /dev/null
+++ b/res/drawable-mdpi/thumb_bookmark_widget_folder_back_holo.png
Binary files differ
diff --git a/res/drawable-mdpi/thumb_bookmark_widget_folder_holo.png b/res/drawable-mdpi/thumb_bookmark_widget_folder_holo.png
new file mode 100644
index 0000000..58ad3a0
--- /dev/null
+++ b/res/drawable-mdpi/thumb_bookmark_widget_folder_holo.png
Binary files differ
diff --git a/res/drawable/bookmark_widget_thumb_selector.xml b/res/drawable/bookmark_widget_thumb_selector.xml
new file mode 100644
index 0000000..d9b8171
--- /dev/null
+++ b/res/drawable/bookmark_widget_thumb_selector.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:state_pressed="true" android:drawable="@drawable/bookmarks_widget_thumb_selector_pressed" />
+ <item android:drawable="@android:color/transparent" />
+</selector>
+
diff --git a/res/drawable/browser_widget_preview.png b/res/drawable/browser_widget_preview.png
old mode 100755
new mode 100644
index a3f48dd..4923978
--- a/res/drawable/browser_widget_preview.png
+++ b/res/drawable/browser_widget_preview.png
Binary files differ
diff --git a/res/drawable/widget_background.xml b/res/drawable/widget_background.xml
index de6c3f2..4c59d60 100644
--- a/res/drawable/widget_background.xml
+++ b/res/drawable/widget_background.xml
@@ -16,14 +16,8 @@
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
- <item>
- <bitmap
- android:src="@drawable/gradient_overlay_bg_bookmark_widget_holo"
- android:gravity="top|fill_horizontal" />
+ <item
+ android:drawable="@drawable/bg_bookmark_widget_holo">
</item>
- <item>
- <bitmap
- android:src="@drawable/stripes_overlay_bg_bookmark_widget_holo"
- android:gravity="top|fill_horizontal" />
- </item>
+
</layer-list>
diff --git a/res/layout/bookmarklistwidget.xml b/res/layout/bookmarklistwidget.xml
deleted file mode 100644
index f3857f8..0000000
--- a/res/layout/bookmarklistwidget.xml
+++ /dev/null
@@ -1,99 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingTop="4dip"
- android:paddingBottom="20dip"
- android:paddingLeft="12dip"
- android:paddingRight="12dip">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:background="@drawable/bg_bookmark_widget_holo"
- android:paddingLeft="0dip"
- android:paddingRight="0dip"
- android:paddingBottom="0dip">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="42dip"
- android:orientation="horizontal"
- android:background="@drawable/header_bg_bookmark_widget_holo"
- android:layout_marginLeft="5dip"
- android:layout_marginRight="5dip">
- <LinearLayout
- android:id="@+id/header_browser"
- android:layout_width="0dip"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:orientation="horizontal"
- android:paddingLeft="16dip"
- android:focusable="true"
- android:clickable="true"
- android:background="@drawable/widget_header_selector">
- <ImageView
- android:id="@+id/logo"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:src="@drawable/ic_browser_bookmark_widget_holo" />
- <TextView
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:layout_gravity="center_vertical"
- android:text="@string/application_name"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:textStyle="bold"
- android:paddingLeft="8dip" />
- </LinearLayout>
- <ImageView
- android:id="@+id/header_bookmarks"
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:src="@drawable/btn_ic_bookmark_bookmark_widget_holo_dark"
- android:scaleType="centerInside"
- android:focusable="true"
- android:clickable="true"
- android:background="@drawable/widget_header_selector"
- android:paddingLeft="8dip"
- android:paddingRight="8dip" />
- </LinearLayout>
- <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_marginLeft="2dip"
- android:layout_marginRight="2dip" />
- <ListView
- android:id="@+id/bookmarks_list"
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1"
- android:background="@drawable/widget_background"
- android:cacheColorHint="@android:color/transparent"
- android:divider="@drawable/list_div_bookmark_widget_holo"
- android:layout_marginLeft="5dip"
- android:layout_marginRight="5dip" />
- <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
- android:layout_height="wrap_content"
- android:layout_width="match_parent"
- android:layout_marginLeft="2dip"
- android:layout_marginRight="2dip"
- android:layout_marginBottom="2dip" />
- </LinearLayout>
-</FrameLayout>
diff --git a/res/layout/bookmarklistwidget_item.xml b/res/layout/bookmarklistwidget_item.xml
deleted file mode 100644
index 2f64054..0000000
--- a/res/layout/bookmarklistwidget_item.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/list_item"
- android:layout_width="match_parent"
- android:layout_height="48dp"
- android:orientation="horizontal"
- android:background="@drawable/row_activated_bookmark_widget_holo">
- <ImageView
- android:id="@+id/thumb"
- android:src="@drawable/browser_thumbnail"
- android:layout_height="@dimen/bookmark_widget_thumb_size"
- android:layout_width="@dimen/bookmark_widget_thumb_size"
- android:layout_gravity="center_vertical"
- android:layout_marginLeft="16dp"
- android:scaleType="centerInside"/>
- <TextView
- android:id="@+id/label"
- android:layout_width="0dip"
- android:layout_height="wrap_content"
- android:layout_gravity="center_vertical"
- android:layout_weight="1"
- android:textAppearance="?android:attr/textAppearanceSmall"
- android:paddingLeft="8dip"
- android:maxLines="1"
- android:scrollHorizontally="true"
- android:ellipsize="marquee"/>
-</LinearLayout>
diff --git a/res/layout/bookmarkthumbnailwidget.xml b/res/layout/bookmarkthumbnailwidget.xml
new file mode 100644
index 0000000..2c94d32
--- /dev/null
+++ b/res/layout/bookmarkthumbnailwidget.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<FrameLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:paddingTop="4dip"
+ android:paddingBottom="22dip"
+ android:paddingLeft="13dip"
+ android:paddingRight="13dip">
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:orientation="vertical"
+ android:padding="0dip">
+ <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_marginTop="2dip"
+ android:layout_marginLeft="1dip"
+ android:layout_marginRight="1dip"
+ android:visibility="invisible" />
+ <GridView
+ android:id="@+id/bookmarks_list"
+ android:layout_width="match_parent"
+ android:layout_height="0dip"
+ android:layout_weight="1"
+ android:layout_marginLeft="5dip"
+ android:layout_marginRight="5dip"
+ android:numColumns="2"
+ android:paddingTop="1dip"
+ android:paddingBottom="1dip"
+ android:paddingRight="0dip"
+ android:paddingLeft="0dip"
+ android:stretchMode="columnWidth"
+ android:horizontalSpacing="@dimen/widgetHorizontalSpacing"
+ android:verticalSpacing="@dimen/widgetVerticalSpacing"
+ android:drawSelectorOnTop="true"
+ android:listSelector="@drawable/bookmark_widget_thumb_selector"
+ android:fadingEdgeLength="24dp" />
+ <ImageView android:background="@drawable/list_div_top_btm_bookmark_widget_holo"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_marginBottom="3dip"
+ android:layout_marginLeft="1dip"
+ android:layout_marginRight="1dip"
+ android:visibility="invisible" />
+ </LinearLayout>
+</FrameLayout>
diff --git a/res/layout/bookmarkthumbnailwidget_item.xml b/res/layout/bookmarkthumbnailwidget_item.xml
new file mode 100644
index 0000000..b67b386
--- /dev/null
+++ b/res/layout/bookmarkthumbnailwidget_item.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<RelativeLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@+id/list_item"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+ <ImageView
+ android:id="@+id/thumb"
+ android:src="@drawable/browser_thumbnail"
+ android:layout_width="match_parent"
+ android:layout_height="@dimen/widgetThumbnailHeight"
+ android:scaleType="centerCrop"
+ android:cropToPadding="true"
+ android:background="@drawable/border_thumb_bookmarks_widget_holo" />
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignBottom="@id/thumb"
+ android:background="@drawable/overlay_url_bookmark_widget_holo"
+ android:layout_marginLeft="2dip"
+ android:layout_marginRight="2dip"
+ android:layout_marginBottom="2dip">
+ <ImageView
+ android:id="@+id/favicon"
+ android:src="@drawable/app_web_browser_sm"
+ android:layout_width="@dimen/favicon_size"
+ android:layout_height="@dimen/favicon_size"
+ android:layout_gravity="center_vertical"
+ android:layout_marginLeft="4dip"
+ android:layout_marginRight="8dip"
+ android:layout_marginTop="4dip"
+ android:layout_marginBottom="4dip"
+ android:scaleType="centerInside" />
+ <TextView
+ android:id="@+id/label"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"
+ android:singleLine="true"
+ android:ellipsize="end"
+ android:textSize="14sp"
+ android:typeface="sans"
+ android:textStyle="bold"
+ android:textColor="@android:color/white" />
+ </LinearLayout>
+</RelativeLayout>
diff --git a/res/layout/tab_bar.xml b/res/layout/tab_bar.xml
index e8f146c..0f636cd 100644
--- a/res/layout/tab_bar.xml
+++ b/res/layout/tab_bar.xml
@@ -24,8 +24,9 @@
>
<com.android.browser.TabScrollView
android:id="@+id/tabs"
- android:layout_width="wrap_content"
+ android:layout_width="0dip"
android:layout_height="44dip"
+ android:layout_weight="1.0"
android:orientation="horizontal" />
<ImageButton
android:id="@+id/newtab"
diff --git a/res/values-xlarge-port/dimensions.xml b/res/values-xlarge-port/dimensions.xml
new file mode 100644
index 0000000..46e7272
--- /dev/null
+++ b/res/values-xlarge-port/dimensions.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2010 The Android Open Source Project Licensed under the
+ Apache License, Version 2.0 (the "License"); you may not use this file
+ except in compliance with the License. You may obtain a copy of the
+ License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+ CONDITIONS OF ANY KIND, either express or implied. See the License for
+ the specific language governing permissions and limitations under the
+ License.
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <dimen name="widgetThumbnailHeight">72dip</dimen>
+ <dimen name="widgetHorizontalSpacing">0dip</dimen>
+ <dimen name="widgetVerticalSpacing">4dip</dimen>
+</resources>
diff --git a/res/values-xlarge/dimensions.xml b/res/values-xlarge/dimensions.xml
index 9f5a602..d56146b 100644
--- a/res/values-xlarge/dimensions.xml
+++ b/res/values-xlarge/dimensions.xml
@@ -13,6 +13,9 @@
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<dimen name="bookmarkThumbnailWidth">180dip</dimen>
<dimen name="bookmarkThumbnailHeight">120dip</dimen>
+ <dimen name="widgetThumbnailHeight">100dip</dimen>
+ <dimen name="widgetHorizontalSpacing">12dip</dimen>
+ <dimen name="widgetVerticalSpacing">12dip</dimen>
<dimen name="favicon_padded_size">24dip</dimen>
<!-- For the most visited page -->
<dimen name="mv_max_width">1010dp</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4464370..00a2a46 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -376,6 +376,15 @@
<!-- Summary for the AutoFill Settings preference [CHAR-LIMIT=none] -->
<string name="pref_autofill_profile_editor_summary">Set up & manage data for AutoFilled forms</string>
+ <!-- Auto login preference title [CHAR-LIMIT=32] -->
+ <string name="pref_autologin_title">Automatic Google sign-in</string>
+ <!-- Summary when no accounts are found [CHAR-LIMIT=32] -->
+ <string name="pref_autologin_no_account">No accounts found</string>
+ <!-- Summary when there is an account available [CHAR-LIMIT=none] -->
+ <string name="pref_autologin_summary">Sign into Google sites automatically using <xliff:g>%s</xliff:g></string>
+ <!-- Message shown during auto login [CHAR-LIMIT=none] -->
+ <string name="pref_autologin_progress">Signing into Google sites using <xliff:g>%s</xliff:g></string>
+
<!-- Heading for the AutoFill profile editor to tell the user what AutoFill does and why they should fill out the profile. [CHAR-LIMIT=None] -->
<string name="autofill_profile_editor_heading">AutoFill will use your profile to help you complete web forms in a single click.</string>
<!-- String for the user's full name in the AutoFill profile editor. [CHAR-LIMIT=32] -->
@@ -909,8 +918,4 @@
reached. [CHAR LIMIT=50] -->
<string name="max_tabs_warning">No more tabs available</string>
- <!-- Title of the picker dialog to choose an account. [CHAR-LIMIT=none]-->
- <string name="account_picker_title">Choose an account or cancel to login
- manually</string>
-
</resources>
diff --git a/res/xml/bookmarklistwidget_info.xml b/res/xml/bookmarkthumbnailwidget_info.xml
similarity index 94%
rename from res/xml/bookmarklistwidget_info.xml
rename to res/xml/bookmarkthumbnailwidget_info.xml
index c39ce8f..6797f85 100644
--- a/res/xml/bookmarklistwidget_info.xml
+++ b/res/xml/bookmarkthumbnailwidget_info.xml
@@ -21,5 +21,5 @@
android:minHeight="219dip"
android:updatePeriodMillis="0"
android:previewImage="@drawable/browser_widget_preview"
- android:initialLayout="@layout/bookmarklistwidget">
+ android:initialLayout="@layout/bookmarkthumbnailwidget">
</appwidget-provider>
diff --git a/res/xml/browser_preferences.xml b/res/xml/browser_preferences.xml
deleted file mode 100644
index 1c04528..0000000
--- a/res/xml/browser_preferences.xml
+++ /dev/null
@@ -1,216 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2008 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android">
-
- <PreferenceCategory
- android:title="@string/pref_content_title">
-
- <ListPreference
- android:key="text_size"
- android:title="@string/pref_text_size"
- android:defaultValue="NORMAL"
- android:entries="@array/pref_text_size_choices"
- android:entryValues="@array/pref_text_size_values"
- android:dialogTitle="@string/pref_text_size_dialogtitle" />
-
- <ListPreference
- android:key="default_zoom"
- android:title="@string/pref_default_zoom"
- android:defaultValue="MEDIUM"
- android:entries="@array/pref_default_zoom_choices"
- android:entryValues="@array/pref_default_zoom_values"
- android:dialogTitle="@string/pref_default_zoom_dialogtitle" />
-
- <CheckBoxPreference
- android:key="load_page"
- android:defaultValue="true"
- android:title="@string/pref_content_load_page"
- android:summary="@string/pref_content_load_page_summary" />
-
- <ListPreference
- android:key="default_text_encoding"
- android:title="@string/pref_default_text_encoding"
- android:defaultValue="@string/pref_default_text_encoding_default"
- android:entries="@array/pref_default_text_encoding_choices"
- android:entryValues="@array/pref_default_text_encoding_values"
- android:dialogTitle="@string/pref_default_text_encoding_dialogtitle" />
-
- <CheckBoxPreference
- android:key="block_popup_windows"
- android:defaultValue="true"
- android:title="@string/pref_content_block_popups" />
-
- <CheckBoxPreference
- android:key="load_images"
- android:defaultValue="true"
- android:title="@string/pref_content_load_images"
- android:summary="@string/pref_content_load_images_summary" />
-
- <CheckBoxPreference
- android:key="autofit_pages"
- android:defaultValue="true"
- android:title="@string/pref_content_autofit"
- android:summary="@string/pref_content_autofit_summary" />
-
- <CheckBoxPreference
- android:key="enable_javascript"
- android:defaultValue="true"
- android:title="@string/pref_content_javascript" />
-
- <ListPreference
- android:key="plugin_state"
- android:title="@string/pref_content_plugins"
- android:defaultValue="ON"
- android:entries="@array/pref_content_plugins_choices"
- android:entryValues="@array/pref_content_plugins_values"
- android:dialogTitle="@string/pref_content_plugins" />
-
- <CheckBoxPreference
- android:key="open_in_background"
- android:defaultValue="false"
- android:title="@string/pref_content_open_in_background"
- android:summary="@string/pref_content_open_in_background_summary" />
-
- <com.android.browser.BrowserHomepagePreference
- android:key="homepage"
- android:title="@string/pref_content_homepage"
- android:hint="@string/http"
- android:inputType="textUri|textMultiLine" />
-
- </PreferenceCategory>
-
- <PreferenceCategory
- android:title="@string/pref_privacy_security_title">
-
- <com.android.browser.BrowserYesNoPreference
- android:key="privacy_clear_cache"
- android:title="@string/pref_privacy_clear_cache"
- android:summary="@string/pref_privacy_clear_cache_summary"
- android:dialogMessage="@string/pref_privacy_clear_cache_dlg"
- android:dialogTitle="@string/clear"
- android:dialogIcon="@android:drawable/ic_dialog_alert" />
-
- <com.android.browser.BrowserYesNoPreference
- android:key="privacy_clear_history"
- android:title="@string/pref_privacy_clear_history"
- android:summary="@string/pref_privacy_clear_history_summary"
- android:dialogMessage="@string/pref_privacy_clear_history_dlg"
- android:dialogTitle="@string/clear"
- android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-
- <CheckBoxPreference
- android:key="accept_cookies"
- android:defaultValue="true"
- android:title="@string/pref_security_accept_cookies"
- android:summary="@string/pref_security_accept_cookies_summary" />
-
- <com.android.browser.BrowserYesNoPreference
- android:key="privacy_clear_cookies"
- android:title="@string/pref_privacy_clear_cookies"
- android:summary="@string/pref_privacy_clear_cookies_summary"
- android:dialogMessage="@string/pref_privacy_clear_cookies_dlg"
- android:dialogTitle="@string/clear"
- android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-
- <CheckBoxPreference
- android:key="save_formdata"
- android:defaultValue="true"
- android:title="@string/pref_security_save_form_data"
- android:summary="@string/pref_security_save_form_data_summary" />
-
- <CheckBoxPreference
- android:key="autofill_enabled"
- android:defaultValue="true"
- android:title="@string/pref_autofill_enabled"
- android:summary="@string/pref_autofill_enabled_summary" />
-
- <com.android.browser.BrowserYesNoPreference
- android:key="privacy_clear_form_data"
- android:title="@string/pref_privacy_clear_form_data"
- android:summary="@string/pref_privacy_clear_form_data_summary"
- android:dialogMessage="@string/pref_privacy_clear_form_data_dlg"
- android:dialogTitle="@string/clear"
- android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-
- <CheckBoxPreference
- android:key="enable_geolocation"
- android:defaultValue="true"
- android:title="@string/pref_privacy_enable_geolocation"
- android:summary="@string/pref_privacy_enable_geolocation_summary" />
-
- <com.android.browser.BrowserYesNoPreference
- android:key="privacy_clear_geolocation_access"
- android:dependency="enable_geolocation"
- android:title="@string/pref_privacy_clear_geolocation_access"
- android:summary="@string/pref_privacy_clear_geolocation_access_summary"
- android:dialogMessage="@string/pref_privacy_clear_geolocation_access_dlg"
- android:dialogTitle="@string/clear"
- android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-
- </PreferenceCategory>
-
- <PreferenceCategory
- android:title="@string/pref_privacy_security_title">
-
- <CheckBoxPreference
- android:key="remember_passwords"
- android:defaultValue="true"
- android:title="@string/pref_security_remember_passwords"
- android:summary="@string/pref_security_remember_passwords_summary" />
-
- <com.android.browser.BrowserYesNoPreference
- android:key="privacy_clear_passwords"
- android:title="@string/pref_privacy_clear_passwords"
- android:summary="@string/pref_privacy_clear_passwords_summary"
- android:dialogMessage="@string/pref_privacy_clear_passwords_dlg"
- android:dialogTitle="@string/clear"
- android:dialogIcon="@android:drawable/ic_dialog_alert"/>
-
- <CheckBoxPreference
- android:key="show_security_warnings"
- android:defaultValue="true"
- android:title="@string/pref_security_show_security_warning"
- android:summary="@string/pref_security_show_security_warning_summary" />
-
-
- </PreferenceCategory>
- <PreferenceCategory
- android:title="@string/pref_extras_title">
-
- <!-- Entries and values in this list are set dynamically. -->
- <com.android.browser.search.SearchEnginePreference
- android:key="search_engine"
- android:title="@string/pref_content_search_engine"
- android:defaultValue="google"
- android:summary="@string/pref_content_search_engine_summary"
- android:dialogTitle="@string/pref_content_search_engine" />
-
- <PreferenceScreen
- android:key="website_settings"
- android:title="@string/pref_extras_website_settings"
- android:summary="@string/pref_extras_website_settings_summary" />
-
- <com.android.browser.BrowserYesNoPreference
- android:key="reset_default_preferences"
- android:title="@string/pref_extras_reset_default"
- android:summary="@string/pref_extras_reset_default_summary"
- android:dialogMessage="@string/pref_extras_reset_default_dlg"
- android:dialogTitle="@string/pref_extras_reset_default_dlg_title"
- android:dialogIcon="@android:drawable/ic_dialog_alert" />
- </PreferenceCategory>
-</PreferenceScreen>
diff --git a/res/xml/privacy_security_preferences.xml b/res/xml/privacy_security_preferences.xml
index 50802ca..54f3ff0 100644
--- a/res/xml/privacy_security_preferences.xml
+++ b/res/xml/privacy_security_preferences.xml
@@ -39,6 +39,11 @@
android:title="@string/pref_security_show_security_warning"
android:summary="@string/pref_security_show_security_warning_summary" />
+ <CheckBoxPreference
+ android:key="enable_autologin"
+ android:title="@string/pref_autologin_title"
+ android:defaultValue="true" />
+
<PreferenceCategory android:title="@string/pref_privacy_cookies_title">
<CheckBoxPreference
android:key="accept_cookies"
diff --git a/src/com/android/browser/BrowserActivity.java b/src/com/android/browser/BrowserActivity.java
index ba5ba29..0fce014 100644
--- a/src/com/android/browser/BrowserActivity.java
+++ b/src/com/android/browser/BrowserActivity.java
@@ -19,6 +19,7 @@
import com.google.common.annotations.VisibleForTesting;
import android.app.Activity;
+import android.app.ProgressDialog;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Bitmap;
@@ -59,13 +60,15 @@
}
super.onCreate(icicle);
+ BrowserSettings settings = BrowserSettings.getInstance();
+
// We load the first set of BrowserSettings from the db asynchronously
// but if it has not completed at this point, we have no choice but
// to block waiting for them to finish loading. :(
- BrowserSettings.getInstance().waitForLoadFromDbToComplete();
+ settings.waitForLoadFromDbToComplete();
// render the browser in OpenGL
- if (BrowserSettings.getInstance().isHardwareAccelerated()) {
+ if (settings.isHardwareAccelerated()) {
// Set the flag in the activity's window
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
@@ -110,7 +113,28 @@
if (state != null && icicle == null) {
icicle = state;
}
- mController.start(icicle, getIntent());
+
+ String account = settings.getAutoLoginAccount(this);
+ if (settings.isAutoLoginEnabled() && account != null) {
+ GoogleAccountLogin login =
+ new GoogleAccountLogin(this, account);
+ final ProgressDialog dialog = ProgressDialog.show(this,
+ getString(R.string.pref_autologin_title),
+ getString(R.string.pref_autologin_progress, account),
+ true /* indeterminate */,
+ true /* cancelable */,
+ login);
+ final Bundle b = icicle;
+ final Runnable start = new Runnable() {
+ @Override public void run() {
+ dialog.dismiss();
+ mController.start(b, getIntent());
+ }
+ };
+ login.startLogin(start);
+ } else {
+ mController.start(icicle, getIntent());
+ }
}
@VisibleForTesting
diff --git a/src/com/android/browser/BrowserSettings.java b/src/com/android/browser/BrowserSettings.java
index 88bd78a..3393c4f 100644
--- a/src/com/android/browser/BrowserSettings.java
+++ b/src/com/android/browser/BrowserSettings.java
@@ -103,6 +103,9 @@
private String databasePath; // default value set in loadFromDb()
private String geolocationDatabasePath; // default value set in loadFromDb()
private WebStorageSizeManager webStorageSizeManager;
+ // Autologin settings
+ private boolean autoLoginEnabled;
+ private String autoLoginAccount;
private String jsFlags = "";
@@ -174,6 +177,8 @@
public final static String PREF_QUICK_CONTROLS = "enable_quick_controls";
public final static String PREF_MOST_VISITED_HOMEPAGE = "use_most_visited_homepage";
+ public final static String PREF_AUTOLOGIN = "enable_autologin";
+ public final static String PREF_AUTOLOGIN_ACCOUNT = "autologin_account";
private static final String DESKTOP_USERAGENT = "Mozilla/5.0 (Macintosh; " +
"U; Intel Mac OS X 10_6_3; en-us) AppleWebKit/533.16 (KHTML, " +
@@ -527,6 +532,11 @@
geolocationEnabled = p.getBoolean("enable_geolocation", geolocationEnabled);
workersEnabled = p.getBoolean("enable_workers", workersEnabled);
+ // Autologin account settings. The account preference may be null until
+ // the user explicitly changes the account in the settings.
+ autoLoginEnabled = p.getBoolean(PREF_AUTOLOGIN, autoLoginEnabled);
+ autoLoginAccount = p.getString(PREF_AUTOLOGIN_ACCOUNT, autoLoginAccount);
+
update();
}
@@ -607,6 +617,24 @@
update();
}
+ public boolean isAutoLoginEnabled() {
+ return autoLoginEnabled;
+ }
+
+ public String getAutoLoginAccount(Context context) {
+ // Each time we attempt to get the account, we need to verify that the
+ // account is still valid.
+ return GoogleAccountLogin.validateAccount(context, autoLoginAccount);
+ }
+
+ public void setAutoLoginAccount(Context context, String name) {
+ Editor ed = PreferenceManager.
+ getDefaultSharedPreferences(context).edit();
+ ed.putString(PREF_AUTOLOGIN_ACCOUNT, name);
+ ed.apply();
+ autoLoginAccount = name;
+ }
+
public void setAutoFillProfile(Context ctx, AutoFillProfile profile, Message msg) {
if (profile != null) {
setActiveAutoFillProfileId(ctx, profile.getUniqueId());
@@ -799,6 +827,9 @@
domStorageEnabled = true;
geolocationEnabled = true;
workersEnabled = true; // only affects V8. JSC does not have a similar setting
+ // Autologin default is true. The account will be populated when
+ // reading from the DB as that is when a context is available.
+ autoLoginEnabled = true;
}
private abstract class AutoFillProfileDbTask<T> extends AsyncTask<T, Void, Void> {
diff --git a/src/com/android/browser/CombinedBookmarkHistoryView.java b/src/com/android/browser/CombinedBookmarkHistoryView.java
index 426b34d..0f12353 100644
--- a/src/com/android/browser/CombinedBookmarkHistoryView.java
+++ b/src/com/android/browser/CombinedBookmarkHistoryView.java
@@ -29,8 +29,10 @@
import android.os.Bundle;
import android.provider.Browser;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.webkit.WebIconDatabase;
import android.webkit.WebIconDatabase.IconListener;
@@ -46,7 +48,7 @@
}
public class CombinedBookmarkHistoryView extends LinearLayout
- implements OnClickListener {
+ implements OnClickListener, OnTouchListener {
final static String STARTING_FRAGMENT = "fragment";
@@ -115,6 +117,7 @@
mActivity = activity;
mExtras = extras;
View v = LayoutInflater.from(activity).inflate(R.layout.bookmarks_history, this);
+ v.setOnTouchListener(this);
Resources res = activity.getResources();
// setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);
@@ -258,4 +261,13 @@
}
return false;
}
+
+ /**
+ * capture touch events to prevent them from going to the underlying
+ * WebView
+ */
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ return true;
+ }
}
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index 23594f2..02f1e7c 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -1111,6 +1111,10 @@
if (mTabControl.getCurrentWebView() == null) {
return;
}
+ // clear action mode
+ if (isInCustomActionMode()) {
+ endActionMode();
+ }
Bundle extras = new Bundle();
// Disable opening in a new window if we have maxed out the windows
extras.putBoolean(BrowserBookmarksPage.EXTRA_DISABLE_WINDOW,
diff --git a/src/com/android/browser/GoogleAccountLogin.java b/src/com/android/browser/GoogleAccountLogin.java
new file mode 100644
index 0000000..8ff0972
--- /dev/null
+++ b/src/com/android/browser/GoogleAccountLogin.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.browser;
+
+import org.apache.http.Header;
+import org.apache.http.HeaderIterator;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.util.EntityUtils;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.AccountManagerCallback;
+import android.accounts.AccountManagerFuture;
+import android.app.Activity;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnCancelListener;
+import android.net.http.AndroidHttpClient;
+import android.net.Uri;
+import android.os.Bundle;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import java.util.ArrayList;
+
+public class GoogleAccountLogin extends Thread implements
+ AccountManagerCallback<Bundle>, OnCancelListener {
+
+ // Url for issuing the uber token.
+ private Uri ISSUE_AUTH_TOKEN_URL = Uri.parse(
+ "https://www.google.com/accounts/IssueAuthToken?service=gaia&Session=false");
+ // Url for signing into a particular service.
+ private final static Uri TOKEN_AUTH_URL = Uri.parse(
+ "https://www.google.com/accounts/TokenAuth");
+ // Google account type
+ private final static String GOOGLE = "com.google";
+
+ private final Activity mActivity;
+ private final Account mAccount;
+ private final WebView mWebView;
+ private Runnable mRunnable;
+
+ // SID and LSID retrieval process.
+ private String mSid;
+ private String mLsid;
+ private int mState; // {NONE(0), SID(1), LSID(2)}
+
+ GoogleAccountLogin(Activity activity, String name) {
+ mActivity = activity;
+ mAccount = new Account(name, GOOGLE);
+ mWebView = new WebView(mActivity);
+ mWebView.setWebViewClient(new WebViewClient() {
+ @Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ return false;
+ }
+ @Override
+ public void onPageFinished(WebView view, String url) {
+ done();
+ }
+ });
+ }
+
+ // Thread
+ @Override
+ public void run() {
+ String url = ISSUE_AUTH_TOKEN_URL.buildUpon()
+ .appendQueryParameter("SID", mSid)
+ .appendQueryParameter("LSID", mLsid)
+ .build().toString();
+ // Intentionally not using Proxy.
+ AndroidHttpClient client = AndroidHttpClient.newInstance(
+ mWebView.getSettings().getUserAgentString());
+ HttpPost request = new HttpPost(url);
+
+ String result = null;
+ try {
+ HttpResponse response = client.execute(request);
+ if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
+ done();
+ return;
+ }
+ HttpEntity entity = response.getEntity();
+ if (entity == null) {
+ done();
+ return;
+ }
+ result = EntityUtils.toString(entity, "UTF-8");
+ } catch (Exception e) {
+ request.abort();
+ done();
+ return;
+ } finally {
+ client.close();
+ }
+ final String newUrl = TOKEN_AUTH_URL.buildUpon()
+ .appendQueryParameter("source", "android-browser")
+ .appendQueryParameter("auth", result)
+ .appendQueryParameter("continue",
+ BrowserSettings.getFactoryResetHomeUrl(mActivity))
+ .build().toString();
+ mActivity.runOnUiThread(new Runnable() {
+ @Override public void run() {
+ mWebView.loadUrl(newUrl);
+ }
+ });
+ }
+
+ // AccountManager callbacks.
+ @Override
+ public void run(AccountManagerFuture<Bundle> value) {
+ try {
+ String id = value.getResult().getString(
+ AccountManager.KEY_AUTHTOKEN);
+ switch (mState) {
+ default:
+ case 0:
+ throw new IllegalStateException(
+ "Impossible to get into this state");
+ case 1:
+ mSid = id;
+ mState = 2; // LSID
+ AccountManager.get(mActivity).getAuthToken(
+ mAccount, "LSID", null, mActivity, this, null);
+ break;
+ case 2:
+ mLsid = id;
+ this.start();
+ break;
+ }
+ } catch (Exception e) {
+ // For all exceptions load the original signin page.
+ // TODO: toast login failed?
+ done();
+ }
+ }
+
+ public void startLogin(Runnable runnable) {
+ mRunnable = runnable;
+ mState = 1; // SID
+ AccountManager.get(mActivity).getAuthToken(
+ mAccount, "SID", null, mActivity, this, null);
+ }
+
+ // Returns the account name passed in if the account exists, otherwise
+ // returns the default account.
+ public static String validateAccount(Context ctx, String name) {
+ Account[] accounts = getAccounts(ctx);
+ if (accounts.length == 0) {
+ return null;
+ }
+ if (name != null) {
+ // Make sure the account still exists.
+ for (Account a : accounts) {
+ if (a.name.equals(name)) {
+ return name;
+ }
+ }
+ }
+ // Return the first entry.
+ return accounts[0].name;
+ }
+
+ public static Account[] getAccounts(Context ctx) {
+ return AccountManager.get(ctx).getAccountsByType(GOOGLE);
+ }
+
+ // Used to indicate that the Browser should continue loading the main page.
+ // This can happen on success, error, or timeout.
+ private synchronized void done() {
+ if (mRunnable != null) {
+ mActivity.runOnUiThread(mRunnable);
+ mRunnable = null;
+ mWebView.destroy();
+ }
+ }
+
+ // Called by the progress dialog on startup.
+ public void onCancel(DialogInterface unused) {
+ done();
+ }
+}
diff --git a/src/com/android/browser/NetworkStateHandler.java b/src/com/android/browser/NetworkStateHandler.java
index 3b2007e..37f4a2f 100644
--- a/src/com/android/browser/NetworkStateHandler.java
+++ b/src/com/android/browser/NetworkStateHandler.java
@@ -72,7 +72,10 @@
sendNetworkType(typeName.toLowerCase(),
(subtypeName != null ? subtypeName.toLowerCase() : ""));
- onNetworkToggle(info.isAvailable());
+ boolean noConnection = intent.getBooleanExtra(
+ ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
+
+ onNetworkToggle(!noConnection);
}
}
};
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index ba123d0..f1cdf2f 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -33,7 +33,6 @@
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.PaintDrawable;
-import android.util.Log;
import android.view.ContextMenu;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -136,7 +135,7 @@
mInactiveShaderPaint.setStyle(Paint.Style.FILL);
mInactiveShaderPaint.setAntiAlias(true);
-
+
}
void setUseQuickControls(boolean useQuickControls) {
@@ -174,18 +173,22 @@
// use paddingLeft and paddingTop
int pl = getPaddingLeft();
int pt = getPaddingTop();
- if (mButtonWidth == -1) {
- mButtonWidth = mNewTab.getMeasuredWidth() - mTabOverlap;
- }
int sw = mTabs.getMeasuredWidth();
int w = right - left - pl;
- if (w-sw < mButtonWidth) {
- sw = w - mButtonWidth;
+ if (mUseQuickControls) {
+ mButtonWidth = 0;
+ } else {
+ mButtonWidth = mNewTab.getMeasuredWidth() - mTabOverlap;
+ if (w-sw < mButtonWidth) {
+ sw = w - mButtonWidth;
+ }
}
mTabs.layout(pl, pt, pl + sw, bottom - top);
// adjust for overlap
- mNewTab.layout(pl + sw - mTabOverlap, pt,
- pl + sw + mButtonWidth - mTabOverlap, bottom - top);
+ if (!mUseQuickControls) {
+ mNewTab.layout(pl + sw - mTabOverlap, pt,
+ pl + sw + mButtonWidth - mTabOverlap, bottom - top);
+ }
}
public void onClick(View view) {
@@ -286,8 +289,8 @@
drawable.setBounds(0, 0, width, height);
drawable.draw(c);
return b;
- }
-
+ }
+
/**
* View used in the tab bar
*/
@@ -420,7 +423,7 @@
super.onLayout(changed, l, t, r, b);
setTabPath(mPath, 0, 0, r - l, b - t);
}
-
+
@Override
protected void dispatchDraw(Canvas canvas) {
if (mCurrentTextureWidth != mUi.getContentWidth() ||
@@ -437,13 +440,13 @@
mActiveShader = new BitmapShader(activeTexture,
Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mActiveShaderPaint.setShader(mActiveShader);
-
+
mInactiveShader = new BitmapShader(inactiveTexture,
Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mInactiveShaderPaint.setShader(mInactiveShader);
}
}
-
+
int state = canvas.save();
getLocationInWindow(mWindowPos);
Paint paint = mSelected ? mActiveShaderPaint : mInactiveShaderPaint;
diff --git a/src/com/android/browser/UrlHandler.java b/src/com/android/browser/UrlHandler.java
index cd0afeb..9e41990 100644
--- a/src/com/android/browser/UrlHandler.java
+++ b/src/com/android/browser/UrlHandler.java
@@ -16,29 +16,12 @@
package com.android.browser;
-import org.apache.http.Header;
-import org.apache.http.HeaderIterator;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.util.EntityUtils;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
import android.app.Activity;
-import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
-import android.content.DialogInterface;
-import android.content.DialogInterface.OnCancelListener;
-import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.database.Cursor;
import android.net.Uri;
-import android.net.http.AndroidHttpClient;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
@@ -120,15 +103,7 @@
// AsyncTask. Although we are not overriding the URL load synchronously,
// we guarantee that we will handle this URL load after the task executes,
// so it's safe to just return true to WebCore now to stop its own loading.
- new RLZTask(siteUri, view).execute();
- return true;
- }
- }
-
- // Check for service login and prompt the user for an account to use.
- if (url.startsWith("https://www.google.com/accounts/ServiceLogin?") ||
- url.startsWith("https://www.google.com/accounts/Login?")) {
- if (loginWithDeviceAccount(view, url)) {
+ new RLZTask(tab, siteUri, view).execute();
return true;
}
}
@@ -137,9 +112,7 @@
return true;
}
- if (mController.isMenuDown()) {
- mController.openTab(tab, url, false);
- mActivity.closeOptionsMenu();
+ if (handleMenuClick(tab, url)) {
return true;
}
@@ -198,167 +171,26 @@
return false;
}
- // Url for issuing the uber token.
- private final static Uri ISSUE_AUTH_TOKEN_URL = Uri.parse(
- "https://www.google.com/accounts/IssueAuthToken?service=gaia&Session=false");
- // Url for signing into a particular service.
- private final static Uri TOKEN_AUTH_URL = Uri.parse(
- "https://www.google.com/accounts/TokenAuth");
-
- private class GoogleServiceLogin extends Thread implements
- AccountManagerCallback<Bundle>, OnClickListener, OnCancelListener {
- // For choosing the account.
- private final Account[] mAccounts;
- private int mCurrentAccount; // initially 0 for the first account
-
- // For loading the auth token urls or the original url on error.
- private final WebView mWebView;
- private final String mUrl;
-
- // SID and LSID retrieval process.
- private String mSid;
- private String mLsid;
- private int mState; // {NONE(0), SID(1), LSID(2)}
-
- GoogleServiceLogin(Account[] accounts, WebView view, String url) {
- mAccounts = accounts;
- mWebView = view;
- mUrl = url;
+ // In case a physical keyboard is attached, handle clicks with the menu key
+ // depressed by opening in a new tab
+ boolean handleMenuClick(Tab tab, String url)
+ {
+ if (mController.isMenuDown()) {
+ mController.openTab(tab, url, false);
+ mActivity.closeOptionsMenu();
+ return true;
}
- // Thread
- public void run() {
- String url = ISSUE_AUTH_TOKEN_URL.buildUpon()
- .appendQueryParameter("SID", mSid)
- .appendQueryParameter("LSID", mLsid)
- .build().toString();
- // Intentionally not using Proxy.
- AndroidHttpClient client = AndroidHttpClient.newInstance(
- mWebView.getSettings().getUserAgentString());
- HttpPost request = new HttpPost(url);
-
- String result = null;
- try {
- HttpResponse response = client.execute(request);
- if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
- onCancel(null);
- return;
- }
- HttpEntity entity = response.getEntity();
- if (entity == null) {
- onCancel(null);
- return;
- }
- result = EntityUtils.toString(entity, "UTF-8");
- } catch (Exception e) {
- request.abort();
- onCancel(null);
- } finally {
- client.close();
- }
- Uri parsedUri = Uri.parse(mUrl);
- String service = parsedUri.getQueryParameter("service");
- String redirect = parsedUri.getQueryParameter("continue");
- final String newUrl = TOKEN_AUTH_URL.buildUpon()
- .appendQueryParameter("service", service)
- .appendQueryParameter("source", "android-browser")
- .appendQueryParameter("auth", result)
- .appendQueryParameter("continue", redirect)
- .build().toString();
- mActivity.runOnUiThread(new Runnable() {
- @Override public void run() {
- mController.loadUrl(mWebView, newUrl);
- }
- });
- }
-
- // AccountManager callbacks.
- public void run(AccountManagerFuture<Bundle> value) {
- try {
- String id = value.getResult().getString(
- AccountManager.KEY_AUTHTOKEN);
- switch (mState) {
- default:
- case 0:
- throw new IllegalStateException(
- "Impossible to get into this state");
- case 1:
- mSid = id;
- mState = 2; // LSID
- AccountManager.get(mActivity).getAuthToken(
- mAccounts[mCurrentAccount], "LSID", null,
- mActivity, this, null);
- break;
- case 2:
- mLsid = id;
- this.start();
- break;
- }
- } catch (Exception e) {
- // For all exceptions load the original signin page.
- // TODO: toast login failed?
- onCancel(null);
- }
- }
-
- // Handle picking an account and "OK."
- public void onClick(DialogInterface unused, int which) {
- if (which == DialogInterface.BUTTON_POSITIVE) {
- // TODO: toast loading...?
- Account current = mAccounts[mCurrentAccount];
- mState = 1; // SID
- AccountManager.get(mActivity).getAuthToken(
- mAccounts[mCurrentAccount], "SID", null,
- mActivity, this, null);
- } else if (which == DialogInterface.BUTTON_NEGATIVE) {
- onCancel(null);
- } else {
- mCurrentAccount = which;
- }
- }
-
- // Handle "cancel."
- public void onCancel(DialogInterface unusued) {
- // load the original url to login manually.
- mController.loadUrl(mWebView, mUrl);
- }
- }
-
- private boolean loginWithDeviceAccount(WebView view, String url) {
- Uri parsedUri = Uri.parse(url);
- if ("true".equals(parsedUri.getQueryParameter("go"))) {
- return false;
- }
- Account[] accounts =
- AccountManager.get(mActivity).getAccountsByType("com.google");
- if (accounts.length == 0) {
- return false;
- }
-
- // Populate the account list.
- CharSequence[] names = new CharSequence[accounts.length];
- int i = 0;
- for (Account a : accounts) {
- names[i++] = a.name;
- }
-
- GoogleServiceLogin login = new GoogleServiceLogin(accounts, view, url);
- new AlertDialog.Builder(mActivity)
- .setTitle(R.string.account_picker_title)
- .setSingleChoiceItems(names, 0 /* first choice */, login)
- .setPositiveButton(R.string.ok, login)
- .setNegativeButton(R.string.cancel, login)
- .setCancelable(true)
- .setOnCancelListener(login)
- .show();
- return true;
+ return false;
}
private class RLZTask extends AsyncTask<Void, Void, String> {
+ private Tab mTab;
private Uri mSiteUri;
private WebView mWebView;
- public RLZTask(Uri uri, WebView webView) {
+ public RLZTask(Tab tab, Uri uri, WebView webView) {
+ mTab = tab;
mSiteUri = uri;
mWebView = webView;
}
@@ -383,7 +215,12 @@
}
protected void onPostExecute(String result) {
- startActivityForUrl(result);
+ // If the Activity Manager is not invoked, load the URL directly
+ if (!startActivityForUrl(result)) {
+ if (!handleMenuClick(mTab, result)) {
+ mController.loadUrl(mWebView, result);
+ }
+ }
}
}
diff --git a/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java b/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java
index 8a5178c..20d4f42 100644
--- a/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java
+++ b/src/com/android/browser/preferences/PrivacySecurityPreferencesFragment.java
@@ -17,26 +17,50 @@
package com.android.browser.preferences;
import com.android.browser.BrowserSettings;
+import com.android.browser.GoogleAccountLogin;
import com.android.browser.R;
+import android.accounts.Account;
import android.app.Activity;
+import android.app.AlertDialog;
+import android.content.DialogInterface;
+import android.content.DialogInterface.OnClickListener;
import android.content.Intent;
import android.os.Bundle;
+import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
public class PrivacySecurityPreferencesFragment extends PreferenceFragment
implements Preference.OnPreferenceChangeListener {
+ private BrowserSettings mSettings;
+
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ mSettings = BrowserSettings.getInstance();
+
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.privacy_security_preferences);
Preference e = findPreference(BrowserSettings.PREF_CLEAR_HISTORY);
e.setOnPreferenceChangeListener(this);
+ e = findPreference(BrowserSettings.PREF_AUTOLOGIN);
+ e.setOnPreferenceChangeListener(this);
+ updateAutoLoginSummary((CheckBoxPreference) e);
+ }
+
+ private void updateAutoLoginSummary(CheckBoxPreference pref) {
+ String account = mSettings.getAutoLoginAccount(getActivity());
+ if (account == null) {
+ pref.setChecked(false);
+ pref.setEnabled(false);
+ pref.setSummary(R.string.pref_autologin_no_account);
+ } else {
+ pref.setSummary(getString(R.string.pref_autologin_summary, account));
+ }
}
@Override
@@ -48,8 +72,68 @@
getActivity().setResult(Activity.RESULT_OK, (new Intent()).putExtra(Intent.EXTRA_TEXT,
pref.getKey()));
return true;
+ } else if (pref.getKey().equals(BrowserSettings.PREF_AUTOLOGIN)) {
+ boolean val = ((Boolean) objValue).booleanValue();
+ if (val) {
+ selectAccount((CheckBoxPreference) pref);
+ return false;
+ }
+ return true;
}
return false;
}
+
+ class AccountCallback implements OnClickListener {
+ private final Account[] mAccounts;
+ private final CheckBoxPreference mPref;
+
+ public AccountCallback(Account[] accounts, CheckBoxPreference pref) {
+ mAccounts = accounts;
+ mPref = pref;
+ }
+
+ public void onClick(DialogInterface d, int which) {
+ saveAutoLoginAccount(mPref, mAccounts[which].name);
+ d.dismiss();
+ }
+ }
+
+ private void saveAutoLoginAccount(CheckBoxPreference pref, String name) {
+ mSettings.setAutoLoginAccount(getActivity(), name);
+ pref.setChecked(true);
+ updateAutoLoginSummary(pref);
+ }
+
+ private void selectAccount(CheckBoxPreference pref) {
+ Account[] accounts = GoogleAccountLogin.getAccounts(getActivity());
+ if (accounts.length == 0) {
+ mSettings.setAutoLoginAccount(getActivity(), null);
+ updateAutoLoginSummary(pref);
+ return;
+ } else if (accounts.length == 1) {
+ // No need for a dialog with one account.
+ saveAutoLoginAccount(pref, accounts[0].name);
+ return;
+ }
+
+ String account = mSettings.getAutoLoginAccount(getActivity());
+ CharSequence[] names = new CharSequence[accounts.length];
+ int i = 0;
+ int defaultAccount = 0;
+ for (Account a : accounts) {
+ if (a.name.equals(account)) {
+ defaultAccount = i;
+ }
+ names[i++] = a.name;
+ }
+
+ AccountCallback callback =
+ new AccountCallback(accounts, pref);
+ new AlertDialog.Builder(getActivity())
+ .setTitle(R.string.pref_autologin_title)
+ .setSingleChoiceItems(names, defaultAccount, callback)
+ .setCancelable(true)
+ .show();
+ }
}
diff --git a/src/com/android/browser/widget/BookmarkListWidgetProvider.java b/src/com/android/browser/widget/BookmarkThumbnailWidgetProvider.java
similarity index 71%
rename from src/com/android/browser/widget/BookmarkListWidgetProvider.java
rename to src/com/android/browser/widget/BookmarkThumbnailWidgetProvider.java
index 99daaa1..14e1c89 100644
--- a/src/com/android/browser/widget/BookmarkListWidgetProvider.java
+++ b/src/com/android/browser/widget/BookmarkThumbnailWidgetProvider.java
@@ -16,7 +16,6 @@
package com.android.browser.widget;
-import com.android.browser.BrowserActivity;
import com.android.browser.R;
import android.app.PendingIntent;
@@ -31,7 +30,7 @@
/**
* Widget that shows a preview of the user's bookmarks.
*/
-public class BookmarkListWidgetProvider extends AppWidgetProvider {
+public class BookmarkThumbnailWidgetProvider extends AppWidgetProvider {
static final String ACTION_BOOKMARK_APPWIDGET_UPDATE =
"com.android.browser.BOOKMARK_APPWIDGET_UPDATE";
@@ -60,46 +59,37 @@
@Override
public void onEnabled(Context context) {
// Start the backing service
- context.startService(new Intent(context, BookmarkListWidgetService.class));
+ context.startService(new Intent(context, BookmarkThumbnailWidgetService.class));
}
@Override
public void onDisabled(Context context) {
// Stop the backing service
- context.stopService(new Intent(context, BookmarkListWidgetService.class));
+ context.stopService(new Intent(context, BookmarkThumbnailWidgetService.class));
}
@Override
public void onDeleted(Context context, int[] appWidgetIds) {
super.onDeleted(context, appWidgetIds);
- context.startService(new Intent(BookmarkListWidgetService.ACTION_REMOVE_FACTORIES,
- null, context, BookmarkListWidgetService.class)
+ context.startService(new Intent(BookmarkThumbnailWidgetService.ACTION_REMOVE_FACTORIES,
+ null, context, BookmarkThumbnailWidgetService.class)
.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds));
}
private void performUpdate(Context context,
AppWidgetManager appWidgetManager, int[] appWidgetIds) {
- Intent launchBrowser = new Intent(BrowserActivity.ACTION_SHOW_BROWSER,
- null, context, BrowserActivity.class);
- Intent launchBookmarks = new Intent(BrowserActivity.ACTION_SHOW_BOOKMARKS,
- null, context, BrowserActivity.class);
- // Update the widgets
for (int appWidgetId : appWidgetIds) {
- Intent updateIntent = new Intent(context, BookmarkListWidgetService.class);
+ Intent updateIntent = new Intent(context, BookmarkThumbnailWidgetService.class);
updateIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
updateIntent.setData(Uri.parse(updateIntent.toUri(Intent.URI_INTENT_SCHEME)));
RemoteViews views = new RemoteViews(context.getPackageName(),
- R.layout.bookmarklistwidget);
+ R.layout.bookmarkthumbnailwidget);
views.setRemoteAdapter(R.id.bookmarks_list, updateIntent);
appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetId, R.id.bookmarks_list);
- Intent ic = new Intent(context, BookmarkListWidgetService.class);
+ Intent ic = new Intent(context, BookmarkThumbnailWidgetService.class);
views.setPendingIntentTemplate(R.id.bookmarks_list,
PendingIntent.getService(context, 0, ic,
PendingIntent.FLAG_UPDATE_CURRENT));
- views.setOnClickPendingIntent(R.id.header_browser, PendingIntent
- .getActivity(context, 0, launchBrowser, PendingIntent.FLAG_CANCEL_CURRENT));
- views.setOnClickPendingIntent(R.id.header_bookmarks, PendingIntent
- .getActivity(context, 0, launchBookmarks, PendingIntent.FLAG_CANCEL_CURRENT));
appWidgetManager.updateAppWidget(appWidgetId, views);
}
}
@@ -109,6 +99,6 @@
* {@link AppWidgetProvider}
*/
static ComponentName getComponentName(Context context) {
- return new ComponentName(context, BookmarkListWidgetProvider.class);
+ return new ComponentName(context, BookmarkThumbnailWidgetProvider.class);
}
}
diff --git a/src/com/android/browser/widget/BookmarkListWidgetService.java b/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
similarity index 87%
rename from src/com/android/browser/widget/BookmarkListWidgetService.java
rename to src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
index 4d72d41..51ba2ca 100644
--- a/src/com/android/browser/widget/BookmarkListWidgetService.java
+++ b/src/com/android/browser/widget/BookmarkThumbnailWidgetService.java
@@ -16,7 +16,6 @@
package com.android.browser.widget;
-import com.android.browser.BookmarkUtils;
import com.android.browser.BrowserBookmarksPage;
import com.android.browser.R;
@@ -49,9 +48,9 @@
import java.util.Map;
import java.util.Stack;
-public class BookmarkListWidgetService extends RemoteViewsService {
+public class BookmarkThumbnailWidgetService extends RemoteViewsService {
- static final String TAG = "BookmarkListWidgetService";
+ static final String TAG = "BookmarkThumbnailWidgetService";
static final boolean USE_FOLDERS = true;
static final String ACTION_REMOVE_FACTORIES
@@ -66,13 +65,15 @@
BrowserContract.Bookmarks.FAVICON,
BrowserContract.Bookmarks.IS_FOLDER,
BrowserContract.Bookmarks.TOUCH_ICON,
- BrowserContract.Bookmarks.POSITION /* needed for order by */};
+ BrowserContract.Bookmarks.POSITION, /* needed for order by */
+ BrowserContract.Bookmarks.THUMBNAIL};
private static final int BOOKMARK_INDEX_ID = 0;
private static final int BOOKMARK_INDEX_TITLE = 1;
private static final int BOOKMARK_INDEX_URL = 2;
private static final int BOOKMARK_INDEX_FAVICON = 3;
private static final int BOOKMARK_INDEX_IS_FOLDER = 4;
private static final int BOOKMARK_INDEX_TOUCH_ICON = 5;
+ private static final int BOOKMARK_INDEX_THUMBNAIL = 7;
private Map<Integer, BookmarkFactory> mFactories;
private Handler mUiHandler;
@@ -223,12 +224,12 @@
Breadcrumb folder = mBreadcrumbs.empty() ? null : mBreadcrumbs.peek();
RemoteViews views = new RemoteViews(
- mContext.getPackageName(), R.layout.bookmarklistwidget_item);
+ mContext.getPackageName(), R.layout.bookmarkthumbnailwidget_item);
Intent fillin;
if (res.mIsFolder) {
long nfi = res.mId;
fillin = new Intent(ACTION_CHANGE_FOLDER, null,
- mContext, BookmarkListWidgetService.class)
+ mContext, BookmarkThumbnailWidgetService.class)
.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mWidgetId)
.putExtra(Bookmarks._ID, nfi);
} else {
@@ -244,21 +245,28 @@
displayTitle = res.mUrl;
}
views.setTextViewText(R.id.label, displayTitle);
- views.setDrawableParameters(R.id.list_item, true, 0, -1, null, -1);
if (res.mIsFolder) {
if (folder != null && res.mId == folder.mId) {
- views.setImageViewResource(R.id.thumb, R.drawable.btn_ic_back_bookmark_widget_holo_dark);
- views.setDrawableParameters(R.id.list_item, true, 255, -1, null, -1);
+ views.setImageViewResource(R.id.thumb, R.drawable.thumb_bookmark_widget_folder_back_holo);
} else {
- views.setImageViewResource(R.id.thumb, R.drawable.ic_folder_bookmark_widget_holo_dark);
+ views.setImageViewResource(R.id.thumb, R.drawable.thumb_bookmark_widget_folder_holo);
}
+ views.setImageViewResource(R.id.favicon, R.drawable.ic_bookmark_widget_bookmark_holo_dark);
+ views.setDrawableParameters(R.id.thumb, true, 0, -1, null, -1);
} else {
- if (res.mBitmap != null) {
- views.setImageViewBitmap(R.id.thumb, res.mBitmap);
+ views.setDrawableParameters(R.id.thumb, true, 255, -1, null, -1);
+ if (res.mThumbnail != null) {
+ views.setImageViewBitmap(R.id.thumb, res.mThumbnail);
} else {
views.setImageViewResource(R.id.thumb,
R.drawable.browser_thumbnail);
}
+ if (res.mIcon != null) {
+ views.setImageViewBitmap(R.id.favicon, res.mIcon);
+ } else {
+ views.setImageViewResource(R.id.favicon,
+ R.drawable.app_web_browser_sm);
+ }
}
return views;
}
@@ -364,35 +372,19 @@
// RemoteViews require a valid bitmap config
Options options = new Options();
options.inPreferredConfig = Config.ARGB_8888;
- Bitmap favIcon = null;
- Bitmap touchIcon = null;
- byte[] blob = c.getBlob(BOOKMARK_INDEX_TOUCH_ICON);
+ Bitmap thumbnail = null, favicon = null;
+ byte[] blob = c.getBlob(BOOKMARK_INDEX_THUMBNAIL);
if (blob != null && blob.length > 0) {
- touchIcon = BitmapFactory.decodeByteArray(
+ thumbnail = BitmapFactory.decodeByteArray(
blob, 0, blob.length, options);
- } else {
- blob = c.getBlob(BOOKMARK_INDEX_FAVICON);
- if (blob != null && blob.length > 0) {
- favIcon = BitmapFactory.decodeByteArray(
- blob, 0, blob.length, options);
- }
}
-
- if (favIcon == null) {
- favIcon = BitmapFactory.decodeResource(
- mContext.getResources(),
- R.drawable.app_web_browser_sm);
+ blob = c.getBlob(BOOKMARK_INDEX_FAVICON);
+ if (blob != null && blob.length > 0) {
+ favicon = BitmapFactory.decodeByteArray(
+ blob, 0, blob.length, options);
}
- if (touchIcon != null || favIcon != null) {
- res.mBitmap = BookmarkUtils.createListWidgetIcon(
- mContext, touchIcon, favIcon);
- }
- if (touchIcon != null) {
- touchIcon.recycle();
- }
- if (favIcon != null) {
- favIcon.recycle();
- }
+ res.mThumbnail = thumbnail;
+ res.mIcon = favicon;
}
bookmarks.add(res);
}
@@ -412,9 +404,9 @@
// Do a bit of house cleaning for the system
if (mBookmarks != null) {
for (RenderResult res : mBookmarks) {
- if (res.mBitmap != null) {
- res.mBitmap.recycle();
- res.mBitmap = null;
+ if (res.mThumbnail != null) {
+ res.mThumbnail.recycle();
+ res.mThumbnail = null;
}
}
}
@@ -440,7 +432,8 @@
private static class RenderResult {
final String mTitle;
final String mUrl;
- Bitmap mBitmap;
+ Bitmap mThumbnail;
+ Bitmap mIcon;
boolean mIsFolder;
long mId;