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

Commit 7f3c2dc2 authored by Andras Kloczl's avatar Andras Kloczl
Browse files

Add user name photo dialog to user creation

- Remove unused method switchTo
- Move edit user controllers from settings module
- Create new activity for new user creation
- Add ActivityStarter for delegating activity starting
- Add UserCreator for user creation logic
- Add UserCreatingDialog to display while user is creating

Test: manual test && atest EditUserInfoControllerTest
Doc: http://shortn/_cJE9o6pBZR
Screenrecords: http://shortn/_VEN6rr5ta6
Bug: 147653252
Change-Id: I6a7f1dba499e95891c69569ab731f86e6fd1dc16
parent ccfe7f82
Loading
Loading
Loading
Loading
+51 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2013 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:baselineAligned="false"
    android:orientation="horizontal"
    android:padding="16dp">

    <ImageView
        android:id="@+id/user_photo"
        android:layout_width="56dp"
        android:layout_height="56dp"
        android:layout_gravity="bottom"
        android:contentDescription="@string/user_image_photo_selector"
        android:background="@*android:drawable/spinner_background_holo_dark"
        android:scaleType="fitCenter"/>

    <EditText
        android:id="@+id/user_name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:minWidth="200dp"
        android:layout_marginStart="6dp"
        android:minHeight="@dimen/min_tap_target_size"
        android:ellipsize="end"
        android:singleLine="true"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:textAlignment="viewStart"
        android:inputType="text|textCapWords"
        android:selectAllOnFocus="true"
        android:hint="@string/user_nickname"
        android:maxLength="100"/>

</LinearLayout>
+47 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2016, The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:paddingEnd="16dp"
    android:paddingStart="16dp">

    <TextView
        android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:ellipsize="marquee"
        android:textAppearance="?android:attr/textAppearanceListItemSmall"
        android:textColor="?android:attr/textColorAlertDialogListItem" />

    <ImageView
        android:id="@+id/restricted_icon"
        android:layout_width="@*android:dimen/config_restrictedIconSize"
        android:layout_height="@*android:dimen/config_restrictedIconSize"
        android:layout_alignParentRight="true"
        android:scaleType="centerInside"
        android:src="@*android:drawable/ic_info"
        android:tint="?android:attr/colorAccent"
        android:visibility="gone" />

</RelativeLayout>
+27 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2020 The Android Open Source Project
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/message"
    style="?android:attr/textAppearanceListItem"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:paddingStart="?android:attr/dialogPreferredPadding"
    android:paddingEnd="?android:attr/dialogPreferredPadding"
    android:paddingTop="24dp"
    android:paddingBottom="24dp" />
+4 −0
Original line number Diff line number Diff line
@@ -97,4 +97,8 @@

    <!-- Size of advanced icon -->
    <dimen name="advanced_icon_size">18dp</dimen>

    <!-- Minimum width for the popup for updating a user's photo. -->
    <dimen name="update_user_photo_popup_min_width">300dp</dimen>

</resources>
+12 −0
Original line number Diff line number Diff line
@@ -1354,6 +1354,11 @@
    <string name="user_set_lock_button">Set lock</string>
    <!-- Label for switching to other user in the user switcher [CHAR LIMIT=35] -->
    <string name="user_switch_to_user">Switch to <xliff:g id="user_name" example="John Doe">%s</xliff:g></string>
    <!-- Dialog message when creating a new user [CHAR LIMIT=40] -->
    <string name="creating_new_user_dialog_message">Creating new user…</string>

    <!-- Title for the preference to enter the nickname of the user to display in the user switcher [CHAR LIMIT=25]-->
    <string name="user_nickname">Nickname</string>

    <!-- Label for adding a new guest in the user switcher [CHAR LIMIT=35] -->
    <string name="guest_new_guest">Add guest</string>
@@ -1362,6 +1367,13 @@
    <!-- Name for the guest user [CHAR LIMIT=35] -->
    <string name="guest_nickname">Guest</string>

    <!-- An option in a photo selection dialog to take a new photo [CHAR LIMIT=50] -->
    <string name="user_image_take_photo">Take a photo</string>
    <!-- An option in a photo selection dialog to choose a pre-existing image [CHAR LIMIT=50] -->
    <string name="user_image_choose_photo">Choose an image</string>
    <!-- Accessibility message for the photo selector which is a button/popup with the current photo [CHAR LIMIT=50] -->
    <string name="user_image_photo_selector">Select photo</string>

    <!-- List entry in developer settings to choose default device/system behavior for the app freezer [CHAR LIMIT=30]-->
    <string name="cached_apps_freezer_device_default">Device default</string>
    <!-- List entry in developer settings to disable the app freezer in developer settings [CHAR LIMIT=30]-->
Loading