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

Commit 014128f4 authored by Tetiana Meronyk's avatar Tetiana Meronyk
Browse files

Request focus on title of user creating dialog for each stage.

Bug: 322855707
Test: enable TalkBack and walk through add user flow
Change-Id: I6e830d6f75973d0d6f3c19e3d71512998e4b3aa8
parent 96a28bb8
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -242,6 +242,7 @@ public class CreateUserDialogController {
                        .setMessage(messageResId)
                        .setNegativeButtonText(R.string.cancel)
                        .setPositiveButtonText(R.string.next);
                mCustomDialogHelper.requestFocusOnTitle();
                break;
            case GRANT_ADMIN_DIALOG:
                mEditUserInfoView.setVisibility(View.GONE);
@@ -254,6 +255,7 @@ public class CreateUserDialogController {
                        .setMessage(R.string.user_grant_admin_message)
                        .setNegativeButtonText(R.string.back)
                        .setPositiveButtonText(R.string.next);
                mCustomDialogHelper.requestFocusOnTitle();
                if (mIsAdmin == null) {
                    mCustomDialogHelper.setButtonEnabled(false);
                }
@@ -265,6 +267,7 @@ public class CreateUserDialogController {
                        .setTitle(R.string.user_info_settings_title)
                        .setNegativeButtonText(R.string.back)
                        .setPositiveButtonText(R.string.done);
                mCustomDialogHelper.requestFocusOnTitle();
                mEditUserInfoView.setVisibility(View.VISIBLE);
                mGrantAdminView.setVisibility(View.GONE);
                break;
@@ -273,7 +276,6 @@ public class CreateUserDialogController {
                        && mEditUserPhotoController.getNewUserPhotoDrawable() != null)
                        ? mEditUserPhotoController.getNewUserPhotoDrawable()
                        : mSavedDrawable;

                String newName = mUserNameView.getText().toString().trim();
                String defaultName = mActivity.getString(R.string.user_new_user_name);
                mUserName = !newName.isEmpty() ? newName : defaultName;
+10 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
@@ -282,4 +283,13 @@ public class CustomDialogHelper {
        }
        return this;
    }

    /**
     * Requests focus on dialog title when used. Used to let talkback know that the dialog content
     * is updated and needs to be read from the beginning.
     */
    public void requestFocusOnTitle() {
        mDialogTitle.requestFocus();
        mDialogTitle.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
    }
}