diff options
| author | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-05 06:04:41 -0700 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-08-05 06:04:41 -0700 |
| commit | 13feaed9ab1b9a3b8cc5ac1b33e36005802b9fc3 (patch) | |
| tree | ace66be6d2e5d79ec500a367f99920101e8f2c74 | |
| parent | 41354d092d2b05392954567d55b8bc6a531855d6 (diff) | |
| parent | 0c7865002753aea5de117ea4c08043dca95d07b6 (diff) | |
| download | packages_apps_Browser-13feaed9ab1b9a3b8cc5ac1b33e36005802b9fc3.tar.gz packages_apps_Browser-13feaed9ab1b9a3b8cc5ac1b33e36005802b9fc3.tar.bz2 packages_apps_Browser-13feaed9ab1b9a3b8cc5ac1b33e36005802b9fc3.zip | |
Merge change 9700
* changes:
Updates for the look of the bookmarks page.
| -rw-r--r-- | res/drawable/bookmark_shadow.9.png | bin | 0 -> 501 bytes | |||
| -rw-r--r-- | res/drawable/minitab_focus.9.png | bin | 0 -> 47833 bytes | |||
| -rw-r--r-- | res/drawable/minitab_press.9.png | bin | 0 -> 48225 bytes | |||
| -rw-r--r-- | res/drawable/minitab_selected.9.png | bin | 0 -> 48121 bytes | |||
| -rw-r--r-- | res/drawable/minitab_unselected.9.png | bin | 0 -> 47724 bytes | |||
| -rw-r--r-- | res/drawable/tab_indicator.xml | 42 | ||||
| -rw-r--r-- | res/layout/bookmark_thumbnail.xml | 49 | ||||
| -rw-r--r-- | res/layout/tab_header.xml | 30 | ||||
| -rw-r--r-- | res/layout/tabs.xml | 2 | ||||
| -rw-r--r-- | res/menu/bookmarks.xml | 2 | ||||
| -rw-r--r-- | res/values/strings.xml | 9 | ||||
| -rw-r--r-- | src/com/android/browser/BrowserBookmarksAdapter.java | 11 | ||||
| -rw-r--r-- | src/com/android/browser/BrowserBookmarksPage.java | 8 | ||||
| -rw-r--r-- | src/com/android/browser/CombinedBookmarkHistoryActivity.java | 32 |
14 files changed, 128 insertions, 57 deletions
diff --git a/res/drawable/bookmark_shadow.9.png b/res/drawable/bookmark_shadow.9.png Binary files differnew file mode 100644 index 000000000..3c706be68 --- /dev/null +++ b/res/drawable/bookmark_shadow.9.png diff --git a/res/drawable/minitab_focus.9.png b/res/drawable/minitab_focus.9.png Binary files differnew file mode 100644 index 000000000..7c290e363 --- /dev/null +++ b/res/drawable/minitab_focus.9.png diff --git a/res/drawable/minitab_press.9.png b/res/drawable/minitab_press.9.png Binary files differnew file mode 100644 index 000000000..c7369e73c --- /dev/null +++ b/res/drawable/minitab_press.9.png diff --git a/res/drawable/minitab_selected.9.png b/res/drawable/minitab_selected.9.png Binary files differnew file mode 100644 index 000000000..849e12423 --- /dev/null +++ b/res/drawable/minitab_selected.9.png diff --git a/res/drawable/minitab_unselected.9.png b/res/drawable/minitab_unselected.9.png Binary files differnew file mode 100644 index 000000000..e12b36daf --- /dev/null +++ b/res/drawable/minitab_unselected.9.png diff --git a/res/drawable/tab_indicator.xml b/res/drawable/tab_indicator.xml new file mode 100644 index 000000000..839532b93 --- /dev/null +++ b/res/drawable/tab_indicator.xml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 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_selected="true" + android:state_focused="false" + android:state_pressed="false" + android:drawable="@drawable/minitab_selected" + /> + <item + android:state_selected="false" + android:state_focused="false" + android:state_pressed="false" + android:drawable="@drawable/minitab_unselected" + /> + <item + android:state_focused="true" + android:state_selected="true" + android:state_pressed="false" + android:drawable="@drawable/minitab_focus" + /> + <item + android:state_pressed="true" + android:state_selected="true" + android:state_focused="true" + android:drawable="@drawable/minitab_press" + /> +</selector> diff --git a/res/layout/bookmark_thumbnail.xml b/res/layout/bookmark_thumbnail.xml index c1e0cd266..b3d39a4c4 100644 --- a/res/layout/bookmark_thumbnail.xml +++ b/res/layout/bookmark_thumbnail.xml @@ -20,21 +20,36 @@ android:padding="4dip" > + <!-- Keep the width in sync with BrowserBookmarksPage and + BrowserActivity.updateScreenshot --> + <TextView android:id="@+id/label" + android:layout_width="100dip" + android:layout_height="wrap_content" + android:layout_gravity="bottom" + android:textAppearance="?android:attr/textAppearanceSmall" + android:textStyle="bold" + android:textColor="@color/white" + android:maxLines="1" + android:paddingTop="3dip" + android:paddingBottom="3dip" + android:paddingLeft="2dip" + android:paddingRight="2dip" + android:scrollHorizontally="true" + android:ellipsize="marquee" + /> + <ImageView android:id="@+id/thumb" android:src="@drawable/blank" android:scaleType="center" android:layout_width="100dip" android:layout_height="80dip" + android:background="@drawable/bookmark_shadow" + android:layout_below="@+id/label" /> - <ImageView android:id="@+id/fav" - android:scaleType="fitCenter" - android:layout_width="20dip" - android:layout_height="20dip" - android:padding="2dip" - android:layout_alignBottom="@+id/thumb" - android:background="@drawable/fav_icn_background" - /> + <!-- FIXME: Want to have a gradient over the thumb --> + + <!-- This holds the star for addbookmark --> <LinearLayout android:id="@+id/holder" android:layout_height="wrap_content" android:layout_width="fill_parent" @@ -59,22 +74,4 @@ android:text="@string/add_bookmark_short" /> </LinearLayout> - <!-- Keep the width in sync with BrowserBookmarksPage and - BrowserActivity.updateScreenshot --> - <TextView android:id="@+id/label" - android:layout_width="100dip" - android:layout_height="wrap_content" - android:layout_below="@+id/thumb" - android:layout_gravity="bottom" - android:textAppearance="?android:attr/textAppearanceSmall" - android:textStyle="bold" - android:textColor="@color/white" - android:maxLines="1" - android:paddingTop="3dip" - android:paddingBottom="3dip" - android:paddingLeft="2dip" - android:paddingRight="2dip" - android:scrollHorizontally="true" - android:ellipsize="marquee" - /> </RelativeLayout> diff --git a/res/layout/tab_header.xml b/res/layout/tab_header.xml new file mode 100644 index 000000000..7187034db --- /dev/null +++ b/res/layout/tab_header.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2009 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="fill_parent" + android:layout_height="wrap_content" + android:background="@drawable/tab_indicator" + > + <TextView + android:id="@+id/tab_label" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="?android:attr/textColorPrimary" + android:layout_gravity="center" + /> +</FrameLayout> diff --git a/res/layout/tabs.xml b/res/layout/tabs.xml index 7cf5b5d69..4fa102b04 100644 --- a/res/layout/tabs.xml +++ b/res/layout/tabs.xml @@ -26,7 +26,7 @@ <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" - android:layout_height="68dip" + android:layout_height="wrap_content" android:paddingLeft="1dip" android:paddingRight="1dip" android:paddingTop="4dip" diff --git a/res/menu/bookmarks.xml b/res/menu/bookmarks.xml index 8a6e32ed6..f768c9832 100644 --- a/res/menu/bookmarks.xml +++ b/res/menu/bookmarks.xml @@ -19,5 +19,5 @@ android:icon="@android:drawable/ic_menu_add" android:title="@string/bookmark_page" /> <item android:id="@+id/switch_mode_menu_id" - android:title="@string/switch_mode"/> + /> </menu> diff --git a/res/values/strings.xml b/res/values/strings.xml index c6006667d..47f1a60bd 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -169,9 +169,12 @@ currently on, but is not visible because the bookmarks page is showing. --> <string name="bookmark_page">Bookmark last-viewed page</string> - <!-- Menu item in the page that displays all bookmarks. Switches between - a vertical list view and a grid view which shows thumbnails --> - <string name="switch_mode">Switch viewing mode</string> + <!-- Menu item in the page that displays all bookmarks. Switches to + a grid view which shows thumbnails --> + <string name="switch_to_thumbnails">Thumbnail view</string> + <!-- Menu item in the page that displays all bookmarks. Switches to a + list view which shows titles --> + <string name="switch_to_list">List view</string> <!-- Summary text under the New Bookmark item on the Bookmarks screen. Tells the user that if they select this item, it will bring up a dialog to bookmark the page that the browser is currently viewing, diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java index 75be45b59..764daea5d 100644 --- a/src/com/android/browser/BrowserBookmarksAdapter.java +++ b/src/com/android/browser/BrowserBookmarksAdapter.java @@ -368,13 +368,11 @@ class BrowserBookmarksAdapter extends BaseAdapter { } View holder = convertView.findViewById(R.id.holder); ImageView thumb = (ImageView) convertView.findViewById(R.id.thumb); - ImageView fav = (ImageView) convertView.findViewById(R.id.fav); TextView tv = (TextView) convertView.findViewById(R.id.label); if (0 == position && !mCreateShortcut) { // This is to create a bookmark for the current page. holder.setVisibility(View.VISIBLE); - fav.setVisibility(View.GONE); tv.setText(mCurrentTitle); // FIXME: Want to show the screenshot of the current page thumb.setImageResource(R.drawable.blank); @@ -393,15 +391,6 @@ class BrowserBookmarksAdapter extends BaseAdapter { thumb.setImageBitmap( BitmapFactory.decodeByteArray(data, 0, data.length)); } - // Now show the favicon - data = mCursor.getBlob(Browser.HISTORY_PROJECTION_FAVICON_INDEX); - if (data == null) { - fav.setVisibility(View.GONE); - } else { - fav.setVisibility(View.VISIBLE); - fav.setImageBitmap( - BitmapFactory.decodeByteArray(data, 0, data.length)); - } return convertView; diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java index 428aa92b0..5abdbb39b 100644 --- a/src/com/android/browser/BrowserBookmarksPage.java +++ b/src/com/android/browser/BrowserBookmarksPage.java @@ -344,6 +344,14 @@ public class BrowserBookmarksPage extends Activity implements } @Override + public boolean onPrepareOptionsMenu(Menu menu) { + menu.findItem(R.id.switch_mode_menu_id).setTitle( + mGridMode ? R.string.switch_to_list + : R.string.switch_to_thumbnails); + return true; + } + + @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.new_context_menu_id: diff --git a/src/com/android/browser/CombinedBookmarkHistoryActivity.java b/src/com/android/browser/CombinedBookmarkHistoryActivity.java index 963f1792f..26fd1eea8 100644 --- a/src/com/android/browser/CombinedBookmarkHistoryActivity.java +++ b/src/com/android/browser/CombinedBookmarkHistoryActivity.java @@ -27,6 +27,9 @@ import android.provider.Browser; import android.webkit.WebIconDatabase.IconListener; import android.widget.TabHost; import android.widget.TabHost.TabSpec; +import android.widget.TextView; +import android.view.LayoutInflater; +import android.view.View; import android.view.Window; import java.util.HashMap; @@ -77,40 +80,39 @@ public class CombinedBookmarkHistoryActivity extends TabActivity super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.tabs); - TabHost tabHost = getTabHost(); - tabHost.setOnTabChangedListener(this); + getTabHost().setOnTabChangedListener(this); Bundle extras = getIntent().getExtras(); Resources resources = getResources(); getIconListenerSet(getContentResolver()); + Intent bookmarksIntent = new Intent(this, BrowserBookmarksPage.class); bookmarksIntent.putExtras(extras); - tabHost.addTab(tabHost.newTabSpec(BOOKMARKS_TAB) - .setIndicator(resources.getString(R.string.tab_bookmarks), - resources.getDrawable(R.drawable.browser_bookmark_tab)) - .setContent(bookmarksIntent)); + createTab(bookmarksIntent, R.string.tab_bookmarks, BOOKMARKS_TAB); Intent visitedIntent = new Intent(this, MostVisitedActivity.class); visitedIntent.putExtras(extras); - tabHost.addTab(tabHost.newTabSpec(VISITED_TAB) - .setIndicator(resources.getString(R.string.tab_most_visited), - resources.getDrawable(R.drawable.browser_visited_tab)) - .setContent(visitedIntent)); + createTab(visitedIntent, R.string.tab_most_visited, VISITED_TAB); Intent historyIntent = new Intent(this, BrowserHistoryPage.class); historyIntent.putExtras(extras); - tabHost.addTab(tabHost.newTabSpec(HISTORY_TAB) - .setIndicator(resources.getString(R.string.tab_history), - resources.getDrawable(R.drawable. - browser_history_tab)).setContent(historyIntent)); + createTab(historyIntent, R.string.tab_history, HISTORY_TAB); String defaultTab = extras.getString(STARTING_TAB); if (defaultTab != null) { - tabHost.setCurrentTab(2); + getTabHost().setCurrentTab(2); } } + private void createTab(Intent intent, int labelResId, String tab) { + LayoutInflater factory = LayoutInflater.from(this); + View tabHeader = factory.inflate(R.layout.tab_header, null); + TextView textView = (TextView) tabHeader.findViewById(R.id.tab_label); + textView.setText(labelResId); + TabHost tabHost = getTabHost(); + tabHost.addTab(tabHost.newTabSpec(tab).setIndicator(tabHeader).setContent(intent)); + } // Copied from DialTacts Activity /** {@inheritDoc} */ public void onTabChanged(String tabId) { |
