Changes related to chatRoom readOnly state

This commit is contained in:
Sylvain Berfini 2017-11-30 15:53:33 +01:00
parent 1d15479623
commit 1dbca18fe8
4 changed files with 6 additions and 9 deletions

View file

@ -327,7 +327,7 @@ public class ChatEventsAdapter extends ListSelectionAdapter implements ChatMessa
case ConferenceCreated: case ConferenceCreated:
holder.eventMessage.setText(mContext.getString(R.string.conference_created)); holder.eventMessage.setText(mContext.getString(R.string.conference_created));
break; break;
case ConferenceDestroyed: case ConferenceTerminated:
holder.eventMessage.setText(mContext.getString(R.string.conference_destroyed)); holder.eventMessage.setText(mContext.getString(R.string.conference_destroyed));
break; break;
case ConferenceParticipantAdded: case ConferenceParticipantAdded:

View file

@ -82,7 +82,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
private LayoutInflater mInflater; private LayoutInflater mInflater;
private ListView mChatEventsList; private ListView mChatEventsList;
private LinearLayout mFilesUploadLayout; private LinearLayout mFilesUploadLayout;
private boolean mIsReadOnly;
private ListSelectionHelper mSelectionHelper; private ListSelectionHelper mSelectionHelper;
private ViewTreeObserver.OnGlobalLayoutListener mKeyboardListener; private ViewTreeObserver.OnGlobalLayoutListener mKeyboardListener;
@ -374,7 +373,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mRemoteParticipantAddress = mChatRoom.getParticipants()[0].getAddress(); mRemoteParticipantAddress = mChatRoom.getParticipants()[0].getAddress();
} }
mIsReadOnly = mChatRoom.getState() == ChatRoom.State.Terminated;
getContactsForParticipants(); getContactsForParticipants();
} }
@ -408,7 +406,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
} }
} }
if (mIsReadOnly) { if (mChatRoom.isReadOnly()) {
setReadOnly(); setReadOnly();
} }
} }
@ -681,8 +679,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
@Override @Override
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) { public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
mIsReadOnly = mChatRoom.getState() == ChatRoom.State.Terminated; if (mChatRoom.isReadOnly()) {
if (mIsReadOnly) {
setReadOnly(); setReadOnly();
} }
} }

View file

@ -94,7 +94,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
mIsEditionEnabled = getArguments().getBoolean("isEditionEnabled"); mIsEditionEnabled = getArguments().getBoolean("isEditionEnabled");
mSubject = getArguments().getString("subject"); mSubject = getArguments().getString("subject");
if (mChatRoom != null && mChatRoom.getState() == ChatRoom.State.Terminated) { if (mChatRoom != null && mChatRoom.isReadOnly()) {
mIsEditionEnabled = false; mIsEditionEnabled = false;
} }
@ -138,7 +138,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
} }
} }
}); });
mLeaveGroupButton.setVisibility(mIsAlreadyCreatedGroup && mChatRoom.getState() != ChatRoom.State.Terminated ? View.VISIBLE : View.GONE); mLeaveGroupButton.setVisibility(mIsAlreadyCreatedGroup && mChatRoom.isReadOnly() ? View.GONE : View.VISIBLE);
mAddParticipantsButton = view.findViewById(R.id.addParticipants); mAddParticipantsButton = view.findViewById(R.id.addParticipants);
mAddParticipantsButton.setOnClickListener(new View.OnClickListener() { mAddParticipantsButton.setOnClickListener(new View.OnClickListener() {

@ -1 +1 @@
Subproject commit 7e48b9c95649a2baf825106665c8bf7870f72abd Subproject commit 397dbc39fbc3f9ce82070f916e52e7f261c058da