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

Commit 28a2c7e0 authored by Svet Ganov's avatar Svet Ganov Committed by Felipe Leme
Browse files

Update fill UI

1. Abstracted the fill/save view and window management
   in dedicated classs

2. Avoided the need of a second window to detect outside
   touches

3. Simplified the fill-ui window management

4. Moved the UI in its own package to ease mmigration to
   sys UI.

5. Removed hard-coded colors from the layout

6. Make sure the save UI cannot grow as wide as the screen
   as this would not look good on tablets

7. Update the save UI to look closer to mocks

Test: CTS tests pass
Bug: 35708258

Change-Id: Ia74a5aad6f16bba0047a9e8e61958c77af0d358d
parent 3a8ded59
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.Intent;
import android.content.IntentSender;
import android.graphics.Rect;
import android.os.Bundle;
import android.os.IBinder;
import android.os.Parcelable;
import android.os.RemoteException;
import android.util.Log;
@@ -131,7 +132,7 @@ public final class AutoFillManager {
        if (!mHasSession) {
            if (gainFocus) {
                // Starts new session.
                startSession(id, bounds, value);
                startSession(id, view.getWindowToken(), bounds, value);
            }
        } else {
            // Update focus on existing session.
@@ -159,7 +160,7 @@ public final class AutoFillManager {
        if (!mHasSession) {
            if (gainFocus) {
                // Starts new session.
                startSession(id, bounds, null);
                startSession(id, parent.getWindowToken(), bounds, null);
            }
        } else {
            // Update focus on existing session.
@@ -251,13 +252,14 @@ public final class AutoFillManager {
        return new AutoFillId(parent.getAccessibilityViewId(), childId);
    }

    private void startSession(AutoFillId id, Rect bounds, AutoFillValue value) {
    private void startSession(AutoFillId id, IBinder windowToken,
            Rect bounds, AutoFillValue value) {
        if (DEBUG) {
            Log.v(TAG, "startSession(): id=" + id + ", bounds=" + bounds + ", value=" + value);
        }
        try {
            mService.startSession(mContext.getActivityToken(), mServiceClient.asBinder(),
                    id, bounds, value, mContext.getUserId());
            mService.startSession(mContext.getActivityToken(), windowToken,
                    mServiceClient.asBinder(), id, bounds, value, mContext.getUserId());
            AutoFillClient client = getClient();
            if (client != null) {
                client.resetableStateAvailable();
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ import android.view.autofill.IAutoFillManagerClient;
 */
interface IAutoFillManager {
    boolean addClient(in IAutoFillManagerClient client, int userId);
    oneway void startSession(in IBinder activityToken, in IBinder appCallback,
    oneway void startSession(in IBinder activityToken, IBinder windowToken, in IBinder appCallback,
            in AutoFillId autoFillId, in Rect bounds, in AutoFillValue value, int userId);
    oneway void updateSession(in IBinder activityToken, in AutoFillId id, in Rect bounds,
            in AutoFillValue value, int flags, int userId);
+70 −35
Original line number Diff line number Diff line
@@ -14,44 +14,79 @@
     limitations under the License.
-->

<!-- TODO(b/33197203) remove hardcoded color once color is final -->
<RelativeLayout
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingStart="16dip"
    android:paddingEnd="16dip"
    android:paddingTop="16dip"
    android:paddingBottom="16dip"
    android:background="#FDF8C8">
    android:elevation="16dp"
    android:background="?android:attr/colorBackground"
    android:orientation="vertical">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

  <!-- TODO(b/33197203) use.R.string once final wording is done -->
        <TextView
            android:id="@+id/autofill_save_title"
      android:layout_width="match_parent"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
      android:text="Save for autofill?"
      android:singleLine="true"/>
            android:text="@string/autofill_save_title"
            android:singleLine="true">
        </TextView>

  <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:src="@android:drawable/ic_close"
            android:background="?android:attr/selectableItemBackgroundBorderless">
        </ImageView>

    </LinearLayout>

    <com.android.internal.widget.ButtonBarLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="end"
        android:layout_marginTop="16dp"
        android:layout_weight="1"
        android:orientation="horizontal">

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

        <Button
            android:id="@+id/autofill_save_no"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
      android:layout_below="@+id/autofill_save_title"
      android:layout_toLeftOf="@+id/autofill_save_yes"
      android:layout_marginRight="16dip"
      android:text="No thanks"
      android:textAllCaps="true"
      android:singleLine="true"/>
            style="?android:attr/buttonBarButtonStyle"
            android:text="@string/autofill_save_no" >
        </Button>

    <TextView
        <Button
            android:id="@+id/autofill_save_yes"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
      android:layout_below="@+id/autofill_save_title"
      android:layout_alignParentRight="true"
      android:text="Save"
      android:textAllCaps="true"
      android:singleLine="true"/>
            style="?android:attr/buttonBarButtonStyle"
            android:text="@string/autofill_save_yes" >
        </Button>

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

</RelativeLayout>
</LinearLayout>
+7 −0
Original line number Diff line number Diff line
@@ -4510,4 +4510,11 @@
    <!-- Accessibility string used for describing the button in time picker that changes the dialog to circular clock mode. [CHAR LIMIT=NONE] -->
    <string name="time_picker_radial_mode_description">Switch to clock mode for the time input.</string>

    <!-- Title for the auto-fill save dialog shown when the user entered savable text [CHAR LIMIT=NONE] -->
    <string name="autofill_save_title">Save to <xliff:g id="label" example="MyPass">%1$s</xliff:g>?</string>
    <!-- Label for the auto-fill save button [CHAR LIMIT=NONE] -->
    <string name="autofill_save_yes">Save</string>
    <!-- Label for the auto-fill cancel button [CHAR LIMIT=NONE] -->
    <string name="autofill_save_no">No thanks</string>

</resources>
+4 −0
Original line number Diff line number Diff line
@@ -2842,6 +2842,10 @@
  <java-symbol type="id" name="autofill_save_title" />
  <java-symbol type="id" name="autofill_save_no" />
  <java-symbol type="id" name="autofill_save_yes" />
  <java-symbol type="id" name="autofill_save_close" />
  <java-symbol type="string" name="autofill_save_title" />
  <java-symbol type="string" name="autofill_save_yes" />
  <java-symbol type="string" name="autofill_save_no" />

  <!-- Accessibility fingerprint gestures -->
  <java-symbol type="string" name="capability_title_canCaptureFingerprintGestures" />
Loading