Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ede054a7 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fine tune the Autofill Save UI" into oc-dev

parents d0c3b9c6 c530c9da
Loading
Loading
Loading
Loading
+67 −64
Original line number Diff line number Diff line
@@ -16,14 +16,17 @@

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

    <LinearLayout
        android:id="@+id/autofill_save"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
    android:paddingStart="16dip"
    android:paddingEnd="16dip"
    android:paddingTop="16dip"
    android:paddingBottom="16dip"
    android:elevation="16dp"
        android:layout_marginTop="32dp"
        android:padding="16dp"
        android:elevation="32dp"
        android:background="?android:attr/colorBackground"
        android:orientation="vertical">

@@ -34,24 +37,21 @@

            <TextView
                android:id="@+id/autofill_save_title"
            android:layout_width="wrap_content"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:text="@string/autofill_save_title"
            android:singleLine="true">
                android:textSize="16sp"
                android:textColor="?android:attr/textColorPrimary"
                android:layout_weight="1">
            </TextView>

        <Space
            android:layout_width="0dp"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:visibility="invisible" >
        </Space>

            <ImageView
                android:id="@+id/autofill_save_close"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="16dp"
                android:src="@android:drawable/ic_close"
                android:alpha="0.54"
                android:background="?android:attr/selectableItemBackgroundBorderless">
            </ImageView>

@@ -61,7 +61,8 @@
            android:id="@+id/autofill_save_subtitle"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
        android:visibility="invisible" >
            android:layout_marginTop="4dp"
            android:visibility="gone">
        </TextView>

        <com.android.internal.widget.ButtonBarLayout
@@ -91,10 +92,12 @@
                android:id="@+id/autofill_save_yes"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
            style="?android:attr/buttonBarButtonStyle"
                style="@style/Widget.Material.Button.Colored"
                android:text="@string/autofill_save_yes">
            </Button>

        </com.android.internal.widget.ButtonBarLayout>

    </LinearLayout>

</LinearLayout>
+4 −4
Original line number Diff line number Diff line
@@ -4592,18 +4592,18 @@

    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, but the service does not know what the activity represents [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title">Save to <xliff:g id="label" example="MyPass">%1$s</xliff:g>?</string>
    <string name="autofill_save_title">Save to &lt;b><xliff:g id="label" example="MyPass">%1$s</xliff:g>&lt;/b>?</string>
    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, and the service does knows what the activity represents (for example, credit card info) [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title_with_type">Save <xliff:g id="type" example="Credit Card">%1$s</xliff:g> to <xliff:g id="label" example="MyPass">%2$s</xliff:g>?</string>
    <string name="autofill_save_title_with_type">Save <xliff:g id="type" example="Credit Card">%1$s</xliff:g> to &lt;b><xliff:g id="label" example="MyPass">%2$s</xliff:g>&lt;/b>?</string>
    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, and the service does knows what the activity represents, and it represents 2 types of
         data (for example, password and credit card info) [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title_with_2types">Save <xliff:g id="type" example="Password">%1$s</xliff:g>, <xliff:g id="type" example="Credit Card">%2$s</xliff:g> to <xliff:g id="label" example="MyPass">%3$s</xliff:g>?</string>
    <string name="autofill_save_title_with_2types">Save <xliff:g id="type" example="Password">%1$s</xliff:g> and <xliff:g id="type" example="Credit Card">%2$s</xliff:g> to &lt;b><xliff:g id="label" example="MyPass">%3$s</xliff:g>&lt;/b>?</string>
    <!-- Title for the autofill save dialog shown when the the contents of the activity can be saved
         by an autofill service, and the service does knows what the activity represents, and it represents 3 types of
         data (for example, username, password and credit card info) [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title_with_3types">Save <xliff:g id="type" example="Username">%1$s</xliff:g>, <xliff:g id="type" example="Password">%2$s</xliff:g>, <xliff:g id="type" example="Credit Card">%3$s</xliff:g> to <xliff:g id="label" example="MyPass">%4$s</xliff:g>?</string>
    <string name="autofill_save_title_with_3types">Save <xliff:g id="type" example="Username">%1$s</xliff:g>, <xliff:g id="type" example="Password">%2$s</xliff:g>, and <xliff:g id="type" example="Credit Card">%3$s</xliff:g> to &lt;b><xliff:g id="label" example="MyPass">%4$s</xliff:g>&lt;/b>?</string>
    <!-- Label for the autofill save button [CHAR LIMIT=NONE] -->
    <string name="autofill_save_yes">Save</string>
    <!-- Label for the autofill cancel button [CHAR LIMIT=NONE] -->
+10 −8
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.IntentSender;
import android.os.Handler;
import android.service.autofill.SaveInfo;
import android.text.Html;
import android.util.ArraySet;
import android.util.Slog;
import android.view.Gravity;
@@ -125,23 +126,24 @@ final class SaveUi {
            types.add(context.getString(R.string.autofill_save_type_email_address));
        }

        final String title;
        final CharSequence title;
        switch (types.size()) {
            case 1:
                title = context.getString(R.string.autofill_save_title_with_type,
                        types.valueAt(0), providerLabel);
                title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_type,
                        types.valueAt(0), providerLabel), 0);
                break;
            case 2:
                title = context.getString(R.string.autofill_save_title_with_2types,
                        types.valueAt(0), types.valueAt(1), providerLabel);
                title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_2types,
                        types.valueAt(0), types.valueAt(1), providerLabel), 0);
                break;
            case 3:
                title = context.getString(R.string.autofill_save_title_with_3types,
                        types.valueAt(0), types.valueAt(1), types.valueAt(2), providerLabel);
                title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_3types,
                        types.valueAt(0), types.valueAt(1), types.valueAt(2), providerLabel), 0);
                break;
            default:
                // Use generic if more than 3 or invalid type (size 0).
                title = context.getString(R.string.autofill_save_title, providerLabel);
                title = Html.fromHtml(
                        context.getString(R.string.autofill_save_title, providerLabel), 0);
        }

        titleView.setText(title);