diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java index bfcb459..a01c6f0 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/helpers/GetUsersHelper.java @@ -432,6 +432,7 @@ public class GetUsersHelper { userInfos.setFirstName(userObject.getString("firstName")); userInfos.setLastName(userObject.getString("lastName")); userInfos.setAccountImageURL(userObject.getString("accountImage")); + userInfos.setVirtualDirectory(userObject.getString("virtualDirectory")); } catch (JSONException e){ e.printStackTrace(); diff --git a/app/src/main/java/org/communiquons/android/comunic/client/data/models/UserInfo.java b/app/src/main/java/org/communiquons/android/comunic/client/data/models/UserInfo.java index a32879b..bfe2bd4 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/data/models/UserInfo.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/data/models/UserInfo.java @@ -12,12 +12,13 @@ import org.communiquons.android.comunic.client.ui.utils.UiUtils; public class UserInfo { /** - * Informations about the user + * Information about the user */ private int id; private String firstName; private String lastName; private String accountImageURL; + private String virtualDirectory; /** * Set the ID of the user @@ -108,4 +109,20 @@ public class UserInfo { public String getAcountImageURL() { return accountImageURL; } + + + public String getVirtualDirectory() { + return virtualDirectory; + } + + public boolean hasVirtualDirectory(){ + return virtualDirectory != null; + } + + public void setVirtualDirectory(String virtualDirectory) { + this.virtualDirectory = virtualDirectory; + + if(virtualDirectory.equals("")) + this.virtualDirectory = null; + } } diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/userpage/AdvancedUserInfoFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/userpage/AdvancedUserInfoFragment.java index 482a433..98d0604 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/userpage/AdvancedUserInfoFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/userpage/AdvancedUserInfoFragment.java @@ -31,23 +31,12 @@ public class AdvancedUserInfoFragment extends Fragment { private AdvancedUserInfo mAdvancedUserInfo; /** - * User account image + * Views */ private WebUserAccountImage mUserAccountImage; - - /** - * The name of the user - */ private TextView mUserName; - - /** - * Target for the time the user has been a member of the group - */ + private TextView mUserTag; private TextView mMemberSinceTarget; - - /** - * Friendship status - */ private FriendshipStatusButton mFriendshipStatus; /** @@ -82,6 +71,7 @@ public class AdvancedUserInfoFragment extends Fragment { //Get the views mUserAccountImage = view.findViewById(R.id.user_account_image); mUserName = view.findViewById(R.id.user_name); + mUserTag = view.findViewById(R.id.userTag); mMemberSinceTarget = view.findViewById(R.id.member_since_value); mFriendshipStatus = view.findViewById(R.id.friendship_status); } @@ -95,6 +85,8 @@ public class AdvancedUserInfoFragment extends Fragment { mUserName.setText(mAdvancedUserInfo.getDisplayFullName()); mMemberSinceTarget.setText(TimeUtils.TimeToString(getActivity(), TimeUtils.time() - mAdvancedUserInfo.getAccount_creation_time())); + mUserTag.setText(mAdvancedUserInfo.hasVirtualDirectory() ? + "@" + mAdvancedUserInfo.getVirtualDirectory() : ""); } @Override diff --git a/app/src/main/res/layout/fragment_advanced_user_info.xml b/app/src/main/res/layout/fragment_advanced_user_info.xml index a9f9d90..12f953d 100644 --- a/app/src/main/res/layout/fragment_advanced_user_info.xml +++ b/app/src/main/res/layout/fragment_advanced_user_info.xml @@ -14,11 +14,12 @@ android:paddingStart="16dp" android:paddingTop="16dp"> + @@ -39,54 +42,71 @@ android:id="@+id/user_name" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:layout_marginStart="16dp" + android:layout_marginEnd="8dp" + android:layout_marginStart="8dp" android:layout_marginTop="8dp" + android:textAlignment="center" android:textAppearance="@style/TextAppearance.AppCompat.Display1" - app:layout_constraintBottom_toBottomOf="@+id/user_account_image" - app:layout_constraintStart_toEndOf="@+id/user_account_image" - app:layout_constraintTop_toTopOf="@+id/user_account_image" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/user_account_image" tools:text="User name" /> + + + + - + + android:layout_height="wrap_content"> - + - + - - - + - \ No newline at end of file