mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 22:09:30 +00:00
Display a notice when the user does not have any notification.
This commit is contained in:
parent
f9156f8e6a
commit
f7fef9905b
@ -16,6 +16,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.communiquons.android.comunic.client.R;
|
import org.communiquons.android.comunic.client.R;
|
||||||
@ -74,6 +75,11 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont
|
|||||||
*/
|
*/
|
||||||
private ProgressBar mLoadingProgress;
|
private ProgressBar mLoadingProgress;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No notification notice
|
||||||
|
*/
|
||||||
|
private TextView mNoNotifNotice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User page opener
|
* User page opener
|
||||||
*/
|
*/
|
||||||
@ -108,6 +114,10 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont
|
|||||||
//Get loading progress view
|
//Get loading progress view
|
||||||
mLoadingProgress = view.findViewById(R.id.loading_progress);
|
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
|
//Delete all the notifications action
|
||||||
mDeleteNotificationsBtn = view.findViewById(R.id.delete_all_notif_btn);
|
mDeleteNotificationsBtn = view.findViewById(R.id.delete_all_notif_btn);
|
||||||
mDeleteNotificationsBtn.setOnClickListener(new View.OnClickListener() {
|
mDeleteNotificationsBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -272,6 +282,9 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont
|
|||||||
//Set context menu creator
|
//Set context menu creator
|
||||||
mNotificationsListView.setOnCreateContextMenuListener(this);
|
mNotificationsListView.setOnCreateContextMenuListener(this);
|
||||||
mNotificationsListView.setOnItemClickListener(this);
|
mNotificationsListView.setOnItemClickListener(this);
|
||||||
|
|
||||||
|
//Check if there is not any notification to display the "no notification" notice
|
||||||
|
updateNoNotifNotif();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -316,6 +329,9 @@ public class NotificationsFragment extends Fragment implements View.OnCreateCont
|
|||||||
mNotificationsList.remove(pos);
|
mNotificationsList.remove(pos);
|
||||||
mNotificationsAdapter.notifyDataSetChanged();
|
mNotificationsAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
//Check if the "no notification" notice has to be shown
|
||||||
|
updateNoNotifNotif();
|
||||||
|
|
||||||
//Delete the notification from the server
|
//Delete the notification from the server
|
||||||
new AsyncTask<Integer, Void, Boolean>(){
|
new AsyncTask<Integer, Void, Boolean>(){
|
||||||
|
|
||||||
@ -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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,15 @@
|
|||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginTop="10dp"/>
|
android:layout_marginTop="10dp"/>
|
||||||
|
|
||||||
|
<!-- No notification notice -->
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/no_notification_notification_notice"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/notice_no_notification"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginTop="10dp"/>
|
||||||
|
|
||||||
<!-- Notifications list -->
|
<!-- Notifications list -->
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/notificcation_list"
|
android:id="@+id/notificcation_list"
|
||||||
|
@ -173,4 +173,5 @@
|
|||||||
<string name="button_reject_friend_request">Reject request</string>
|
<string name="button_reject_friend_request">Reject request</string>
|
||||||
<string name="err_get_friendship_status">An error occurred while retrieving friendship status!</string>
|
<string name="err_get_friendship_status">An error occurred while retrieving friendship status!</string>
|
||||||
<string name="err_get_post_info">An error occurred while trying to get post information!</string>
|
<string name="err_get_post_info">An error occurred while trying to get post information!</string>
|
||||||
|
<string name="notice_no_notification">You do not have any notification yet.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user