summaryrefslogtreecommitdiffstats
path: root/src/com/android
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2009-08-04 16:04:55 -0400
committerLeon Scroggins <scroggo@google.com>2009-08-04 16:16:27 -0400
commit0c7865002753aea5de117ea4c08043dca95d07b6 (patch)
treeb6c3286559bef67c46686296269db0ea2e13ea81 /src/com/android
parent2b0da96f012b02c16adbec3fe040dea721e2f333 (diff)
downloadpackages_apps_Browser-0c7865002753aea5de117ea4c08043dca95d07b6.zip
packages_apps_Browser-0c7865002753aea5de117ea4c08043dca95d07b6.tar.gz
packages_apps_Browser-0c7865002753aea5de117ea4c08043dca95d07b6.tar.bz2
Updates for the look of the bookmarks page.
Add new assets. -tab_indicator.xml State selector for the background of tabs in the CombinedHistoryActivity -bookmark_thumnail.xml Web page title is now above the thumb. Removed the favicon. Added a shadow. -tab_header.xml Layout for the tabs in CombinedHistoryActivity -tabs.xml Change the height of the tabs. -bookmarks.xml Remove the title for the "switch" menu item, which gets set in Java, depending on the current viewing mode. -strings.xml Remove the placeholder menu item text, add the actual text for switching between modes. -BrowserBookmarksAdapter No longer set the favicon on top of the bookmark thumbs in grid mode. -BrowserBookmarksPage Implement onPrepareOptionsMenu, and set the title of a menu option, depending on the current viewing state. -CombinedHistoryActivity Create a common function for setting up all the tabs. Change the look of the tabs to match the new design.
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/browser/BrowserBookmarksAdapter.java11
-rw-r--r--src/com/android/browser/BrowserBookmarksPage.java8
-rw-r--r--src/com/android/browser/CombinedBookmarkHistoryActivity.java32
3 files changed, 25 insertions, 26 deletions
diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java
index 75be45b..764daea 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 428aa92..5abdbb3 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 963f179..26fd1ee 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) {