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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListToolbar.java

Issue 2874033004: Photo Picker dialog: Make toolbar behave more like mocks. (Closed)
Patch Set: Change things around Created 3 years, 7 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/widget/selection/SelectableListToolbar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListToolbar.java
index 0ef88875a5e8dd210878417c92c2f4e25cc3af96..a0e384ac5501ad3fbdee68ab23652f54ccc3c967 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListToolbar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/selection/SelectableListToolbar.java
@@ -89,6 +89,8 @@ public class SelectableListToolbar<E> extends Toolbar implements SelectionObserv
public static final int NAVIGATION_BUTTON_BACK = 2;
/** Button to clear the selection. **/
public static final int NAVIGATION_BUTTON_SELECTION_BACK = 3;
+ /** Button to close the dialog. **/
+ public static final int NAVIGATION_BUTTON_CLOSE = 4;
/** An observer list for this toolbar. */
private final ObserverList<SelectableListToolbarObserver> mObservers = new ObserverList<>();
@@ -551,7 +553,7 @@ public class SelectableListToolbar<E> extends Toolbar implements SelectionObserv
updateDisplayStyleIfNecessary();
}
- private void showSelectionView(List<E> selectedItems, boolean wasSelectionEnabled) {
+ protected void showSelectionView(List<E> selectedItems, boolean wasSelectionEnabled) {
getMenu().setGroupVisible(mNormalGroupResId, false);
getMenu().setGroupVisible(mSelectedGroupResId, true);
if (mHasSearchView) mSearchView.setVisibility(View.GONE);
@@ -559,11 +561,8 @@ public class SelectableListToolbar<E> extends Toolbar implements SelectionObserv
setNavigationButton(NAVIGATION_BUTTON_SELECTION_BACK);
setBackgroundColor(mSelectionBackgroundColor);
setOverflowIcon(mSelectionMenuButton);
- setTitle(null);
- mNumberRollView.setVisibility(View.VISIBLE);
- if (!wasSelectionEnabled) mNumberRollView.setNumber(0, false);
- mNumberRollView.setNumber(selectedItems.size(), true);
+ switchToNumberRollView(selectedItems, wasSelectionEnabled);
if (mIsSearching) UiUtils.hideKeyboard(mSearchEditText);
@@ -583,6 +582,13 @@ public class SelectableListToolbar<E> extends Toolbar implements SelectionObserv
updateDisplayStyleIfNecessary();
}
+ protected void switchToNumberRollView(List<E> selectedItems, boolean wasSelectionEnabled) {
+ setTitle(null);
+ mNumberRollView.setVisibility(View.VISIBLE);
+ if (!wasSelectionEnabled) mNumberRollView.setNumber(0, false);
+ mNumberRollView.setNumber(selectedItems.size(), true);
+ }
+
/**
* Update internal state and notify observers that the theme color changed.
* @param isLightTheme Whether or not the theme color is light.
@@ -592,7 +598,7 @@ public class SelectableListToolbar<E> extends Toolbar implements SelectionObserv
for (SelectableListToolbarObserver o : mObservers) o.onThemeColorChanged(isLightTheme);
}
- private void updateDisplayStyleIfNecessary() {
+ protected void updateDisplayStyleIfNecessary() {
if (mUiConfig != null) onDisplayStyleChanged(mUiConfig.getCurrentDisplayStyle());
}

Powered by Google App Engine
This is Rietveld 408576698