Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java

Issue 2632493003: [Android History] Styling changes (Closed)
Patch Set: Fix remove button visibility for supervised users Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java
index 2eb056a180a8b87f7545016f5e3968e9b01bb12b..bccddaa565b56bd880473635e32cbe44c78cc218 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryItemView.java
@@ -40,6 +40,8 @@ public class HistoryItemView extends SelectableItemView<HistoryItem> implements
private final int mDisplayedIconSize;
private final int mCornerRadius;
+ private boolean mRemoveButtonVisible;
+
public HistoryItemView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -122,6 +124,18 @@ public class HistoryItemView extends SelectableItemView<HistoryItem> implements
updateRemoveButtonVisibility();
}
+ /**
+ * @param visible Whether the remove button should be visible. Note that this method will have
+ * no effect if the button is GONE because the signed in user is not allowed to
+ * delete browsing history.
+ */
+ public void setRemoveButtonVisible(boolean visible) {
+ mRemoveButtonVisible = visible;
+ if (!PrefServiceBridge.getInstance().canDeleteBrowsingHistory()) return;
+
+ mRemoveButton.setVisibility(visible ? View.VISIBLE : View.INVISIBLE);
+ }
+
@Override
protected void onClick() {
if (getItem() != null) getItem().open();
@@ -151,7 +165,7 @@ public class HistoryItemView extends SelectableItemView<HistoryItem> implements
private void updateRemoveButtonVisibility() {
mRemoveButton.setVisibility(
- PrefServiceBridge.getInstance().canDeleteBrowsingHistory() ? View.VISIBLE
- : View.GONE);
+ !PrefServiceBridge.getInstance().canDeleteBrowsingHistory() ? View.GONE :
+ mRemoveButtonVisible ? View.VISIBLE : View.INVISIBLE);
}
}

Powered by Google App Engine
This is Rietveld 408576698