Added event layout to chat bubble

This commit is contained in:
Sylvain Berfini 2017-10-23 12:05:34 +02:00
parent 2077995128
commit 566effbc50
7 changed files with 77 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true"
android:drawable="@drawable/chat_group_informations" />
<item android:state_enabled="false"
android:drawable="@drawable/chat_group_informations_disabled" />
</selector>

View file

@ -42,6 +42,16 @@
android:layout_weight="0.2" android:layout_weight="0.2"
android:padding="15dp"/> 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 <ImageView
android:id="@+id/back_to_call" android:id="@+id/back_to_call"
android:src="@drawable/call_back" android:src="@drawable/call_back"

View file

@ -3,12 +3,48 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<RelativeLayout <LinearLayout
android:id="@+id/event" android:id="@+id/event"
android:layout_width="wrap_content" android:orientation="horizontal"
android:layout_height="wrap_content"> android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical">
</RelativeLayout> <ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginRight="10dp"
android:src="@drawable/event_gray"
android:scaleType="fitXY"/>
<TextView
android:id="@+id/event_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="italic"
android:text="Aujourd'hui"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" - "/>
<TextView
android:id="@+id/event_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Machin à ajouté Machine"/>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="10dp"
android:src="@drawable/event_gray"
android:scaleType="fitXY"/>
</LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/bubble" android:id="@+id/bubble"

View file

@ -491,4 +491,5 @@
<string name="content_title_notification_service">Linphone Service</string> <string name="content_title_notification_service">Linphone Service</string>
<string name="content_title_notification">Linphone Notification</string> <string name="content_title_notification">Linphone Notification</string>
<string name="content_description_conversation_subject">Group chat room subject</string> <string name="content_description_conversation_subject">Group chat room subject</string>
<string name="content_description_conversation_infos">Group chat room infos</string>
</resources> </resources>

View file

@ -133,9 +133,9 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
private EditText message; private EditText message;
private ImageView edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage, cancel; private ImageView edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage, cancel;
private TextView contactName, remoteComposing; private TextView contactName, remoteComposing;
private ImageView back, backToCall; private ImageView back, backToCall, infos;
private EditText searchContactField; private EditText searchContactField;
private LinearLayout topBar, editList; private LinearLayout topBar, editList, event;
private SearchContactsListAdapter searchAdapter; private SearchContactsListAdapter searchAdapter;
private ListView messagesList, resultContactsSearch; private ListView messagesList, resultContactsSearch;
private LayoutInflater inflater; private LayoutInflater inflater;
@ -211,6 +211,9 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
startCall = (ImageView) view.findViewById(R.id.start_call); startCall = (ImageView) view.findViewById(R.id.start_call);
startCall.setOnClickListener(this); startCall.setOnClickListener(this);
infos = view.findViewById(R.id.group_infos);
infos.setVisibility(View.GONE);
backToCall = (ImageView) view.findViewById(R.id.back_to_call); backToCall = (ImageView) view.findViewById(R.id.back_to_call);
backToCall.setOnClickListener(this); backToCall.setOnClickListener(this);
@ -1262,6 +1265,7 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
class ChatMessageAdapter extends BaseAdapter { class ChatMessageAdapter extends BaseAdapter {
private class ViewHolder implements ChatMessageListener { private class ViewHolder implements ChatMessageListener {
public int id; public int id;
public LinearLayout eventLayout;
public RelativeLayout bubbleLayout; public RelativeLayout bubbleLayout;
public CheckBox delete; public CheckBox delete;
public LinearLayout background; public LinearLayout background;
@ -1283,6 +1287,8 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
public ViewHolder(View view) { public ViewHolder(View view) {
id = view.getId(); id = view.getId();
eventLayout = (LinearLayout) view.findViewById(R.id.event);
bubbleLayout = (RelativeLayout) view.findViewById(R.id.bubble); bubbleLayout = (RelativeLayout) view.findViewById(R.id.bubble);
delete = (CheckBox) view.findViewById(R.id.delete_message); delete = (CheckBox) view.findViewById(R.id.delete_message);
background = (LinearLayout) view.findViewById(R.id.background); background = (LinearLayout) view.findViewById(R.id.background);
@ -1421,6 +1427,7 @@ public class ChatFragment extends Fragment implements OnClickListener, ChatMessa
String externalBodyUrl = message.getExternalBodyUrl(); String externalBodyUrl = message.getExternalBodyUrl();
Content fileTransferContent = message.getFileTransferInformation(); Content fileTransferContent = message.getFileTransferInformation();
holder.eventLayout.setVisibility(View.GONE);
holder.delete.setVisibility(View.GONE); holder.delete.setVisibility(View.GONE);
holder.messageText.setVisibility(View.GONE); holder.messageText.setVisibility(View.GONE);
holder.messageImage.setVisibility(View.GONE); holder.messageImage.setVisibility(View.GONE);

View file

@ -5,6 +5,7 @@ import android.os.Bundle;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import org.linphone.R; import org.linphone.R;
@ -28,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
public class GroupChatFragment extends Fragment implements View.OnClickListener { public class GroupChatFragment extends Fragment implements View.OnClickListener {
private ImageView call, infos;
private LayoutInflater mInflater; private LayoutInflater mInflater;
@Override @Override
@ -35,6 +38,12 @@ public class GroupChatFragment extends Fragment implements View.OnClickListener
mInflater = inflater; mInflater = inflater;
View view = inflater.inflate(R.layout.chat, container, false); View view = inflater.inflate(R.layout.chat, container, false);
call = view.findViewById(R.id.start_call);
call.setVisibility(View.GONE);
infos = view.findViewById(R.id.group_infos);
infos.setVisibility(View.VISIBLE);
return view; return view;
} }