diff options
author | Leon Scroggins <scroggo@google.com> | 2011-01-13 17:56:15 -0500 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2011-01-13 18:30:03 -0500 |
commit | 75630678154c89662b7f8e5fb19d0b77a2d7abb8 (patch) | |
tree | 8371174e699e0e70931a482d74b2939c32b2f994 /src/com/android/browser/AddBookmarkPage.java | |
parent | 58fddd3154418fbdf7560db5662fcf6d248061e3 (diff) | |
download | packages_apps_Browser-75630678154c89662b7f8e5fb19d0b77a2d7abb8.zip packages_apps_Browser-75630678154c89662b7f8e5fb19d0b77a2d7abb8.tar.gz packages_apps_Browser-75630678154c89662b7f8e5fb19d0b77a2d7abb8.tar.bz2 |
Show a remove button for existing bookmarks.
Bug:3222677
Change-Id: Id11585bc68f239a02aa477898f6c00792ad44093
Diffstat (limited to 'src/com/android/browser/AddBookmarkPage.java')
-rw-r--r-- | src/com/android/browser/AddBookmarkPage.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/com/android/browser/AddBookmarkPage.java b/src/com/android/browser/AddBookmarkPage.java index 5a55f67..a93a518 100644 --- a/src/com/android/browser/AddBookmarkPage.java +++ b/src/com/android/browser/AddBookmarkPage.java @@ -115,6 +115,8 @@ public class AddBookmarkPage extends Activity private long mRootFolder; private TextView mTopLevelLabel; private Drawable mHeaderIcon; + private View mRemoveLink; + private View mFakeTitleHolder; private static class Folder { String Name; long Id; @@ -127,6 +129,7 @@ public class AddBookmarkPage extends Activity // Message IDs private static final int SAVE_BOOKMARK = 100; private static final int TOUCH_ICON_DOWNLOADED = 101; + private static final int BOOKMARK_DELETED = 102; private Handler mHandler; @@ -194,7 +197,7 @@ public class AddBookmarkPage extends Activity mFolderSelector.setVisibility(View.GONE); mDefaultView.setVisibility(View.VISIBLE); mCrumbHolder.setVisibility(View.GONE); - mFakeTitle.setVisibility(View.VISIBLE); + mFakeTitleHolder.setVisibility(View.VISIBLE); if (changedFolder) { Object data = mCrumbs.getTopData(); if (data != null) { @@ -257,6 +260,16 @@ public class AddBookmarkPage extends Activity // can transfer the focus to mFolderNamer. imm.focusIn(mListView); imm.showSoftInput(mFolderNamer, InputMethodManager.SHOW_IMPLICIT); + } else if (v == mRemoveLink) { + if (!mEditingExisting) { + throw new AssertionError("Remove button should not be shown for" + + " new bookmarks"); + } + long id = mMap.getLong(BrowserContract.Bookmarks._ID); + createHandler(); + Message msg = Message.obtain(mHandler, BOOKMARK_DELETED); + BookmarkUtils.displayRemoveBookmarkDialog(id, + mTitle.getText().toString(), this, msg); } } @@ -334,7 +347,7 @@ public class AddBookmarkPage extends Activity mDefaultView.setVisibility(View.GONE); mFolderSelector.setVisibility(View.VISIBLE); mCrumbHolder.setVisibility(View.VISIBLE); - mFakeTitle.setVisibility(View.GONE); + mFakeTitleHolder.setVisibility(View.GONE); mAddNewFolder.setVisibility(View.VISIBLE); mAddSeparator.setVisibility(View.VISIBLE); } @@ -423,6 +436,7 @@ public class AddBookmarkPage extends Activity if (cursor != null && cursor.moveToFirst()) { // Site is bookmarked. mEditingExisting = true; + showRemoveButton(); mFakeTitle.setText(R.string.edit_bookmark); int index = cursor.getColumnIndexOrThrow( BrowserContract.Bookmarks.PARENT); @@ -603,6 +617,8 @@ public class AddBookmarkPage extends Activity mFakeTitle.setText(R.string.edit_bookmark); if (mEditingFolder) { findViewById(R.id.row_address).setVisibility(View.GONE); + } else { + showRemoveButton(); } } else { int gravity = mMap.getInt("gravity", -1); @@ -662,6 +678,8 @@ public class AddBookmarkPage extends Activity mListView.setOnItemClickListener(this); mListView.addEditText(mFolderNamer); + mFakeTitleHolder = findViewById(R.id.title_holder); + if (!window.getDecorView().isInTouchMode()) { mButton.requestFocus(); } @@ -678,6 +696,13 @@ public class AddBookmarkPage extends Activity } + private void showRemoveButton() { + findViewById(R.id.remove_divider).setVisibility(View.VISIBLE); + mRemoveLink = findViewById(R.id.remove); + mRemoveLink.setVisibility(View.VISIBLE); + mRemoveLink.setOnClickListener(this); + } + // Called once we have determined which folder is the root folder private void onRootFolderFound(long root) { mRootFolder = root; @@ -819,6 +844,9 @@ public class AddBookmarkPage extends Activity (Bitmap) b.getParcelable(BrowserContract.Bookmarks.TOUCH_ICON), (Bitmap) b.getParcelable(BrowserContract.Bookmarks.FAVICON))); break; + case BOOKMARK_DELETED: + finish(); + break; } } }; |