diff --git a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java index e29c4e2..bf22f7e 100644 --- a/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java +++ b/app/src/main/java/org/communiquons/android/comunic/client/ui/fragments/NotificationsFragment.java @@ -16,6 +16,7 @@ import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; import android.widget.ProgressBar; +import android.widget.TextView; import android.widget.Toast; import org.communiquons.android.comunic.client.R; @@ -74,6 +75,11 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont */ private ProgressBar mLoadingProgress; + /** + * No notification notice + */ + private TextView mNoNotifNotice; + /** * User page opener */ @@ -108,6 +114,10 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont //Get loading progress view mLoadingProgress = view.findViewById(R.id.loading_progress); + //Get the "no notification" notice + mNoNotifNotice = view.findViewById(R.id.no_notification_notification_notice); + mNoNotifNotice.setVisibility(View.GONE); + //Delete all the notifications action mDeleteNotificationsBtn = view.findViewById(R.id.delete_all_notif_btn); mDeleteNotificationsBtn.setOnClickListener(new View.OnClickListener() { @@ -272,6 +282,9 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont //Set context menu creator mNotificationsListView.setOnCreateContextMenuListener(this); mNotificationsListView.setOnItemClickListener(this); + + //Check if there is not any notification to display the "no notification" notice + updateNoNotifNotif(); } @Override @@ -316,6 +329,9 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont mNotificationsList.remove(pos); mNotificationsAdapter.notifyDataSetChanged(); + //Check if the "no notification" notice has to be shown + updateNoNotifNotif(); + //Delete the notification from the server new AsyncTask(){ @@ -362,4 +378,11 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont } } + + /** + * Update the visibility status of the no notification status + */ + private void updateNoNotifNotif(){ + mNoNotifNotice.setVisibility(mNotificationsList.size() == 0 ? View.VISIBLE : View.GONE); + } } diff --git a/app/src/main/res/layout/fragment_notifications.xml b/app/src/main/res/layout/fragment_notifications.xml index c9f37a6..21bcad9 100644 --- a/app/src/main/res/layout/fragment_notifications.xml +++ b/app/src/main/res/layout/fragment_notifications.xml @@ -11,6 +11,15 @@ android:layout_gravity="center" android:layout_marginTop="10dp"/> + + + Reject request An error occurred while retrieving friendship status! An error occurred while trying to get post information! + You do not have any notification yet.