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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java

Issue 2838833002: 🔍 Introduce default search engine dialog (Closed)
Patch Set: Redo how the dialog is created Created 3 years, 8 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/infobar/InfoBarControlLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
index 0b85cc770f3fa9478e2421502ce868c627b15015..83bca9e3bcaa84aef9246791eaa1418350987b5f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/InfoBarControlLayout.java
@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.infobar;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Paint;
+import android.support.annotation.Nullable;
import android.support.v7.widget.SwitchCompat;
import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
@@ -44,11 +45,16 @@ import java.util.List;
* TODO(dfalcantara): The line spacing multiplier is applied to all lines in JB & KK, even if the
* TextView has only one line. This throws off vertical alignment. Find a
* solution that hopefully doesn't involve subclassing the TextView.
+ *
+ * TODO(dfalcantara): Move this to a more general location.
*/
public final class InfoBarControlLayout extends ViewGroup {
+ public static final int INVALID_INDEX = -1;
+
/**
* ArrayAdapter that automatically determines what size make its Views to accommodate all of
* its potential values.
+ * @param <T> Type of object that the ArrayAdapter stores.
*/
public static final class InfoBarArrayAdapter<T> extends ArrayAdapter<T> {
private final String mLabel;
@@ -361,9 +367,11 @@ public final class InfoBarControlLayout extends ViewGroup {
* -------------------------------------------------
*
* @param messages Messages to display for the options.
+ * @param tags Optional list of tags to attach to the buttons.
* @param selectedIndex Which index to mark as being selected.
*/
- public RadioGroup addRadioButtons(List<CharSequence> messages, int selectedIndex) {
+ public RadioGroup addRadioButtons(
+ List<CharSequence> messages, @Nullable List<?> tags, int selectedIndex) {
ControlLayoutParams params = new ControlLayoutParams();
params.mMustBeFullWidth = true;
@@ -375,6 +383,7 @@ public final class InfoBarControlLayout extends ViewGroup {
(RadioButton) LayoutInflater.from(getContext())
.inflate(R.layout.infobar_control_radio, radioLayout, false);
button.setText(messages.get(i));
+ if (tags != null) button.setTag(tags.get(i));
button.setChecked(i == selectedIndex);
radioLayout.addView(button);

Powered by Google App Engine
This is Rietveld 408576698