summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2012-04-24 15:31:16 -0700
committerJohn Reck <jreck@google.com>2012-04-24 15:31:16 -0700
commitaf991f93d09bf4d2db3c7a8c03ca3ca4352bed83 (patch)
tree859fe4aa613b5b43229cd9bacd24aac8cc9d14b7
parent163ae530dccd6d7f116dcd4b837e71ef202987ea (diff)
downloadpackages_apps_browser-af991f93d09bf4d2db3c7a8c03ca3ca4352bed83.zip
packages_apps_browser-af991f93d09bf4d2db3c7a8c03ca3ca4352bed83.tar.gz
packages_apps_browser-af991f93d09bf4d2db3c7a8c03ca3ca4352bed83.tar.bz2
Remove unused code
Change-Id: Ia38f8aabbb5cfa1cceab160f4285e7b86aac2c17
-rw-r--r--src/com/android/browser/BookmarksLoader.java1
-rw-r--r--src/com/android/browser/BrowserBookmarksAdapter.java64
-rw-r--r--src/com/android/browser/BrowserBookmarksAdapterItem.java1
-rw-r--r--src/com/android/browser/BrowserBookmarksPage.java5
-rw-r--r--src/com/android/browser/view/BookmarkExpandableView.java33
5 files changed, 4 insertions, 100 deletions
diff --git a/src/com/android/browser/BookmarksLoader.java b/src/com/android/browser/BookmarksLoader.java
index 80d4255..8601c98 100644
--- a/src/com/android/browser/BookmarksLoader.java
+++ b/src/com/android/browser/BookmarksLoader.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.content.CursorLoader;
import android.net.Uri;
import android.provider.BrowserContract.Bookmarks;
-import android.provider.BrowserContract.ChromeSyncColumns;
public class BookmarksLoader extends CursorLoader {
public static final String ARG_ACCOUNT_TYPE = "acct_type";
diff --git a/src/com/android/browser/BrowserBookmarksAdapter.java b/src/com/android/browser/BrowserBookmarksAdapter.java
index be3c211..93cf5d9 100644
--- a/src/com/android/browser/BrowserBookmarksAdapter.java
+++ b/src/com/android/browser/BrowserBookmarksAdapter.java
@@ -35,52 +35,32 @@ public class BrowserBookmarksAdapter extends
ThreadedCursorAdapter<BrowserBookmarksAdapterItem> {
LayoutInflater mInflater;
- int mCurrentView;
Context mContext;
/**
* Create a new BrowserBookmarksAdapter.
*/
- public BrowserBookmarksAdapter(Context context, int defaultView) {
+ public BrowserBookmarksAdapter(Context context) {
// Make sure to tell the CursorAdapter to avoid the observer and auto-requery
// since the Loader will do that for us.
super(context, null);
mInflater = LayoutInflater.from(context);
mContext = context;
- selectView(defaultView);
}
@Override
public View newView(Context context, ViewGroup parent) {
- if (mCurrentView == BrowserBookmarksPage.VIEW_LIST) {
- return mInflater.inflate(R.layout.bookmark_list, parent, false);
- } else {
- return mInflater.inflate(R.layout.bookmark_thumbnail, parent, false);
- }
+ return mInflater.inflate(R.layout.bookmark_thumbnail, parent, false);
}
@Override
public void bindView(View view, BrowserBookmarksAdapterItem object) {
BookmarkContainer container = (BookmarkContainer) view;
container.setIgnoreRequestLayout(true);
- if (mCurrentView == BrowserBookmarksPage.VIEW_LIST) {
- bindListView(view, mContext, object);
- } else {
- bindGridView(view, mContext, object);
- }
+ bindGridView(view, mContext, object);
container.setIgnoreRequestLayout(false);
}
- void clearView(View view) {
- if (mCurrentView == BrowserBookmarksPage.VIEW_LIST) {
- ImageView favicon = (ImageView) view.findViewById(R.id.favicon);
- favicon.setImageBitmap(null);
- } else {
- ImageView thumb = (ImageView) view.findViewById(R.id.thumb);
- thumb.setImageBitmap(null);
- }
- }
-
CharSequence getTitle(Cursor cursor) {
int type = cursor.getInt(BookmarksLoader.COLUMN_INDEX_TYPE);
switch (type) {
@@ -117,53 +97,15 @@ public class BrowserBookmarksAdapter extends
}
}
- void bindListView(View view, Context context, BrowserBookmarksAdapterItem item) {
- ImageView favicon = (ImageView) view.findViewById(R.id.favicon);
- TextView tv = (TextView) view.findViewById(R.id.label);
-
- tv.setText(item.title);
- if (item.is_folder) {
- // folder
- favicon.setImageResource(R.drawable.ic_folder_holo_dark);
- favicon.setBackground(null);
- } else {
- if (item.favicon == null) {
- favicon.setImageResource(R.drawable.app_web_browser_sm);
- } else {
- favicon.setImageDrawable(item.favicon);
- }
- favicon.setBackgroundResource(R.drawable.bookmark_list_favicon_bg);
- }
- }
-
- public void selectView(int view) {
- if (view != BrowserBookmarksPage.VIEW_LIST
- && view != BrowserBookmarksPage.VIEW_THUMBNAILS) {
- throw new IllegalArgumentException("Unknown view specified: " + view);
- }
- mCurrentView = view;
- }
-
- public int getViewMode() {
- return mCurrentView;
- }
-
@Override
public BrowserBookmarksAdapterItem getRowObject(Cursor c,
BrowserBookmarksAdapterItem item) {
if (item == null) {
item = new BrowserBookmarksAdapterItem();
}
- Bitmap favicon = item.favicon != null ? item.favicon.getBitmap() : null;
Bitmap thumbnail = item.thumbnail != null ? item.thumbnail.getBitmap() : null;
- favicon = BrowserBookmarksPage.getBitmap(c,
- BookmarksLoader.COLUMN_INDEX_FAVICON, favicon);
thumbnail = BrowserBookmarksPage.getBitmap(c,
BookmarksLoader.COLUMN_INDEX_THUMBNAIL, thumbnail);
- if (favicon != null
- && (item.favicon == null || item.favicon.getBitmap() != favicon)) {
- item.favicon = new BitmapDrawable(mContext.getResources(), favicon);
- }
if (thumbnail != null
&& (item.thumbnail == null || item.thumbnail.getBitmap() != thumbnail)) {
item.thumbnail = new BitmapDrawable(mContext.getResources(), thumbnail);
diff --git a/src/com/android/browser/BrowserBookmarksAdapterItem.java b/src/com/android/browser/BrowserBookmarksAdapterItem.java
index ee2ed70..64b1ca2 100644
--- a/src/com/android/browser/BrowserBookmarksAdapterItem.java
+++ b/src/com/android/browser/BrowserBookmarksAdapterItem.java
@@ -20,7 +20,6 @@ import android.graphics.drawable.BitmapDrawable;
public class BrowserBookmarksAdapterItem {
public String url;
public CharSequence title;
- public BitmapDrawable favicon;
public BitmapDrawable thumbnail;
public boolean is_folder;
}
diff --git a/src/com/android/browser/BrowserBookmarksPage.java b/src/com/android/browser/BrowserBookmarksPage.java
index a038a2d..597abf7 100644
--- a/src/com/android/browser/BrowserBookmarksPage.java
+++ b/src/com/android/browser/BrowserBookmarksPage.java
@@ -93,9 +93,6 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
static final String ACCOUNT_TYPE = "account_type";
static final String ACCOUNT_NAME = "account_name";
- public static final int VIEW_THUMBNAILS = 1;
- public static final int VIEW_LIST = 2;
-
BookmarksPageCallbacks mCallbacks;
View mRoot;
BookmarkExpandableView mGrid;
@@ -134,7 +131,7 @@ public class BrowserBookmarksPage extends Fragment implements View.OnCreateConte
args.putString(ACCOUNT_NAME, accountName);
args.putString(ACCOUNT_TYPE, accountType);
BrowserBookmarksAdapter adapter = new BrowserBookmarksAdapter(
- getActivity(), VIEW_THUMBNAILS);
+ getActivity());
mBookmarkAdapters.put(id, adapter);
boolean expand = true;
try {
diff --git a/src/com/android/browser/view/BookmarkExpandableView.java b/src/com/android/browser/view/BookmarkExpandableView.java
index 0283448..da96438 100644
--- a/src/com/android/browser/view/BookmarkExpandableView.java
+++ b/src/com/android/browser/view/BookmarkExpandableView.java
@@ -38,7 +38,6 @@ import com.android.browser.BookmarkDragHandler.BookmarkDragAdapter;
import com.android.browser.BookmarkDragHandler.BookmarkDragState;
import com.android.browser.BreadCrumbView;
import com.android.browser.BrowserBookmarksAdapter;
-import com.android.browser.BrowserBookmarksPage;
import com.android.browser.BrowserBookmarksPage.ExtraDragState;
import com.android.browser.R;
import com.android.internal.view.menu.MenuBuilder;
@@ -67,7 +66,6 @@ public class BookmarkExpandableView extends ExpandableListView
private BreadCrumbView.Controller mBreadcrumbController;
private BookmarkDragHandler mDragHandler;
private int mMaxColumnCount;
- private int mCurrentView = -1;
public BookmarkExpandableView(Context context) {
super(context);
@@ -141,9 +139,6 @@ public class BookmarkExpandableView extends ExpandableListView
adapter.registerDataSetObserver(mAdapter.mObserver);
}
} else {
- if (mCurrentView >= 0) {
- adapter.selectView(mCurrentView);
- }
mAdapter.mGroups.add(accountName);
mAdapter.mChildren.add(adapter);
adapter.registerDataSetObserver(mAdapter.mObserver);
@@ -314,14 +309,6 @@ public class BookmarkExpandableView extends ExpandableListView
return mAdapter.getBreadCrumbView(groupPosition);
}
- public void selectView(int view) {
- mCurrentView = view;
- for (BrowserBookmarksAdapter adapter : mAdapter.mChildren) {
- adapter.selectView(mCurrentView);
- }
- mAdapter.notifyDataSetChanged();
- }
-
public JSONObject saveGroupState() throws JSONException {
JSONObject obj = new JSONObject();
int count = mAdapter.getGroupCount();
@@ -386,9 +373,6 @@ public class BookmarkExpandableView extends ExpandableListView
}
BrowserBookmarksAdapter childAdapter = mChildren.get(groupPosition);
int rowCount = mRowCount;
- if (childAdapter.getViewMode() == BrowserBookmarksPage.VIEW_LIST) {
- rowCount = 1;
- }
LinearLayout row = (LinearLayout) convertView;
if (row.getChildCount() > rowCount) {
row.removeViews(rowCount, row.getChildCount() - rowCount);
@@ -428,9 +412,6 @@ public class BookmarkExpandableView extends ExpandableListView
@Override
public int getChildrenCount(int groupPosition) {
BrowserBookmarksAdapter adapter = mChildren.get(groupPosition);
- if (adapter.getViewMode() == BrowserBookmarksPage.VIEW_LIST) {
- return adapter.getCount();
- }
return (int) Math.ceil(adapter.getCount() / (float)mRowCount);
}
@@ -517,20 +498,6 @@ public class BookmarkExpandableView extends ExpandableListView
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
-
- @Override
- public int getChildTypeCount() {
- return 2;
- }
-
- @Override
- public int getChildType(int groupPosition, int childPosition) {
- BrowserBookmarksAdapter adapter = mChildren.get(groupPosition);
- if (adapter.getViewMode() == BrowserBookmarksPage.VIEW_LIST) {
- return 1;
- }
- return 0;
- }
}
public static class BookmarkContextMenuInfo implements ContextMenuInfo {