mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 13:59:29 +00:00
Display error in case of failure while deleting conversation
This commit is contained in:
parent
2c29b49c24
commit
c180bf3a3f
@ -375,17 +375,22 @@ public class ConversationsListFragment extends Fragment implements AdapterView.O
|
||||
* @param convID The ID of the conversation to delete
|
||||
*/
|
||||
private void delete_conversation(final int convID){
|
||||
new AsyncTask<Void, Void, Void>(){
|
||||
new AsyncTask<Void, Void, Boolean>(){
|
||||
|
||||
@Override
|
||||
protected Void doInBackground(Void... params) {
|
||||
conversationsListHelper.delete(convID);
|
||||
return null;
|
||||
protected Boolean doInBackground(Void... params) {
|
||||
return conversationsListHelper.delete(convID);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Void aVoid) {
|
||||
protected void onPostExecute(Boolean result) {
|
||||
refresh_conversations_list();
|
||||
|
||||
//Display a toast if an error occurred
|
||||
if(!result)
|
||||
Toast.makeText(getActivity(),
|
||||
R.string.fragment_conversationslist_err_del_conversation,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user