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

Commit b4751120 authored by Oli Lan's avatar Oli Lan
Browse files

Support taking or choosing a photo in avatar picker.

This adds options to take a photo or to choose a photo to
the new avatar picker.

The functionality to support both of these operations, plus
cropping, is largely the same as before but has been moved
from EditUserPhotoController to a new AvatarPhotoController.

The code from EditUserPhotoController has been moved without
changes where possible. Future CLs may introduce improvements
such as replacing AsyncTask.

The 'choose photo' has been changed from the previous behaviour,
however - it now shows the new photo picker.

Bug: 215134398
Test: manual, check new UI from settings and sysui and confirm working
Change-Id: I5d98902f3e8c186ad30d288b8eed544977ba0e48
parent f98ae93f
Loading
Loading
Loading
Loading
+30 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2022 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.
  -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <stroke
                android:width="2dp"
                android:color="?android:attr/colorPrimary"/>
        </shape>
    </item>
    <item
        android:left="@dimen/avatar_picker_icon_inset"
        android:right="@dimen/avatar_picker_icon_inset"
        android:top="@dimen/avatar_picker_icon_inset"
        android:bottom="@dimen/avatar_picker_icon_inset"
        android:drawable="@drawable/ic_avatar_choose_photo"/>
</layer-list>
+30 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2022 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.
  -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="oval">
            <stroke
                android:width="2dp"
                android:color="?android:attr/colorPrimary"/>
        </shape>
    </item>
    <item
        android:left="@dimen/avatar_picker_icon_inset"
        android:right="@dimen/avatar_picker_icon_inset"
        android:top="@dimen/avatar_picker_icon_inset"
        android:bottom="@dimen/avatar_picker_icon_inset"
        android:drawable="@drawable/ic_avatar_take_photo"/>
</layer-list>
+24 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2022 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.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
    <path
        android:fillColor="?android:attr/colorPrimary"
        android:pathData="M9,14h10l-3.45,-4.5 -2.3,3 -1.55,-2zM8,18q-0.825,0 -1.412,-0.587Q6,16.825 6,16L6,4q0,-0.825 0.588,-1.413Q7.175,2 8,2h12q0.825,0 1.413,0.587Q22,3.175 22,4v12q0,0.825 -0.587,1.413Q20.825,18 20,18zM8,16h12L20,4L8,4v12zM4,22q-0.825,0 -1.413,-0.587Q2,20.825 2,20L2,6h2v14h14v2zM8,4v12L8,4z"/>
</vector>
+24 −0
Original line number Diff line number Diff line
<!--
  ~ Copyright (C) 2022 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.
  -->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24"
        android:viewportHeight="24">
    <path
        android:fillColor="?android:attr/colorPrimary"
        android:pathData="M12,17.5q1.875,0 3.188,-1.313Q16.5,14.876 16.5,13q0,-1.875 -1.313,-3.188Q13.876,8.5 12,8.5q-1.875,0 -3.188,1.313Q7.5,11.124 7.5,13q0,1.875 1.313,3.188Q10.124,17.5 12,17.5zM4,21q-0.825,0 -1.413,-0.587Q2,19.825 2,19L2,7q0,-0.825 0.587,-1.412Q3.175,5 4,5h3.15L9,3h6l1.85,2L20,5q0.825,0 1.413,0.588Q22,6.175 22,7v12q0,0.825 -0.587,1.413Q20.825,21 20,21zM20,19L20,7L4,7v12zM4,19L4,7v12z"/>
</vector>
+2 −0
Original line number Diff line number Diff line
@@ -107,4 +107,6 @@
    <dimen name="avatar_picker_padding">6dp</dimen>
    <dimen name="avatar_picker_margin">2dp</dimen>

    <dimen name="avatar_picker_icon_inset">25dp</dimen>

</resources>
Loading