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

Unified Diff: ui/android/java/src/org/chromium/ui/autofill/AutofillKeyboardAccessory.java

Issue 1284303004: Keyboard accessory tools on the right side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@icons
Patch Set: separatorPosition Created 5 years, 4 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
« no previous file with comments | « chrome/android/java/res/layout/main.xml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/android/java/src/org/chromium/ui/autofill/AutofillKeyboardAccessory.java
diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillKeyboardAccessory.java b/ui/android/java/src/org/chromium/ui/autofill/AutofillKeyboardAccessory.java
index 567df689dc09b237d0ede4cf04c56725eb954dea..879519053b566d03a6da2d6d6d792995e85baab1 100644
--- a/ui/android/java/src/org/chromium/ui/autofill/AutofillKeyboardAccessory.java
+++ b/ui/android/java/src/org/chromium/ui/autofill/AutofillKeyboardAccessory.java
@@ -67,15 +67,20 @@ public class AutofillKeyboardAccessory extends LinearLayout
@SuppressLint("InlinedApi")
public void showWithSuggestions(AutofillSuggestion[] suggestions, boolean isRtl) {
removeAllViews();
+ int separatorPosition = -1;
for (int i = 0; i < suggestions.length; i++) {
AutofillSuggestion suggestion = suggestions[i];
assert !TextUtils.isEmpty(suggestion.getLabel());
+ // Negative suggestion ID indiciates a tool like "settings" or "scan credit card."
+ // Non-negative suggestion ID indicates suggestions that can be filled into the form.
View touchTarget;
if (suggestion.getSuggestionId() < 0 && suggestion.getIconId() != 0) {
touchTarget = LayoutInflater.from(getContext()).inflate(
R.layout.autofill_keyboard_accessory_icon, this, false);
+ if (separatorPosition == -1) separatorPosition = i;
+
ImageView icon = (ImageView) touchTarget;
icon.setImageResource(suggestion.getIconId());
icon.setContentDescription(suggestion.getLabel());
@@ -114,6 +119,12 @@ public class AutofillKeyboardAccessory extends LinearLayout
addView(touchTarget);
}
+ if (separatorPosition != -1) {
+ View separator = new View(getContext());
+ separator.setLayoutParams(new LinearLayout.LayoutParams(0, 0, 1));
+ addView(separator, separatorPosition);
+ }
+
ApiCompatibilityUtils.setLayoutDirection(
this, isRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
« no previous file with comments | « chrome/android/java/res/layout/main.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698