Browse Source

Improve userinfo item

Signed-off-by: Joris Bodin <joris.bodin@infomaniak.com>
Joris Bodin 5 years ago
parent
commit
a575cb01c6

+ 5 - 6
src/main/java/com/owncloud/android/ui/activity/UserInfoActivity.java

@@ -99,11 +99,10 @@ public class UserInfoActivity extends FileActivity implements Injectable {
     @BindView(R.id.empty_list_view_text) protected TextView emptyContentMessage;
     @BindView(R.id.empty_list_view_headline) protected TextView emptyContentHeadline;
     @BindView(R.id.empty_list_icon) protected ImageView emptyContentIcon;
-    @BindView(R.id.user_info_view) protected LinearLayout userInfoView;
-    @BindView(R.id.user_icon) protected ImageView avatar;
+    @BindView(R.id.userinfo_icon) protected ImageView avatar;
     @BindView(R.id.userinfo_username) protected TextView userName;
-    @BindView(R.id.userinfo_username_full) protected TextView fullName;
-    @BindView(R.id.user_info_list) protected RecyclerView mUserInfoList;
+    @BindView(R.id.userinfo_fullName) protected TextView fullName;
+    @BindView(R.id.userinfo_list) protected RecyclerView mUserInfoList;
     @BindView(R.id.empty_list_progress) protected ProgressBar multiListProgressBar;
 
     @BindString(R.string.user_information_retrieval_error) protected String sorryMessage;
@@ -223,7 +222,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
 
     private void setHeaderImage() {
         if (getStorageManager().getCapability(user.getAccountName()).getServerBackground() != null) {
-            ImageView backgroundImageView = findViewById(R.id.user_info_background);
+            ImageView backgroundImageView = findViewById(R.id.userinfo_background);
 
             if (backgroundImageView != null) {
 
@@ -282,7 +281,7 @@ public class UserInfoActivity extends FileActivity implements Injectable {
                 getString(R.string.userinfo_no_info_text), R.drawable.ic_user);
         } else {
             emptyContentContainer.setVisibility(View.GONE);
-            userInfoView.setVisibility(View.VISIBLE);
+            mUserInfoList.setVisibility(View.VISIBLE);
 
             if (mUserInfoList.getAdapter() instanceof UserInfoAdapter) {
                 mUserInfoList.setAdapter(new UserInfoAdapter(createUserInfoDetails(userInfo), tint));

+ 18 - 13
src/main/res/layout/user_info_details_table_item.xml

@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
   Nextcloud Android client application
 
   Copyright (C) 2018 Andy Scherzinger
@@ -18,31 +17,37 @@
   You should have received a copy of the GNU Affero General Public
   License along with this program.  If not, see <http://www.gnu.org/licenses/>.
 -->
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    android:layout_marginTop="12dp"
+    android:layout_marginBottom="12dp"
+    android:orientation="horizontal">
 
     <ImageView
         android:id="@+id/icon"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="@dimen/standard_half_margin"
-        android:layout_marginEnd="@dimen/standard_icon_list_horizontal_margin"
-        android:layout_marginStart="@dimen/standard_margin"
-        android:layout_marginTop="@dimen/standard_margin"
         android:contentDescription="@string/account_icon"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintTop_toTopOf="parent"
         tools:src="@drawable/ic_phone" />
 
     <TextView
         android:id="@+id/text"
-        android:layout_width="match_parent"
+        android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:layout_centerInParent="true"
-        android:layout_margin="@dimen/standard_margin"
-        android:layout_toEndOf="@id/icon"
+        android:layout_marginStart="@dimen/standard_icon_list_horizontal_margin"
+        android:ellipsize="end"
         android:maxLines="3"
         android:textAppearance="?android:attr/textAppearanceListItem"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintStart_toEndOf="@id/icon"
+        app:layout_constraintTop_toTopOf="parent"
         tools:text="+49 123 456 789 12" />
 
-</RelativeLayout>
+</androidx.constraintlayout.widget.ConstraintLayout>

+ 16 - 23
src/main/res/layout/user_info_layout.xml

@@ -32,7 +32,7 @@
         android:layout_height="@dimen/nav_drawer_header_height">
 
         <ImageView
-            android:id="@+id/user_info_background"
+            android:id="@+id/userinfo_background"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:background="@drawable/background_nc18"
@@ -44,7 +44,7 @@
             app:layout_constraintTop_toTopOf="parent" />
 
         <ImageView
-            android:id="@+id/user_icon"
+            android:id="@+id/userinfo_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"
@@ -55,13 +55,13 @@
             app:layout_constraintStart_toStartOf="parent" />
 
         <TextView
-            android:id="@+id/userinfo_username_full"
+            android:id="@+id/userinfo_fullName"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_marginStart="8dp"
             android:layout_marginTop="8dp"
             android:ellipsize="end"
-            android:maxLines="1"
+            android:lines="1"
             android:shadowColor="@color/drawer_shadow"
             android:shadowDx="0.5"
             android:shadowDy="0"
@@ -69,8 +69,9 @@
             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"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toEndOf="@id/userinfo_icon"
+            app:layout_constraintTop_toTopOf="@id/userinfo_icon"
             tools:text="John Doe" />
 
         <TextView
@@ -78,36 +79,28 @@
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:ellipsize="end"
-            android:lines="1"
-            android:maxLines="1"
+            android:lines="2"
             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"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintStart_toStartOf="@id/userinfo_fullName"
+            app:layout_constraintTop_toBottomOf="@id/userinfo_fullName"
             tools:text="john@nextcloud.com" />
 
     </androidx.constraintlayout.widget.ConstraintLayout>
 
-    <LinearLayout
-        android:id="@+id/user_info_view"
+    <androidx.recyclerview.widget.RecyclerView
+        android:id="@+id/userinfo_list"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_margin="6dp"
+        android:layout_margin="@dimen/standard_margin"
         android:orientation="vertical"
-        android:visibility="gone">
-
-        <androidx.recyclerview.widget.RecyclerView
-            android:id="@+id/user_info_list"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical"
-            app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
-
-    </LinearLayout>
+        android:visibility="gone"
+        app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" />
 
     <include layout="@layout/empty_list" />