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

Commit dde4cdde authored by Tony Huang's avatar Tony Huang
Browse files

Update text input layout style and fix focus bug.

1. Update TextInputLayout style to outline.
2. Update EditText hint to TextInputLayout.
3. Update EditText input type to word cased.
4. Update EditText to TextInputEditText.
5. Add requestFocus when create folder.

Fix: 122314827
Fix: 122083369
Fix: 118055215
Test: visual
Test: atest DocumentsUITests
Change-Id: Ic9122f74e6074761afa9e8c32c67713818b1bdce
parent 026ac090
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -20,19 +20,22 @@
    android:fitsSystemWindows="true">

    <com.google.android.material.textfield.TextInputLayout
        android:id="@+id/rename_input_wrapper"
        android:id="@+id/input_wrapper"
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="?android:attr/listPreferredItemPaddingStart"
        android:layout_marginEnd="?android:attr/listPreferredItemPaddingEnd"
        android:layout_centerInParent="true" >
        android:layout_marginTop="@dimen/dialog_content_padding_top"
        android:layout_marginBottom="@dimen/dialog_content_padding_bottom"
        android:layout_centerInParent="true"
        style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">

        <EditText
        <com.google.android.material.textfield.TextInputEditText
            android:id="@android:id/text1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:inputType="text"/>
            android:inputType="textCapWords"/>

    </com.google.android.material.textfield.TextInputLayout>
</FrameLayout>
+2 −0
Original line number Diff line number Diff line
@@ -85,4 +85,6 @@
    <dimen name="search_chip_spacing">8dp</dimen>
    <dimen name="search_chip_icon_padding">4dp</dimen>

    <dimen name="dialog_content_padding_top">18dp</dimen>
    <dimen name="dialog_content_padding_bottom">24dp</dimen>
</resources>
+5 −1
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.widget.TextView;
import android.widget.TextView.OnEditorActionListener;

import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputLayout;

import com.android.documentsui.base.DocumentInfo;
import com.android.documentsui.base.Shared;
@@ -72,6 +73,9 @@ public class CreateDirectoryFragment extends DialogFragment {
        final View view = dialogInflater.inflate(R.layout.dialog_file_name, null, false);
        final EditText editText = (EditText) view.findViewById(android.R.id.text1);

        final TextInputLayout inputWrapper = view.findViewById(R.id.input_wrapper);
        inputWrapper.setHint(getString(R.string.input_hint_new_folder));

        builder.setTitle(R.string.menu_create_dir);
        builder.setView(view);

@@ -105,7 +109,7 @@ public class CreateDirectoryFragment extends DialogFragment {
                        return false;
                    }
                });
        editText.setHint(R.string.input_hint_new_folder);
        editText.requestFocus();

        return dialog;
    }
+2 −2
Original line number Diff line number Diff line
@@ -77,7 +77,8 @@ public class RenameDocumentFragment extends DialogFragment {
        View view = dialogInflater.inflate(R.layout.dialog_file_name, null, false);

        mEditText = (EditText) view.findViewById(android.R.id.text1);
        mRenameInputWrapper = (TextInputLayout) view.findViewById(R.id.rename_input_wrapper);
        mRenameInputWrapper = (TextInputLayout) view.findViewById(R.id.input_wrapper);
        mRenameInputWrapper.setHint(getString(R.string.input_hint_rename));
        builder.setTitle(R.string.menu_rename);
        builder.setView(view);
        builder.setPositiveButton(android.R.string.ok, null);
@@ -104,7 +105,6 @@ public class RenameDocumentFragment extends DialogFragment {
                    }
                });
        mEditText.requestFocus();
        mEditText.setHint(R.string.input_hint_rename);
        return dialog;
    }