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

Commit c530c9da authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Fine tune the Autofill Save UI

Test: Looked at UI, CtsAutofillTestCases
Fixes: 37417692
Change-Id: Iee2cc5ceb99dd71cc43f55af7299d488b35234e6
parent 8079a69e
Loading
Loading
Loading
Loading
+67 −64
Original line number Original line Diff line number Diff line
@@ -16,14 +16,17 @@


<LinearLayout
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    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:id="@+id/autofill_save"
        android:layout_width="fill_parent"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_height="wrap_content"
    android:paddingStart="16dip"
        android:layout_marginTop="32dp"
    android:paddingEnd="16dip"
        android:padding="16dp"
    android:paddingTop="16dip"
        android:elevation="32dp"
    android:paddingBottom="16dip"
    android:elevation="16dp"
        android:background="?android:attr/colorBackground"
        android:background="?android:attr/colorBackground"
        android:orientation="vertical">
        android:orientation="vertical">


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


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


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

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


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


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


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


    </LinearLayout>
    </LinearLayout>

</LinearLayout>
+4 −4
Original line number Original line 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
    <!-- 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] -->
         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
    <!-- 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] -->
         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
    <!-- 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
         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] -->
         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
    <!-- 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
         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] -->
         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] -->
    <!-- Label for the autofill save button [CHAR LIMIT=NONE] -->
    <string name="autofill_save_yes">Save</string>
    <string name="autofill_save_yes">Save</string>
    <!-- Label for the autofill cancel button [CHAR LIMIT=NONE] -->
    <!-- Label for the autofill cancel button [CHAR LIMIT=NONE] -->
+10 −8
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@ import android.content.Context;
import android.content.IntentSender;
import android.content.IntentSender;
import android.os.Handler;
import android.os.Handler;
import android.service.autofill.SaveInfo;
import android.service.autofill.SaveInfo;
import android.text.Html;
import android.util.ArraySet;
import android.util.ArraySet;
import android.util.Slog;
import android.util.Slog;
import android.view.Gravity;
import android.view.Gravity;
@@ -125,23 +126,24 @@ final class SaveUi {
            types.add(context.getString(R.string.autofill_save_type_email_address));
            types.add(context.getString(R.string.autofill_save_type_email_address));
        }
        }


        final String title;
        final CharSequence title;
        switch (types.size()) {
        switch (types.size()) {
            case 1:
            case 1:
                title = context.getString(R.string.autofill_save_title_with_type,
                title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_type,
                        types.valueAt(0), providerLabel);
                        types.valueAt(0), providerLabel), 0);
                break;
                break;
            case 2:
            case 2:
                title = context.getString(R.string.autofill_save_title_with_2types,
                title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_2types,
                        types.valueAt(0), types.valueAt(1), providerLabel);
                        types.valueAt(0), types.valueAt(1), providerLabel), 0);
                break;
                break;
            case 3:
            case 3:
                title = context.getString(R.string.autofill_save_title_with_3types,
                title = Html.fromHtml(context.getString(R.string.autofill_save_title_with_3types,
                        types.valueAt(0), types.valueAt(1), types.valueAt(2), providerLabel);
                        types.valueAt(0), types.valueAt(1), types.valueAt(2), providerLabel), 0);
                break;
                break;
            default:
            default:
                // Use generic if more than 3 or invalid type (size 0).
                // 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);
        titleView.setText(title);