From 4aeddb3ba2f8d78b180f99ada68c47c426aa79dd Mon Sep 17 00:00:00 2001 From: Pierre Date: Sat, 14 Apr 2018 17:03:04 +0200 Subject: [PATCH] Display a notice on user page when there is not any post to show. --- .../client/ui/fragments/UserPageFragment.java | 12 ++++++++++++ app/src/main/res/layout/fragment_user_page.xml | 9 +++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 22 insertions(+) diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java index f6ce622..50e0763 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/UserPageFragment.java @@ -93,6 +93,11 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen */ private ImageView user_image; + /** + * No post notice + */ + private TextView mNoPostNotice; + /** * Posts list fragment */ @@ -148,6 +153,10 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen user_image = view.findViewById(R.id.user_account_image); user_name = view.findViewById(R.id.user_account_name); + //Get the no post notice + mNoPostNotice = view.findViewById(R.id.no_post_notice); + mNoPostNotice.setVisibility(View.GONE); + //Get the view related to the create post form mCreatePostButton = view.findViewById(R.id.create_post_button); mCreatePostForm = view.findViewById(R.id.create_post_form); @@ -325,6 +334,9 @@ public class UserPageFragment extends Fragment implements PostsCreateFormFragmen FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); transaction.replace(R.id.fragment_user_page, mPostsListFragment); transaction.commit(); + + //Check if there is not any post on the page + mNoPostNotice.setVisibility(mPostsList.size() == 0 ? View.VISIBLE : View.GONE); } /** diff --git a/app/src/main/res/layout/fragment_user_page.xml b/app/src/main/res/layout/fragment_user_page.xml index 2b37e2c..bddeaf2 100644 --- a/app/src/main/res/layout/fragment_user_page.xml +++ b/app/src/main/res/layout/fragment_user_page.xml @@ -54,6 +54,15 @@ android:id="@+id/create_post_form" layout="@layout/post_create_form" /> + + + An error occurred while retrieving friendship status! An error occurred while trying to get post information! You do not have any notification yet. + There is not any post on this page yet.