Kaynağa Gözat

align avatar placeholders with dark/light theme and add placeholder to settings avatar

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 yıl önce
ebeveyn
işleme
c3e336b716

+ 2 - 1
app/src/main/java/com/nextcloud/talk/controllers/SettingsController.java

@@ -107,6 +107,7 @@ import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.appcompat.app.AlertDialog;
 import androidx.core.content.ContextCompat;
+import androidx.core.content.res.ResourcesCompat;
 import androidx.core.view.ViewCompat;
 import androidx.emoji.widget.EmojiTextView;
 import androidx.work.OneTimeWorkRequest;
@@ -561,7 +562,7 @@ public class SettingsController extends BaseController {
             if (currentUser.getDisplayName() != null) {
                 displayNameTextView.setText(currentUser.getDisplayName());
             }
-
+            
             DisplayUtils.loadAvatarImage(currentUser, avatarImageView, false);
 
             profileQueryDisposable = ncApi.getUserProfile(credentials,

+ 27 - 0
app/src/main/res/drawable-night/account_circle_48dp.xml

@@ -0,0 +1,27 @@
+<!--
+    @author Google LLC
+    Copyright (C) 2018 Google LLC
+
+    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="48dp"
+    android:height="48dp"
+    android:autoMirrored="true"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path
+        android:fillColor="#61FFFFFF"
+        android:fillType="nonZero"
+        android:pathData="M12,20.64C9,20.64 6.348,19.104 4.8,16.8C4.836,14.4 9.6,13.08 12,13.08C14.4,13.08 19.164,14.4 19.2,16.8C17.652,19.104 15,20.64 12,20.64M12,3.6C13.9752,3.6 15.6,5.2248 15.6,7.2C15.6,9.1752 13.9752,10.8 12,10.8C10.0248,10.8 8.4,9.1752 8.4,7.2C8.4,5.2248 10.0248,3.6 12,3.6M12,0C5.4168,0 0,5.4168 0,12C0,18.5832 5.4168,24 12,24C18.5832,24 24,18.5832 24,12C24,5.364 18.6,0 12,0Z" />
+</vector>

+ 27 - 0
app/src/main/res/drawable-night/account_circle_96dp.xml

@@ -0,0 +1,27 @@
+<!--
+    @author Google LLC
+    Copyright (C) 2018 Google LLC
+
+    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="96dp"
+    android:height="96dp"
+    android:autoMirrored="true"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path
+        android:fillColor="#61FFFFFF"
+        android:fillType="nonZero"
+        android:pathData="M12,20.64C9,20.64 6.348,19.104 4.8,16.8C4.836,14.4 9.6,13.08 12,13.08C14.4,13.08 19.164,14.4 19.2,16.8C17.652,19.104 15,20.64 12,20.64M12,3.6C13.9752,3.6 15.6,5.2248 15.6,7.2C15.6,9.1752 13.9752,10.8 12,10.8C10.0248,10.8 8.4,9.1752 8.4,7.2C8.4,5.2248 10.0248,3.6 12,3.6M12,0C5.4168,0 0,5.4168 0,12C0,18.5832 5.4168,24 12,24C18.5832,24 24,18.5832 24,12C24,5.364 18.6,0 12,0Z" />
+</vector>

+ 1 - 1
app/src/main/res/drawable/account_circle_48dp.xml

@@ -21,7 +21,7 @@
     android:viewportWidth="24"
     android:viewportHeight="24">
     <path
-        android:fillColor="#FF666666"
+        android:fillColor="#61000000"
         android:fillType="nonZero"
         android:pathData="M12,20.64C9,20.64 6.348,19.104 4.8,16.8C4.836,14.4 9.6,13.08 12,13.08C14.4,13.08 19.164,14.4 19.2,16.8C17.652,19.104 15,20.64 12,20.64M12,3.6C13.9752,3.6 15.6,5.2248 15.6,7.2C15.6,9.1752 13.9752,10.8 12,10.8C10.0248,10.8 8.4,9.1752 8.4,7.2C8.4,5.2248 10.0248,3.6 12,3.6M12,0C5.4168,0 0,5.4168 0,12C0,18.5832 5.4168,24 12,24C18.5832,24 24,18.5832 24,12C24,5.364 18.6,0 12,0Z" />
 </vector>

+ 27 - 0
app/src/main/res/drawable/account_circle_96dp.xml

@@ -0,0 +1,27 @@
+<!--
+    @author Google LLC
+    Copyright (C) 2018 Google LLC
+
+    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="96dp"
+    android:height="96dp"
+    android:autoMirrored="true"
+    android:viewportWidth="24"
+    android:viewportHeight="24">
+    <path
+        android:fillColor="#61000000"
+        android:fillType="nonZero"
+        android:pathData="M12,20.64C9,20.64 6.348,19.104 4.8,16.8C4.836,14.4 9.6,13.08 12,13.08C14.4,13.08 19.164,14.4 19.2,16.8C17.652,19.104 15,20.64 12,20.64M12,3.6C13.9752,3.6 15.6,5.2248 15.6,7.2C15.6,9.1752 13.9752,10.8 12,10.8C10.0248,10.8 8.4,9.1752 8.4,7.2C8.4,5.2248 10.0248,3.6 12,3.6M12,0C5.4168,0 0,5.4168 0,12C0,18.5832 5.4168,24 12,24C18.5832,24 24,18.5832 24,12C24,5.364 18.6,0 12,0Z" />
+</vector>

+ 4 - 1
app/src/main/res/layout/controller_settings.xml

@@ -23,6 +23,7 @@
 <com.yarolegovich.mp.MaterialPreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:apc="http://schemas.android.com/apk/res-auto"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:fresco="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/settings_screen"
     android:layout_width="match_parent"
@@ -118,9 +119,11 @@
                 android:layout_width="@dimen/avatar_size_big"
                 android:layout_height="@dimen/avatar_size_big"
                 android:layout_centerHorizontal="true"
+                android:src="@drawable/account_circle_96dp"
                 android:transitionName="userAvatar.transitionTag"
                 apc:roundAsCircle="true"
-                tools:src="@tools:sample/avatars[0]" />
+                fresco:failureImage="@drawable/account_circle_96dp"
+                fresco:placeholderImage="@drawable/account_circle_96dp" />
 
             <com.yarolegovich.mp.MaterialStandardPreference
                 android:id="@+id/settings_remove_account"