mirror of
https://github.com/pierre42100/ComunicAndroid
synced 2024-11-23 22:09:30 +00:00
Can remove members from a conversation
This commit is contained in:
parent
88f6f36796
commit
4674821c60
@ -7,9 +7,13 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.ArrayMap;
|
import android.util.ArrayMap;
|
||||||
|
import android.view.ContextMenu;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.MenuInflater;
|
||||||
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.AdapterView;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
@ -166,7 +170,22 @@ public class UpdateConversationFragment extends Fragment {
|
|||||||
//Initialize the form
|
//Initialize the form
|
||||||
init_form();
|
init_form();
|
||||||
|
|
||||||
|
//Set members list context menu
|
||||||
|
membersList.setOnCreateContextMenuListener(new View.OnCreateContextMenuListener() {
|
||||||
|
@Override
|
||||||
|
public void onCreateContextMenu(ContextMenu menu, View v,
|
||||||
|
ContextMenu.ContextMenuInfo menuInfo) {
|
||||||
|
|
||||||
|
//Create menu
|
||||||
|
MenuInflater menuInflater = getActivity().getMenuInflater();
|
||||||
|
menuInflater.inflate(R.menu.menu_fragment_update_conversation_memberslist, menu);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
@ -291,6 +310,31 @@ public class UpdateConversationFragment extends Fragment {
|
|||||||
membersAdapter.notifyDataSetChanged();
|
membersAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles the context menu actions of the friends list
|
||||||
|
*
|
||||||
|
* @param item The selected item
|
||||||
|
* @return TRUE if the action was handled, false else
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
|
|
||||||
|
//Get the selected opition
|
||||||
|
int option = item.getItemId();
|
||||||
|
|
||||||
|
//Check if we have to remove a member of the conversation
|
||||||
|
if(option == R.id.update_conversationmembers_delete){
|
||||||
|
|
||||||
|
//Remove the member from the list
|
||||||
|
membersID.remove(((AdapterView.AdapterContextMenuInfo) item.getMenuInfo()).position);
|
||||||
|
membersAdapter.notifyDataSetChanged();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onContextItemSelected(item);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Submit creation form
|
* Submit creation form
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- Delete member -->
|
||||||
|
<item
|
||||||
|
android:id="@+id/update_conversationmembers_delete"
|
||||||
|
android:title="@string/fragment_update_conversation_members_menu_delete"
|
||||||
|
/>
|
||||||
|
</menu>
|
@ -86,4 +86,5 @@
|
|||||||
<string name="err_get_users_info">Could not get information about users !</string>
|
<string name="err_get_users_info">Could not get information about users !</string>
|
||||||
<string name="err_conversation_need_members">Please add at least one member to the conversation !</string>
|
<string name="err_conversation_need_members">Please add at least one member to the conversation !</string>
|
||||||
<string name="err_conversation_create">Could not create conversation !</string>
|
<string name="err_conversation_create">Could not create conversation !</string>
|
||||||
|
<string name="fragment_update_conversation_members_menu_delete">Remove</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user