diff --git a/res/layout/chat.xml b/res/layout/chat.xml
index ca1ca3f00..8faaa538a 100644
--- a/res/layout/chat.xml
+++ b/res/layout/chat.xml
@@ -4,92 +4,99 @@
android:layout_height="match_parent"
android:background="@color/colorH" >
-
-
-
+
+ android:id="@+id/top_bar"
+ android:orientation="horizontal"
+ android:background="@color/colorF"
+ android:layout_width="match_parent"
+ android:layout_height="60dp">
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
-
-
-
-
-
+
-
-
-
-
-
+ android:layout_below="@+id/top"/>
\ No newline at end of file
diff --git a/res/layout/chat_bubble.xml b/res/layout/chat_bubble.xml
index aaf6d6d98..350f35c15 100644
--- a/res/layout/chat_bubble.xml
+++ b/res/layout/chat_bubble.xml
@@ -3,11 +3,22 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
+
+
-
-
-
+ android:layout_height="wrap_content"
+ android:layout_toLeftOf="@id/delete_message">
mParticipants;
private LayoutInflater mLayoutInflater;
private Bitmap mDefaultBitmap;
+ private boolean mIsEditionEnabled;
public ChatEventsAdapter(Context context, GroupChatFragment fragment, LayoutInflater inflater, EventLog[] history, ArrayList participants) {
mContext = context;
@@ -86,6 +87,7 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
mLayoutInflater = inflater;
mHistory = new ArrayList<>(Arrays.asList(history));
mParticipants = participants;
+ mIsEditionEnabled = false;
}
public void updateHistory(EventLog[] history) {
@@ -102,6 +104,11 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
mParticipants = participants;
}
+ public void enableEdition(boolean enable) {
+ mIsEditionEnabled = enable;
+ notifyDataSetInvalidated();
+ }
+
@Override
public int getCount() {
return mHistory.size();
@@ -130,7 +137,7 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
holder.eventLayout.setVisibility(View.GONE);
holder.bubbleLayout.setVisibility(View.GONE);
- holder.delete.setVisibility(View.GONE);
+ holder.delete.setVisibility(mIsEditionEnabled ? View.VISIBLE : View.GONE);
holder.messageText.setVisibility(View.GONE);
holder.messageImage.setVisibility(View.GONE);
holder.fileTransferLayout.setVisibility(View.GONE);
@@ -185,8 +192,14 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
holder.imdmLabel.setTextColor(mContext.getResources().getColor(R.color.colorI));
}
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
- layoutParams.setMargins(100, 10, 10, 10);
+ if (mIsEditionEnabled) {
+ layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
+ layoutParams.setMargins(100, 10, 10, 10);
+ } else {
+ layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ layoutParams.setMargins(100, 10, 10, 10);
+ }
+
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_outgoing);
Compatibility.setTextAppearance(holder.contactName, mContext, R.style.font3);
Compatibility.setTextAppearance(holder.fileTransferAction, mContext, R.style.font15);
@@ -216,12 +229,13 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
}
- /*if (isEditMode) {
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ if (mIsEditionEnabled) {
+ layoutParams.addRule(RelativeLayout.LEFT_OF, holder.delete.getId());
layoutParams.setMargins(100, 10, 10, 10);
- }*/
- layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
- layoutParams.setMargins(10, 10, 100, 10);
+ } else {
+ layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
+ layoutParams.setMargins(10, 10, 100, 10);
+ }
holder.background.setBackgroundResource(R.drawable.resizable_chat_bubble_incoming);
Compatibility.setTextAppearance(holder.contactName, mContext, R.style.font9);
diff --git a/src/android/org/linphone/chat/ChatFragment.java b/src/android/org/linphone/chat/ChatFragment.java
index 15e31bd70..4a97ae299 100644
--- a/src/android/org/linphone/chat/ChatFragment.java
+++ b/src/android/org/linphone/chat/ChatFragment.java
@@ -185,8 +185,8 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
contactName = (TextView) view.findViewById(R.id.contact_name);
messagesList = (ListView) view.findViewById(R.id.chat_message_list);
- searchContactField = (EditText) view.findViewById(R.id.search_contact_field);
- resultContactsSearch = (ListView) view.findViewById(R.id.result_contacts);
+ searchContactField = null;// (EditText) view.findViewById(R.id.search_contact_field);
+ resultContactsSearch = null;//(ListView) view.findViewById(R.id.result_contacts);
editList = (LinearLayout) view.findViewById(R.id.edit_list);
topBar = (LinearLayout) view.findViewById(R.id.top_bar);
diff --git a/src/android/org/linphone/chat/GroupChatFragment.java b/src/android/org/linphone/chat/GroupChatFragment.java
index c2494e492..30617ea8a 100644
--- a/src/android/org/linphone/chat/GroupChatFragment.java
+++ b/src/android/org/linphone/chat/GroupChatFragment.java
@@ -45,6 +45,7 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
+import android.widget.RelativeLayout;
import android.widget.TextView;
import org.linphone.LinphoneManager;
@@ -87,6 +88,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
private LayoutInflater mInflater;
private ListView mChatEventsList;
private LinearLayout mFilesUploadLayout;
+ private LinearLayout mTopBar, mEditTopBar;
private ViewTreeObserver.OnGlobalLayoutListener mKeyboardListener;
private Uri mImageToUploadUri;
@@ -110,6 +112,9 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mInflater = inflater;
View view = inflater.inflate(R.layout.chat, container, false);
+ mTopBar = view.findViewById(R.id.top_bar);
+ mEditTopBar = view.findViewById(R.id.edit_list);
+
mBackButton = view.findViewById(R.id.back);
mBackButton.setOnClickListener(new View.OnClickListener() {
@Override
@@ -159,7 +164,9 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mEditButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- //TODO
+ mEventsAdapter.enableEdition(true);
+ mTopBar.setVisibility(View.GONE);
+ mEditTopBar.setVisibility(View.VISIBLE);
}
});
@@ -167,7 +174,9 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mCancelEditButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- //TODO
+ mEventsAdapter.enableEdition(false);
+ mTopBar.setVisibility(View.VISIBLE);
+ mEditTopBar.setVisibility(View.GONE);
}
});