diff options
author | John Reck <jreck@google.com> | 2011-01-20 16:59:23 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2011-01-20 17:44:04 -0800 |
commit | 177746d05e1ceefe8421a4fdab7407e1d17b46d6 (patch) | |
tree | cae901850e13b292c9e46b1003720f566a46c056 /src/com/android/browser/HistoryItem.java | |
parent | 3f24ba289897891c7ada52824828558a8e95f8bc (diff) | |
download | packages_apps_Browser-177746d05e1ceefe8421a4fdab7407e1d17b46d6.zip packages_apps_Browser-177746d05e1ceefe8421a4fdab7407e1d17b46d6.tar.gz packages_apps_Browser-177746d05e1ceefe8421a4fdab7407e1d17b46d6.tar.bz2 |
Remove the bookmark star from history context menu
Bug: 3374340
The star isn't supposed to be in the context menu, removed
Change-Id: I2dbd59ca32f7bec66468adf8b9c76ba1a425a94a
Diffstat (limited to 'src/com/android/browser/HistoryItem.java')
-rw-r--r-- | src/com/android/browser/HistoryItem.java | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/src/com/android/browser/HistoryItem.java b/src/com/android/browser/HistoryItem.java index ccedc01..8154be7 100644 --- a/src/com/android/browser/HistoryItem.java +++ b/src/com/android/browser/HistoryItem.java @@ -21,37 +21,33 @@ import android.content.Context; import android.provider.Browser; import android.view.View; import android.widget.CompoundButton; +import android.widget.CompoundButton.OnCheckedChangeListener; /** * Layout representing a history item in the classic history viewer. */ -/* package */ class HistoryItem extends BookmarkItem { +/* package */ class HistoryItem extends BookmarkItem + implements OnCheckedChangeListener { private CompoundButton mStar; // Star for bookmarking - private CompoundButton.OnCheckedChangeListener mListener; /** * Create a new HistoryItem. * @param context Context for this HistoryItem. */ /* package */ HistoryItem(Context context) { + this(context, true); + } + + /* package */ HistoryItem(Context context, boolean showStar) { super(context); mStar = (CompoundButton) findViewById(R.id.star); - mStar.setVisibility(View.VISIBLE); - mListener = new CompoundButton.OnCheckedChangeListener() { - public void onCheckedChanged(CompoundButton buttonView, - boolean isChecked) { - if (isChecked) { - // Uncheck ourseves. When the bookmark is actually added, - // we will be notified - setIsBookmark(false); - Browser.saveBookmark(getContext(), getName(), mUrl); - } else { - Bookmarks.removeFromBookmarks(getContext(), - getContext().getContentResolver(), mUrl, getName()); - } - } - }; + mStar.setOnCheckedChangeListener(this); + if (showStar) { + mStar.setVisibility(View.VISIBLE); + } else { + mStar.setVisibility(View.GONE); + } } /* package */ void copyTo(HistoryItem item) { @@ -75,6 +71,20 @@ import android.widget.CompoundButton; /* package */ void setIsBookmark(boolean isBookmark) { mStar.setOnCheckedChangeListener(null); mStar.setChecked(isBookmark); - mStar.setOnCheckedChangeListener(mListener); + mStar.setOnCheckedChangeListener(this); + } + + @Override + public void onCheckedChanged(CompoundButton buttonView, + boolean isChecked) { + if (isChecked) { + // Uncheck ourseves. When the bookmark is actually added, + // we will be notified + setIsBookmark(false); + Browser.saveBookmark(getContext(), getName(), mUrl); + } else { + Bookmarks.removeFromBookmarks(getContext(), + getContext().getContentResolver(), mUrl, getName()); + } } } |