Chat and group chat will use the same layout. For the time being, group chat will be in separated fragment, but once it will be finished, we will merge chat fragment into it
This commit is contained in:
parent
9a703ded12
commit
2077995128
6 changed files with 23 additions and 36 deletions
|
@ -3,6 +3,13 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/event"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/bubble"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
|
@ -699,9 +699,9 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
private void displayChat(String sipUri, String message, String fileUri, String pictureUri, String thumbnailUri, String displayName, Address lAddress) {
|
||||
Bundle extras = new Bundle();
|
||||
extras.putString("SipUri", sipUri);
|
||||
if(message != null)
|
||||
if (message != null)
|
||||
extras.putString("messageDraft", message);
|
||||
if(fileUri != null)
|
||||
if (fileUri != null)
|
||||
extras.putString("fileSharedUri", fileUri);
|
||||
if (sipUri != null && lAddress.getDisplayName() != null) {
|
||||
extras.putString("DisplayName", displayName);
|
||||
|
@ -711,7 +711,12 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
if(sipUri == null && message == null && fileUri == null) {
|
||||
changeCurrentFragment(FragmentsAvailable.CREATE_CHAT, extras);
|
||||
} else {
|
||||
changeCurrentFragment(FragmentsAvailable.CHAT, extras);
|
||||
ChatRoom room = LinphoneManager.getLc().getChatRoom(lAddress);
|
||||
if (room.canHandleParticipants()) {
|
||||
changeCurrentFragment(FragmentsAvailable.GROUP_CHAT, extras);
|
||||
} else {
|
||||
changeCurrentFragment(FragmentsAvailable.CHAT, extras);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -725,7 +730,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
|
|||
String displayName = null;
|
||||
|
||||
Address lAddress = null;
|
||||
if(sipUri != null) {
|
||||
if (sipUri != null) {
|
||||
lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
|
||||
if (lAddress == null) return;
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
|
|
|
@ -310,7 +310,8 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
displayChatGroupCreation();
|
||||
}
|
||||
} else if (id == R.id.confirm) {
|
||||
//TODO
|
||||
//TODO get chatRoom URI
|
||||
//LinphoneActivity.instance().displayChat(contactsSelected.get(0).getAddress(), "", "");
|
||||
} else if (id == R.id.clearSearchField) {
|
||||
searchField.setText("");
|
||||
searchAdapter.searchContacts("", contactsList);
|
||||
|
|
|
@ -123,15 +123,9 @@ interface ChatUpdatedListener {
|
|||
public class ChatFragment extends Fragment implements OnClickListener, ChatMessageListener, ContactsUpdatedListener {
|
||||
private static final int ADD_PHOTO = 1337;
|
||||
private static final int MENU_DELETE_MESSAGE = 0;
|
||||
private static final int MENU_PICTURE_SMALL = 2;
|
||||
private static final int MENU_PICTURE_MEDIUM = 3;
|
||||
private static final int MENU_PICTURE_LARGE = 4;
|
||||
private static final int MENU_PICTURE_REAL = 5;
|
||||
private static final int MENU_COPY_TEXT = 6;
|
||||
private static final int MENU_RESEND_MESSAGE = 7;
|
||||
private static final int SIZE_SMALL = 500;
|
||||
private static final int SIZE_MEDIUM = 1000;
|
||||
private static final int SIZE_LARGE = 1500;
|
||||
private static final int SIZE_MAX = 2048;
|
||||
|
||||
private ChatRoom chatRoom;
|
||||
|
@ -150,14 +144,13 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
|
|||
private boolean isEditMode = false;
|
||||
private LinphoneContact contact;
|
||||
private Uri imageToUploadUri;
|
||||
private String filePathToUpload;
|
||||
private TextWatcher textWatcher;
|
||||
private ViewTreeObserver.OnGlobalLayoutListener keyboardListener;
|
||||
private ChatMessageAdapter adapter;
|
||||
|
||||
private CoreListenerStub mListener;
|
||||
private boolean newChatConversation = false;
|
||||
private String fileSharedUri, fileAlreadySharedUri;
|
||||
private String fileSharedUri;
|
||||
|
||||
private static ArrayList<ChatUpdatedListener> ChatUpdatedListeners;
|
||||
|
||||
|
@ -473,16 +466,8 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
|
|||
|
||||
@Override
|
||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
|
||||
if (v.getId() == R.id.send_picture) {
|
||||
menu.add(0, MENU_PICTURE_SMALL, 0, getString(R.string.share_picture_size_small));
|
||||
menu.add(0, MENU_PICTURE_MEDIUM, 0, getString(R.string.share_picture_size_medium));
|
||||
menu.add(0, MENU_PICTURE_LARGE, 0, getString(R.string.share_picture_size_large));
|
||||
// Not a good idea, very big pictures cause Out of Memory exceptions, slow display, ...
|
||||
// menu.add(0, MENU_PICTURE_REAL, 0, getString(R.string.share_picture_size_real));
|
||||
} else {
|
||||
menu.add(v.getId(), MENU_DELETE_MESSAGE, 0, getString(R.string.delete));
|
||||
menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text));
|
||||
}
|
||||
menu.add(v.getId(), MENU_DELETE_MESSAGE, 0, getString(R.string.delete));
|
||||
menu.add(v.getId(), MENU_COPY_TEXT, 0, getString(R.string.copy_text));
|
||||
|
||||
/* ChatMessage msg = getMessageForId(v.getId());
|
||||
if (msg != null && msg.getStatus() == ChatMessage.State.NotDelivered) {
|
||||
|
@ -517,18 +502,6 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
|
|||
resendMessage(item.getGroupId());
|
||||
break;
|
||||
*/
|
||||
case MENU_PICTURE_SMALL:
|
||||
sendImageMessage(filePathToUpload, SIZE_SMALL);
|
||||
break;
|
||||
case MENU_PICTURE_MEDIUM:
|
||||
sendImageMessage(filePathToUpload, SIZE_MEDIUM);
|
||||
break;
|
||||
case MENU_PICTURE_LARGE:
|
||||
sendImageMessage(filePathToUpload, SIZE_LARGE);
|
||||
break;
|
||||
case MENU_PICTURE_REAL:
|
||||
sendImageMessage(filePathToUpload, SIZE_MAX);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -437,6 +437,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
}
|
||||
|
||||
holder.displayName.setSelected(true); // For animation
|
||||
|
||||
if (chatRoom.canHandleParticipants()) {
|
||||
holder.displayName.setText(chatRoom.getSubject());
|
||||
holder.contactPicture.setImageResource(R.drawable.chat_group_avatar);
|
||||
|
|
|
@ -33,7 +33,7 @@ public class GroupChatFragment extends Fragment implements View.OnClickListener
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
mInflater = inflater;
|
||||
View view = inflater.inflate(R.layout.create_chat, container, false);
|
||||
View view = inflater.inflate(R.layout.chat, container, false);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue