Started edition of messages/events in chat room view
This commit is contained in:
parent
1661d689aa
commit
975717df05
6 changed files with 135 additions and 133 deletions
|
@ -4,92 +4,99 @@
|
|||
android:layout_height="match_parent"
|
||||
android:background="@color/colorH" >
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_bar"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/colorF"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:src="@drawable/back"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_back"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="18dp"/>
|
||||
<RelativeLayout
|
||||
android:id="@+id/top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.4"
|
||||
android:layout_gravity="center_vertical|left"
|
||||
android:gravity="center_vertical|left">
|
||||
android:id="@+id/top_bar"
|
||||
android:orientation="horizontal"
|
||||
android:background="@color/colorF"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
style="@style/font6"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:src="@drawable/back"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_back"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="18dp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/participants"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/colorC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.4"
|
||||
android:layout_gravity="center_vertical|left"
|
||||
android:gravity="center_vertical|left">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subject"
|
||||
style="@style/font6"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/participants"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/colorC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start_call"
|
||||
android:src="@drawable/call_alt_start"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_call"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_infos"
|
||||
android:src="@drawable/chat_room_group_infos"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_conversation_infos"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_to_call"
|
||||
android:src="@drawable/call_back"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_back_call"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:visibility="gone"
|
||||
android:padding="15dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit"
|
||||
android:src="@drawable/edit_list_button"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_edit_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/start_call"
|
||||
android:src="@drawable/call_alt_start"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_call"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
<include layout="@layout/edit_list"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/group_infos"
|
||||
android:src="@drawable/chat_room_group_infos"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_conversation_infos"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back_to_call"
|
||||
android:src="@drawable/call_back"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_back_call"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:visibility="gone"
|
||||
android:padding="15dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/edit"
|
||||
android:src="@drawable/edit_list_button"
|
||||
android:background="@drawable/toolbar_button"
|
||||
android:contentDescription="@string/content_description_edit_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="0.2"
|
||||
android:padding="15dp"/>
|
||||
</LinearLayout>
|
||||
|
||||
<include layout="@layout/edit_list"/>
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/footer"
|
||||
|
@ -177,32 +184,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_below="@+id/top_bar"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/search_contact_field"
|
||||
android:contentDescription="@string/content_description_search"
|
||||
android:textCursorDrawable="@null"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:visibility="gone"
|
||||
android:textColor="@android:color/black"
|
||||
android:background="@drawable/resizable_textfield"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_below="@id/top_bar"
|
||||
android:inputType="textPersonName"/>
|
||||
|
||||
<ListView
|
||||
android:id="@+id/result_contacts"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@color/colorE"
|
||||
android:visibility="gone"
|
||||
android:layout_below="@id/search_contact_field"
|
||||
android:fastScrollAlwaysVisible="true"
|
||||
android:fastScrollEnabled="true"
|
||||
android:dividerHeight="1dp"
|
||||
android:layout_above="@+id/footer"/>
|
||||
|
||||
android:layout_below="@+id/top"/>
|
||||
|
||||
</RelativeLayout>
|
|
@ -3,11 +3,22 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/delete_message"
|
||||
android:button="@drawable/checkbox"
|
||||
android:contentDescription="@string/content_description_delete"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentRight="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/event"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/delete_message"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
|
@ -47,26 +58,13 @@
|
|||
<RelativeLayout
|
||||
android:id="@+id/bubble"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/delete_message"
|
||||
android:button="@drawable/checkbox"
|
||||
android:contentDescription="@string/content_description_delete"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:visibility="gone"/>
|
||||
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/delete_message">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/delete_message"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RelativeLayout
|
||||
|
|
|
@ -285,7 +285,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
//LinphoneActivity.instance().displayChat(contactsSelected.get(0).getAddress(), "", "");
|
||||
//TODO create group chat room with only two participants ?
|
||||
//TODO what subject to set ?
|
||||
ChatRoom chatRoom = LinphoneManager.getLc().createClientGroupChatRoom("Tata");
|
||||
ChatRoom chatRoom = LinphoneManager.getLc().createClientGroupChatRoom("dummy subject");
|
||||
chatRoom.setListener(new ChatRoomListenerStub() {
|
||||
@Override
|
||||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||
|
|
|
@ -79,6 +79,7 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
|||
private List<LinphoneContact> mParticipants;
|
||||
private LayoutInflater mLayoutInflater;
|
||||
private Bitmap mDefaultBitmap;
|
||||
private boolean mIsEditionEnabled;
|
||||
|
||||
public ChatEventsAdapter(Context context, GroupChatFragment fragment, LayoutInflater inflater, EventLog[] history, ArrayList<LinphoneContact> 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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue