[Autofill Assistant] Improve CounterInput UI.

 * Before: https://screenshot.googleplex.com/hmVvTEU3Bg7.png
 * After: https://screenshot.googleplex.com/Cp3bg0Wqt7m.png

Screenshots: 
Change-Id: I3c3563eb895fde6a0fd86ab25625eb68aa0ce598
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617828
Reviewed-by: Mathias Carlen <mcarlen@chromium.org>
Commit-Queue: Jordan Demeulenaere <jdemeulenaere@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661345}
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable/autofill_assistant_form_input_divider.xml b/chrome/android/features/autofill_assistant/java/res/drawable/autofill_assistant_form_input_divider.xml
new file mode 100644
index 0000000..4cbcac6
--- /dev/null
+++ b/chrome/android/features/autofill_assistant/java/res/drawable/autofill_assistant_form_input_divider.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 The Chromium Authors. All rights reserved.
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file. -->
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
+    <item
+        android:top="4dp"
+        android:bottom="10dp">
+        <shape >
+            <size android:height="1dp" />
+            <solid android:color="@color/modern_grey_100" />
+        </shape>
+    </item>
+</layer-list>
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable/ic_add_outline_white_24dp.xml b/chrome/android/features/autofill_assistant/java/res/drawable/ic_add_outline_white_24dp.xml
new file mode 100644
index 0000000..9ce09002
--- /dev/null
+++ b/chrome/android/features/autofill_assistant/java/res/drawable/ic_add_outline_white_24dp.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 The Chromium Authors. All rights reserved.
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file. -->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    tools:targetApi="21">
+  <path
+      android:pathData="M13,7h-2v4L7,11v2h4v4h2v-4h4v-2h-4L13,7zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"
+      android:fillColor="#FFFFFF"/>
+</vector>
diff --git a/chrome/android/features/autofill_assistant/java/res/drawable/ic_remove_outline_white_24dp.xml b/chrome/android/features/autofill_assistant/java/res/drawable/ic_remove_outline_white_24dp.xml
new file mode 100644
index 0000000..d785528
--- /dev/null
+++ b/chrome/android/features/autofill_assistant/java/res/drawable/ic_remove_outline_white_24dp.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2019 The Chromium Authors. All rights reserved.
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file. -->
+<vector
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportWidth="24"
+    android:viewportHeight="24"
+    tools:targetApi="21">
+  <path
+      android:pathData="M7,11v2h10v-2L7,11zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8z"
+      android:fillColor="#FFFFFF"/>
+</vector>
diff --git a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter.xml b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter.xml
index f931522..8374730 100644
--- a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter.xml
+++ b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter.xml
@@ -5,26 +5,51 @@
 
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:minHeight="40dp"
     android:orientation="horizontal"
-    android:layout_gravity="center_horizontal">
-    <TextView
-        android:id="@+id/label"
+    android:gravity="center_vertical">
+    <LinearLayout
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:layout_weight="1"/>
-    <Button
+        android:layout_weight="1"
+        android:orientation="vertical">
+        <TextView
+            android:id="@+id/label"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="@style/TextAppearance.BlackTitle2"/>
+        <TextView
+            android:id="@+id/subtext"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="@style/TextAppearance.BlackCaption"
+            android:visibility="gone"/>
+    </LinearLayout>
+    <ImageView
         android:id="@+id/decrease_button"
+        android:layout_width="32dp"
+        android:layout_height="32dp"
+        android:padding="4dp"
+        android:tint="@color/filled_button_bg"
+        app:srcCompat="@drawable/ic_remove_outline_white_24dp"
+        tools:ignore="ContentDescription"/>
+    <TextView
+        android:id="@+id/value"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:text="-"
-        tools:ignore="HardcodedText"/>
-    <Button
+        android:minWidth="20dp"
+        android:gravity="center"
+        android:textAppearance="@style/TextAppearance.BlackTitle2"/>
+    <ImageView
         android:id="@+id/increase_button"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="+"
-        tools:ignore="HardcodedText"/>
+        android:layout_width="32dp"
+        android:layout_height="32dp"
+        android:padding="4dp"
+        android:tint="@color/filled_button_bg"
+        app:srcCompat="@drawable/ic_add_outline_white_24dp"
+        tools:ignore="ContentDescription"/>
 </LinearLayout>
diff --git a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter_input.xml b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter_input.xml
index def484f..1e09a14 100644
--- a/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter_input.xml
+++ b/chrome/android/features/autofill_assistant/java/res/layout/autofill_assistant_form_counter_input.xml
@@ -5,22 +5,49 @@
 
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical">
     <TextView
         android:id="@+id/label"
         android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
+        android:layout_height="wrap_content"
+        android:layout_marginBottom="4dp"
+        android:textAppearance="@style/TextAppearance.BlackTitle2"/>
     <LinearLayout
         android:id="@+id/expandable_section"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
         android:visibility="gone"/>
-    <TextView
-        android:id="@+id/expand_label"
+    <LinearLayout
+        android:id="@+id/expand_label_container"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:visibility="gone"/>
+        android:gravity="center_vertical"
+        android:paddingTop="8dp"
+        android:paddingBottom="8dp"
+        android:orientation="horizontal"
+        android:visibility="gone"
+        tools:ignore="UseCompoundDrawables">
+        <TextView
+            android:id="@+id/expand_label"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="@style/TextAppearance.BlackCaption"/>
+        <TextView
+            android:id="@+id/minimize_label"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textAppearance="@style/TextAppearance.BlackCaption"/>
+        <ImageView
+            android:id="@+id/chevron"
+            android:layout_width="16dp"
+            android:layout_height="16dp"
+            android:tint="@color/default_text_color_secondary_list"
+            app:srcCompat="@drawable/ic_expand_more_black_24dp"
+            tools:ignore="ContentDescription"/>
+    </LinearLayout>
 </LinearLayout>
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java
index 81f5241..fcca1a5 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBottomBarCoordinator.java
@@ -69,16 +69,13 @@
         mContent = new AssistantBottomSheetContent(activity);
 
         // Instantiate child components.
-        int childSpacing = activity.getResources().getDimensionPixelSize(
-                R.dimen.autofill_assistant_bottombar_vertical_spacing);
         mHeaderCoordinator = new AssistantHeaderCoordinator(
                 activity, mContent.mBottomBarView, model.getHeaderModel());
         mInfoBoxCoordinator = new AssistantInfoBoxCoordinator(activity, model.getInfoBoxModel());
         mDetailsCoordinator = new AssistantDetailsCoordinator(activity, model.getDetailsModel());
         mPaymentRequestCoordinator =
                 new AssistantPaymentRequestCoordinator(activity, model.getPaymentRequestModel());
-        mFormCoordinator =
-                new AssistantFormCoordinator(activity, model.getFormModel(), childSpacing);
+        mFormCoordinator = new AssistantFormCoordinator(activity, model.getFormModel());
         mSuggestionsCoordinator =
                 new AssistantSuggestionsCarouselCoordinator(activity, model.getSuggestionsModel());
         mActionsCoordinator =
@@ -101,8 +98,11 @@
         // do not hide them because there is an incompatibility bug between the animateLayoutChanges
         // attribute set on mBottomBarView and the animations ran by the carousels
         // RecyclerView.
+        int childSpacing = activity.getResources().getDimensionPixelSize(
+                R.dimen.autofill_assistant_bottombar_vertical_spacing);
         setChildMarginTop(mDetailsCoordinator.getView(), childSpacing);
         setChildMarginTop(mPaymentRequestCoordinator.getView(), childSpacing);
+        setChildMarginTop(mFormCoordinator.getView(), childSpacing);
         setCarouselMarginTop(mSuggestionsCoordinator.getView(),
                 model.getSuggestionsModel().getChipsModel(), childSpacing);
         setCarouselMarginTop(mActionsCoordinator.getView(), model.getActionsModel().getChipsModel(),
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCoordinator.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCoordinator.java
index 79d1c72..dd4a691 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCoordinator.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCoordinator.java
@@ -5,11 +5,13 @@
 package org.chromium.chrome.browser.autofill_assistant.form;
 
 import android.content.Context;
+import android.support.v7.content.res.AppCompatResources;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.LinearLayout;
 import android.widget.ScrollView;
 
+import org.chromium.chrome.autofill_assistant.R;
 import org.chromium.chrome.browser.autofill_assistant.AbstractListObserver;
 
 /**
@@ -24,8 +26,7 @@
 
     private boolean mForceInvisible;
 
-    public AssistantFormCoordinator(
-            Context context, AssistantFormModel model, int verticalSpacingPx) {
+    public AssistantFormCoordinator(Context context, AssistantFormModel model) {
         mModel = model;
         mView = new ScrollView(context);
         mContainerView = new LinearLayout(context);
@@ -35,6 +36,9 @@
         mContainerView.setLayoutParams(new ViewGroup.LayoutParams(
                 ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
         mContainerView.setOrientation(LinearLayout.VERTICAL);
+        mContainerView.setDividerDrawable(AppCompatResources.getDrawable(
+                context, R.drawable.autofill_assistant_form_input_divider));
+        mContainerView.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
         mView.addView(mContainerView);
 
         updateVisibility();
@@ -46,8 +50,6 @@
                     // Add the views to the linear layout (not the scroll view).
                     View view = input.createView(context, mContainerView);
                     mContainerView.addView(view);
-                    ((LinearLayout.LayoutParams) view.getLayoutParams()).topMargin =
-                            verticalSpacingPx;
                 }
                 updateVisibility();
             }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounter.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounter.java
index c6f4684..bf1e876 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounter.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounter.java
@@ -8,13 +8,16 @@
 
 class AssistantFormCounter {
     private final String mLabel;
+    private final String mSubtext;
     private final ChoiceFormat mLabelChoiceFormat;
     private final int mMinValue;
     private final int mMaxValue;
     private int mValue;
 
-    AssistantFormCounter(String label, int initialValue, int minValue, int maxValue) {
+    AssistantFormCounter(
+            String label, String subtext, int initialValue, int minValue, int maxValue) {
         mLabel = label;
+        mSubtext = subtext;
         mLabelChoiceFormat = new ChoiceFormat(label);
         mValue = initialValue;
         mMinValue = minValue;
@@ -25,6 +28,10 @@
         return mLabel;
     }
 
+    String getSubtext() {
+        return mSubtext;
+    }
+
     ChoiceFormat getLabelChoiceFormat() {
         return mLabelChoiceFormat;
     }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounterInput.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounterInput.java
index b439067..46e55db 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounterInput.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormCounterInput.java
@@ -5,6 +5,11 @@
 package org.chromium.chrome.browser.autofill_assistant.form;
 
 import android.content.Context;
+import android.transition.ChangeBounds;
+import android.transition.Fade;
+import android.transition.Transition;
+import android.transition.TransitionManager;
+import android.transition.TransitionSet;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -18,21 +23,34 @@
 /** A form input that allows to modify one or multiple counters. */
 class AssistantFormCounterInput extends AssistantFormInput {
     private static final String QUOTED_VALUE = Pattern.quote("{value}");
+    private static final Transition EXPAND_TRANSITION =
+            new TransitionSet()
+                    .setOrdering(TransitionSet.ORDERING_TOGETHER)
+                    .addTransition(new Fade(Fade.OUT))
+                    .addTransition(new ChangeBounds())
+                    .addTransition(new Fade(Fade.IN));
 
     interface Delegate {
         void onCounterChanged(int counterIndex, int value);
     }
 
     private final String mLabel;
+    private final String mExpandText;
+    private final String mMinimizeText;
     private final List<AssistantFormCounter> mCounters;
     private final int mMinimizedCount;
     private final Delegate mDelegate;
 
-    AssistantFormCounterInput(String label, List<AssistantFormCounter> counters, int minimizedCount,
-            Delegate delegate) {
+    AssistantFormCounterInput(String label, String expandText, String minimizeText,
+            List<AssistantFormCounter> counters, int minimizedCount, Delegate delegate) {
         mLabel = label;
+        mExpandText = expandText;
+        mMinimizeText = minimizeText;
         mCounters = counters;
-        mMinimizedCount = minimizedCount;
+
+        // Don't show the expandable section if there is no text to show when minimized/expanded.
+        mMinimizedCount =
+                expandText.isEmpty() || minimizeText.isEmpty() ? Integer.MAX_VALUE : minimizedCount;
         mDelegate = delegate;
     }
 
@@ -59,27 +77,42 @@
             }
         }
 
-        // If some counters are in the expandable section, show the "Show more" label that will
-        // expand it when clicked.
+        // If some counters are in the expandable section, show the expand label that will expand
+        // the section when clicked.
         if (expandableSection.getChildCount() > 0) {
+            View expandLabelContainer = root.findViewById(R.id.expand_label_container);
             TextView expandLabel = root.findViewById(R.id.expand_label);
-            expandLabel.setVisibility(View.VISIBLE);
+            TextView minimizeLabel = root.findViewById(R.id.minimize_label);
+            View chevron = root.findViewById(R.id.chevron);
 
-            String expandString =
-                    context.getResources().getString(R.string.autofill_assistant_form_show_more);
-            String shrinkString =
-                    context.getResources().getString(R.string.autofill_assistant_form_show_less);
-            expandLabel.setText(expandString);
-            expandLabel.setOnClickListener(unusedView -> {
+            expandLabel.setText(mExpandText);
+            minimizeLabel.setText(mMinimizeText);
+            minimizeLabel.setVisibility(View.GONE);
+            expandLabelContainer.setVisibility(View.VISIBLE);
+
+            expandLabelContainer.setOnClickListener(unusedView -> {
+                expandLabel.setOnClickListener(null);
+                expandableSection.setVisibility(View.VISIBLE);
+                expandLabelContainer.setVisibility(View.GONE);
+                expandLabel.setVisibility(View.GONE);
+            });
+
+            expandLabelContainer.setOnClickListener(unusedView -> {
+                TransitionManager.beginDelayedTransition(
+                        (ViewGroup) expandableSection.getRootView(), EXPAND_TRANSITION);
                 boolean expanded = expandableSection.getVisibility() == View.VISIBLE;
                 if (expanded) {
                     // Shrink.
                     expandableSection.setVisibility(View.GONE);
-                    expandLabel.setText(expandString);
+                    expandLabel.setVisibility(View.VISIBLE);
+                    minimizeLabel.setVisibility(View.GONE);
+                    chevron.animate().rotation(0).start();
                 } else {
                     // Expand.
                     expandableSection.setVisibility(View.VISIBLE);
-                    expandLabel.setText(shrinkString);
+                    expandLabel.setVisibility(View.GONE);
+                    minimizeLabel.setVisibility(View.VISIBLE);
+                    chevron.animate().rotation(180).start();
                 }
             });
         }
@@ -94,17 +127,24 @@
         TextView labelView = view.findViewById(R.id.label);
         updateLabel(counter, labelView);
 
+        TextView subtextView = view.findViewById(R.id.subtext);
+        if (!counter.getSubtext().isEmpty()) {
+            subtextView.setVisibility(View.VISIBLE);
+            subtextView.setText(counter.getSubtext());
+        }
+
+        TextView valueTextView = view.findViewById(R.id.value);
         View decreaseButton = view.findViewById(R.id.decrease_button);
         View increaseButton = view.findViewById(R.id.increase_button);
-        updateCounterState(counter, decreaseButton, increaseButton);
+        updateCounterState(counter, valueTextView, decreaseButton, increaseButton);
 
         decreaseButton.setOnClickListener(unusedView
-                -> updateCounter(
-                        counter, counterIndex, labelView, -1, decreaseButton, increaseButton));
+                -> updateCounter(counter, counterIndex, labelView, -1, valueTextView,
+                        decreaseButton, increaseButton));
 
         increaseButton.setOnClickListener(unusedView
-                -> updateCounter(
-                        counter, counterIndex, labelView, +1, decreaseButton, increaseButton));
+                -> updateCounter(counter, counterIndex, labelView, +1, valueTextView,
+                        decreaseButton, increaseButton));
 
         return view;
     }
@@ -119,18 +159,21 @@
     }
 
     private void updateCounter(AssistantFormCounter counter, int counterIndex, TextView labelView,
-            int delta, View decreaseButton, View increaseButton) {
+            int delta, TextView valueTextView, View decreaseButton, View increaseButton) {
         counter.setValue(counter.getValue() + delta);
         counter.setValue(Math.max(counter.getMinValue(), counter.getValue()));
         counter.setValue(Math.min(counter.getMaxValue(), counter.getValue()));
-        updateCounterState(counter, decreaseButton, increaseButton);
+        updateCounterState(counter, valueTextView, decreaseButton, increaseButton);
 
         updateLabel(counter, labelView);
         mDelegate.onCounterChanged(counterIndex, counter.getValue());
     }
 
-    private void updateCounterState(
-            AssistantFormCounter counter, View decreaseButton, View increaseButton) {
+    // It is ok to suppress the warning here as we are only setting a number value to the TextView.
+    @SuppressWarnings("SetTextI18n")
+    private void updateCounterState(AssistantFormCounter counter, TextView valueTextView,
+            View decreaseButton, View increaseButton) {
+        valueTextView.setText(Integer.toString(counter.getValue()));
         decreaseButton.setEnabled(counter.getValue() > counter.getMinValue());
         increaseButton.setEnabled(counter.getValue() < counter.getMaxValue());
     }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormInput.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormInput.java
index 8c8a68a..1f32b4f 100644
--- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormInput.java
+++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/form/AssistantFormInput.java
@@ -46,8 +46,8 @@
 
     @CalledByNative
     private static AssistantFormCounter createCounter(
-            String label, int initialValue, int minValue, int maxValue) {
-        return new AssistantFormCounter(label, initialValue, minValue, maxValue);
+            String label, String subtext, int initialValue, int minValue, int maxValue) {
+        return new AssistantFormCounter(label, subtext, initialValue, minValue, maxValue);
     }
 
     @CalledByNative
@@ -58,9 +58,10 @@
 
     @CalledByNative
     private static AssistantFormCounterInput createCounterInput(int inputIndex, String label,
-            List<AssistantFormCounter> counters, int minimizedCount,
-            AssistantFormDelegate delegate) {
-        return new AssistantFormCounterInput(label, counters, minimizedCount,
+            String expandText, String minimizeText, List<AssistantFormCounter> counters,
+            int minimizedCount, AssistantFormDelegate delegate) {
+        return new AssistantFormCounterInput(label, expandText, minimizeText, counters,
+                minimizedCount,
                 (counterIndex,
                         value) -> delegate.onCounterChanged(inputIndex, counterIndex, value));
     }
diff --git a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd
index ee5392d..13e8378 100644
--- a/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd
+++ b/chrome/android/features/autofill_assistant/java/strings/android_chrome_autofill_assistant_strings.grd
@@ -165,12 +165,6 @@
       <message name="IDS_AUTOFILL_ASSISTANT_SHEET_CLOSED" desc="Text announced when the Autofill Assistant sheet is closed.">
         Google Assistant in Chrome closed.
       </message>
-      <message name="IDS_AUTOFILL_ASSISTANT_FORM_SHOW_MORE" desc="Text shown when displaying a form with an expandable section that is minimized.">
-        Show more
-      </message>
-      <message name="IDS_AUTOFILL_ASSISTANT_FORM_SHOW_LESS" desc="Text shown when displaying a form with an expandable section that can be minimized.">
-        Show less
-      </message>
     </messages>
   </release>
 </grit>
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.cc b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
index 819e657..27bf4f5 100644
--- a/chrome/browser/android/autofill_assistant/ui_controller_android.cc
+++ b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
@@ -671,6 +671,8 @@
               Java_AssistantFormInput_createCounter(
                   env,
                   base::android::ConvertUTF8ToJavaString(env, counter.label()),
+                  base::android::ConvertUTF8ToJavaString(env,
+                                                         counter.subtext()),
                   counter.initial_value(), counter.min_value(),
                   counter.max_value()));
         }
@@ -681,6 +683,10 @@
                 env, i,
                 base::android::ConvertUTF8ToJavaString(env,
                                                        counter_input.label()),
+                base::android::ConvertUTF8ToJavaString(
+                    env, counter_input.expand_text()),
+                base::android::ConvertUTF8ToJavaString(
+                    env, counter_input.minimize_text()),
                 jcounters, counter_input.minimized_count(),
                 form_delegate_.GetJavaObject()));
         break;
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto
index 525a1f4..db9f39b 100644
--- a/components/autofill_assistant/browser/service.proto
+++ b/components/autofill_assistant/browser/service.proto
@@ -1192,6 +1192,9 @@
     // substring will be replaced by the current counter value.
     optional string label = 1;
 
+    // Text shown below the label. Optional.
+    optional string subtext = 5;
+
     // The minimum value this counter can have.
     optional int32 min_value = 2 [default = -0x80000000];  // kint32min
 
@@ -1218,8 +1221,19 @@
   // If specified, the input will initially display maximum |minimized_count|
   // counters. If |counters|.size > |minimized_count|, the remaining counters
   // will be displayed in an expandable section below the first
-  // |minimized_count| counters.
+  // |minimized_count| counters. Setting this value will have no effect if
+  // |expand_text| and |minimize_text| are not set.
   optional int32 minimized_count = 3 [default = 0x7FFFFFFF];  // kint32max
+
+  // Text shown when counters are inside the expandable section and the section
+  // is minimized. Clicking this text will expand the section and show the
+  // remaining counters.
+  optional string expand_text = 4;
+
+  // Text shown when counters are inside the expandable section and the section
+  // is expanded. Clicking this text will minimize the section and hide the
+  // counters inside it.
+  optional string minimize_text = 5;
 }
 
 // An input that allows the user to choose one or multiple options. This input