Răsfoiți Sursa

Use ConstraintLayout

Signed-off-by: Joris Bodin <joris.bodin@infomaniak.com>
Joris Bodin 5 ani în urmă
părinte
comite
34ccaef48e
2 a modificat fișierele cu 56 adăugiri și 76 ștergeri
  1. 56 75
      src/main/res/layout/user_info_layout.xml
  2. 0 1
      src/main/res/values/dims.xml

+ 56 - 75
src/main/res/layout/user_info_layout.xml

@@ -19,6 +19,7 @@
 -->
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:app="http://schemas.android.com/apk/res-auto"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_height="match_parent"
     android:background="@color/bg_default"
     android:background="@color/bg_default"
@@ -26,7 +27,7 @@
 
 
     <include layout="@layout/toolbar_standard" />
     <include layout="@layout/toolbar_standard" />
 
 
-    <RelativeLayout
+    <androidx.constraintlayout.widget.ConstraintLayout
         android:layout_width="match_parent"
         android:layout_width="match_parent"
         android:layout_height="@dimen/nav_drawer_header_height">
         android:layout_height="@dimen/nav_drawer_header_height">
 
 
@@ -34,82 +35,62 @@
             android:id="@+id/user_info_background"
             android:id="@+id/user_info_background"
             android:layout_width="match_parent"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_height="match_parent"
+            android:background="@drawable/background_nc18"
             android:contentDescription="@string/drawer_header_background"
             android:contentDescription="@string/drawer_header_background"
-            android:scaleType="centerCrop" />
+            android:scaleType="centerCrop"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintTop_toTopOf="parent" />
 
 
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:gravity="bottom"
-            android:orientation="vertical">
-
-            <RelativeLayout
-                android:layout_width="match_parent"
-                android:layout_height="wrap_content"
-                android:layout_marginStart="@dimen/toolbar_user_information_layout_margin"
-                android:layout_marginEnd="@dimen/standard_half_margin"
-                android:layout_marginBottom="@dimen/toolbar_user_information_layout_margin"
-                android:gravity="bottom"
-                android:orientation="horizontal"
-                android:weightSum="1">
-
-                <FrameLayout
-                    android:id="@+id/avatar_container"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content">
-
-                    <ImageView
-                        android:id="@+id/user_icon"
-                        android:layout_width="@dimen/nav_drawer_header_avatar"
-                        android:layout_height="@dimen/nav_drawer_header_avatar"
-                        android:contentDescription="@string/avatar"
-                        android:src="@drawable/account_circle_white" />
-                </FrameLayout>
-
-                <LinearLayout
-                    android:layout_width="match_parent"
-                    android:layout_height="wrap_content"
-                    android:layout_centerInParent="true"
-                    android:layout_marginLeft="@dimen/standard_half_margin"
-                    android:layout_marginRight="@dimen/standard_half_margin"
-                    android:layout_toEndOf="@id/avatar_container"
-                    android:orientation="vertical">
-
-                    <TextView
-                        android:id="@+id/userinfo_username_full"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:ellipsize="end"
-                        android:maxLines="1"
-                        android:shadowColor="@color/drawer_shadow"
-                        android:shadowDx="0.5"
-                        android:shadowDy="0"
-                        android:shadowRadius="2"
-                        android:textColor="@color/white"
-                        android:textSize="@dimen/drawer_header_text"
-                        android:textStyle="bold" />
-
-                    <TextView
-                        android:id="@+id/userinfo_username"
-                        android:layout_width="match_parent"
-                        android:layout_height="wrap_content"
-                        android:ellipsize="end"
-                        android:lines="1"
-                        android:maxLines="1"
-                        android:shadowColor="@color/drawer_shadow"
-                        android:shadowDx="0.5"
-                        android:shadowDy="0"
-                        android:shadowRadius="2"
-                        android:textColor="@color/white"
-                        android:textSize="@dimen/drawer_header_subtext" />
-                </LinearLayout>
-
-            </RelativeLayout>
-
-            <include layout="@layout/info_box" />
-
-        </LinearLayout>
-    </RelativeLayout>
+        <ImageView
+            android:id="@+id/user_icon"
+            android:layout_width="@dimen/nav_drawer_header_avatar"
+            android:layout_height="@dimen/nav_drawer_header_avatar"
+            android:layout_marginStart="@dimen/account_item_layout_user_image_left_start_margin"
+            android:layout_marginBottom="@dimen/account_item_layout_user_image_left_start_margin"
+            android:contentDescription="@string/avatar"
+            android:src="@drawable/account_circle_white"
+            app:layout_constraintBottom_toBottomOf="parent"
+            app:layout_constraintStart_toStartOf="parent" />
+
+        <TextView
+            android:id="@+id/userinfo_username_full"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="8dp"
+            android:layout_marginTop="8dp"
+            android:ellipsize="end"
+            android:maxLines="1"
+            android:shadowColor="@color/drawer_shadow"
+            android:shadowDx="0.5"
+            android:shadowDy="0"
+            android:shadowRadius="2"
+            android:textColor="@color/white"
+            android:textSize="@dimen/file_details_username_text_size"
+            android:textStyle="bold"
+            app:layout_constraintStart_toEndOf="@id/user_icon"
+            app:layout_constraintTop_toTopOf="@id/user_icon"
+            tools:text="John Doe" />
+
+        <TextView
+            android:id="@+id/userinfo_username"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:ellipsize="end"
+            android:lines="1"
+            android:maxLines="1"
+            android:shadowColor="@color/drawer_shadow"
+            android:shadowDx="0.5"
+            android:shadowDy="0"
+            android:shadowRadius="2"
+            android:textColor="@color/white"
+            android:textSize="@dimen/drawer_header_subtext"
+            app:layout_constraintStart_toStartOf="@id/userinfo_username_full"
+            app:layout_constraintTop_toBottomOf="@id/userinfo_username_full"
+            tools:text="john@nextcloud.com" />
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
 
 
     <LinearLayout
     <LinearLayout
         android:id="@+id/user_info_view"
         android:id="@+id/user_info_view"

+ 0 - 1
src/main/res/values/dims.xml

@@ -139,7 +139,6 @@
     <dimen name="synced_folders_item_type_layout_right_end_margin">24dp</dimen>
     <dimen name="synced_folders_item_type_layout_right_end_margin">24dp</dimen>
     <dimen name="synced_folders_recycler_view_layout_margin">-3dp</dimen>
     <dimen name="synced_folders_recycler_view_layout_margin">-3dp</dimen>
     <dimen name="synced_folders_control_width">80dp</dimen>
     <dimen name="synced_folders_control_width">80dp</dimen>
-    <dimen name="toolbar_user_information_layout_margin">12dp</dimen>
     <dimen name="bottom_sheet_text_size">16sp</dimen>
     <dimen name="bottom_sheet_text_size">16sp</dimen>
     <dimen name="permission_dialog_text_size">18sp</dimen>
     <dimen name="permission_dialog_text_size">18sp</dimen>
     <dimen name="button_corner_radius">24dp</dimen>
     <dimen name="button_corner_radius">24dp</dimen>