summaryrefslogtreecommitdiffstats
path: root/src/com/android/browser/addbookmark
diff options
context:
space:
mode:
authorLeon Scroggins <scroggo@google.com>2011-02-11 14:02:10 -0500
committerLeon Scroggins <scroggo@google.com>2011-02-14 11:39:00 -0500
commit2f24e991b167b7ed6742d39d941c16ade899e14c (patch)
tree5f61e0ceb2fe0602df9c5e48f4249913c36185d0 /src/com/android/browser/addbookmark
parent37bc2b91311f6afd36fe9586a62d00614c48144f (diff)
downloadpackages_apps_Browser-2f24e991b167b7ed6742d39d941c16ade899e14c.zip
packages_apps_Browser-2f24e991b167b7ed6742d39d941c16ade899e14c.tar.gz
packages_apps_Browser-2f24e991b167b7ed6742d39d941c16ade899e14c.tar.bz2
Show last folder saved to as an option.
Bug:3424716 Change-Id: Id0087fc07dc2cab58177711c63d0a2e27e99e662
Diffstat (limited to 'src/com/android/browser/addbookmark')
-rw-r--r--src/com/android/browser/addbookmark/FolderSpinnerAdapter.java25
1 files changed, 23 insertions, 2 deletions
diff --git a/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java b/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java
index 0712469..261aa62 100644
--- a/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java
+++ b/src/com/android/browser/addbookmark/FolderSpinnerAdapter.java
@@ -35,15 +35,27 @@ import android.widget.TextView;
*/
public class FolderSpinnerAdapter implements SpinnerAdapter {
private boolean mIncludeHomeScreen;
+ private boolean mIncludesRecentFolder;
+ private long mRecentFolderId;
+ private String mRecentFolderName;
public static final int HOME_SCREEN = 0;
public static final int ROOT_FOLDER = 1;
public static final int OTHER_FOLDER = 2;
+ public static final int RECENT_FOLDER = 3;
public FolderSpinnerAdapter(boolean includeHomeScreen) {
mIncludeHomeScreen = includeHomeScreen;
}
+ public void addRecentFolder(long folderId, String folderName) {
+ mIncludesRecentFolder = true;
+ mRecentFolderId = folderId;
+ mRecentFolderName = folderName;
+ }
+
+ public long recentFolderId() { return mRecentFolderId; }
+
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
int labelResource;
@@ -60,6 +72,8 @@ public class FolderSpinnerAdapter implements SpinnerAdapter {
labelResource = R.string.add_to_bookmarks_menu_option;
drawableResource = R.drawable.ic_bookmarks_holo_dark;
break;
+ case RECENT_FOLDER:
+ // Fall through and use the same icon resource
case OTHER_FOLDER:
labelResource = R.string.add_to_other_folder_menu_option;
drawableResource = R.drawable.ic_folder_holo_dark;
@@ -73,7 +87,11 @@ public class FolderSpinnerAdapter implements SpinnerAdapter {
Context context = parent.getContext();
LayoutInflater factory = LayoutInflater.from(context);
TextView textView = (TextView) factory.inflate(R.layout.add_to_option, null);
- textView.setText(labelResource);
+ if (position == RECENT_FOLDER) {
+ textView.setText(mRecentFolderName);
+ } else {
+ textView.setText(labelResource);
+ }
Drawable drawable = context.getResources().getDrawable(drawableResource);
textView.setCompoundDrawablesWithIntrinsicBounds(drawable, null,
null, null);
@@ -90,7 +108,10 @@ public class FolderSpinnerAdapter implements SpinnerAdapter {
@Override
public int getCount() {
- return mIncludeHomeScreen ? 3 : 2;
+ int count = 2;
+ if (mIncludeHomeScreen) count++;
+ if (mIncludesRecentFolder) count++;
+ return count;
}
@Override