Also disable group subject change if not admin
This commit is contained in:
parent
58a7e452d8
commit
35da6ddfd0
4 changed files with 33 additions and 28 deletions
|
@ -716,11 +716,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
}
|
||||
}
|
||||
|
||||
public void displayChatGroupInfos(ArrayList<ContactAddress> contacts, boolean isAlreadyCreatedGroup, boolean isEditionEnabled) {
|
||||
public void displayChatGroupInfos(ArrayList<ContactAddress> contacts, String subject, boolean isAlreadyCreatedGroup, boolean isEditionEnabled) {
|
||||
Bundle extras = new Bundle();
|
||||
extras.putBoolean("isAlreadyCreatedGroup", isAlreadyCreatedGroup);
|
||||
extras.putBoolean("isEditionEnabled", isEditionEnabled);
|
||||
extras.putSerializable("ContactAddress", contacts);
|
||||
extras.putString("subject", subject);
|
||||
changeCurrentFragment(FragmentsAvailable.INFO_GROUP_CHAT, extras);
|
||||
}
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
if (contactsSelected.size() == 1) {
|
||||
LinphoneActivity.instance().displayChat(contactsSelected.get(0).getAddress(), "", "");
|
||||
} else {
|
||||
LinphoneActivity.instance().displayChatGroupInfos(contactsSelected, false, true);
|
||||
LinphoneActivity.instance().displayChatGroupInfos(contactsSelected, null, false, true);
|
||||
}
|
||||
} else if (id == R.id.clearSearchField) {
|
||||
searchField.setText("");
|
||||
|
|
|
@ -127,7 +127,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener {
|
|||
ContactAddress ca = new ContactAddress(c, a.asString(), c.isFriend());
|
||||
participants.add(ca);
|
||||
}
|
||||
LinphoneActivity.instance().displayChatGroupInfos(participants, true, /*TODO*/ false);
|
||||
LinphoneActivity.instance().displayChatGroupInfos(participants, mChatRoom.getSubject(), true, /*TODO*/ false);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ public class GroupInfoFragment extends Fragment {
|
|||
mParticipants = (ArrayList<ContactAddress>) getArguments().getSerializable("ContactAddress");
|
||||
mIsAlreadyCreatedGroup = getArguments().getBoolean("isAlreadyCreatedGroup");
|
||||
mIsEditionEnabled = getArguments().getBoolean("isEditionEnabled");
|
||||
String subject = getArguments().getString("subject");
|
||||
|
||||
mParticipantsList = view.findViewById(R.id.chat_room_participants);
|
||||
mAdapter = new GroupInfoAdapter(mInflater, mParticipants, !mIsEditionEnabled);
|
||||
|
@ -73,24 +74,6 @@ public class GroupInfoFragment extends Fragment {
|
|||
});
|
||||
mParticipantsList.setAdapter(mAdapter);
|
||||
|
||||
mSubjectField = view.findViewById(R.id.subjectField);
|
||||
mSubjectField.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 1);
|
||||
}
|
||||
});
|
||||
|
||||
mBackButton = view.findViewById(R.id.back);
|
||||
mBackButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -100,13 +83,6 @@ public class GroupInfoFragment extends Fragment {
|
|||
});
|
||||
|
||||
mConfirmButton = view.findViewById(R.id.confirm);
|
||||
mConfirmButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//TODO
|
||||
}
|
||||
});
|
||||
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 0);
|
||||
|
||||
mLeaveGroupButton = view.findViewById(R.id.leaveGroupLayout);
|
||||
mLeaveGroupButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -129,7 +105,35 @@ public class GroupInfoFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
mSubjectField = view.findViewById(R.id.subjectField);
|
||||
mSubjectField.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable editable) {
|
||||
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 1);
|
||||
}
|
||||
});
|
||||
mSubjectField.setText(subject);
|
||||
|
||||
mConfirmButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//TODO
|
||||
}
|
||||
});
|
||||
mConfirmButton.setEnabled(mSubjectField.getText().length() > 0 && mParticipants.size() > 0);
|
||||
|
||||
if (!mIsEditionEnabled) {
|
||||
mSubjectField.setEnabled(false);
|
||||
mConfirmButton.setVisibility(View.INVISIBLE);
|
||||
mAddParticipantsButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue