Reworked chat view, way easier to maintain now

Conflicts:
	res/layout-FR/chat.xml
	res/layout-RU/chat.xml
	res/layout-small/chat.xml
	res/layout/chat.xml
This commit is contained in:
Sylvain Berfini 2014-09-15 15:42:21 +02:00
parent f194b27491
commit 053b54e710
8 changed files with 123 additions and 544 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3 KiB

View file

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:linphone="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:orientation="horizontal">
<org.linphone.ui.AvatarWithShadow
android:id="@+id/contactPicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
linphone:picture="@drawable/unknown_small" />
<TextView
android:id="@+id/contactName"
android:paddingLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_contrast" />
</LinearLayout>
<ListView
android:id="@+id/chatMessageList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@android:color/transparent"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
<TextView
android:id="@+id/remoteComposing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_contrast"
android:text="@string/remote_composing" />
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_field_background">
<TextView
android:id="@+id/sendPicture"
android:text="@string/button_send_picture"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@drawable/chat_send_picture"
android:paddingLeft="5dp" />
<TextView
android:id="@+id/sendMessage"
android:text="@string/button_send_message"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:drawableTop="@drawable/chat_send_message"
android:paddingRight="5dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sendPicture"
android:layout_toLeftOf="@id/sendMessage"
android:background="@android:color/transparent"
android:padding="20dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/uploadLayout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_progressbar_background">
<ImageView
android:contentDescription="@string/content_description_cancel"
android:id="@+id/cancelUpload"
android:src="@drawable/chat_stop_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_alignParentRight="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/cancelUpload"
android:layout_toLeftOf="@id/cancelUpload"
android:paddingBottom="20dp"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/uploading_image"
android:textColor="@android:color/black"/>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="15dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:paddingTop="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View file

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:linphone="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:orientation="horizontal">
<org.linphone.ui.AvatarWithShadow
android:id="@+id/contactPicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
linphone:picture="@drawable/unknown_small" />
<TextView
android:id="@+id/contactName"
android:paddingLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_contrast" />
</LinearLayout>
<ListView
android:id="@+id/chatMessageList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@android:color/transparent"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
<TextView
android:id="@+id/remoteComposing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_contrast"
android:text="@string/remote_composing" />
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_field_background">
<TextView
android:id="@+id/sendPicture"
android:text="@string/button_send_picture"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@drawable/chat_send_picture"
android:paddingLeft="3dp" />
<TextView
android:id="@+id/sendMessage"
android:text="@string/button_send_message"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:drawableTop="@drawable/chat_send_message"
android:paddingRight="1dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sendPicture"
android:layout_toLeftOf="@id/sendMessage"
android:background="@android:color/transparent"
android:padding="20dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/uploadLayout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_progressbar_background">
<ImageView
android:contentDescription="@string/content_description_cancel"
android:id="@+id/cancelUpload"
android:src="@drawable/chat_stop_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_alignParentRight="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/cancelUpload"
android:layout_toLeftOf="@id/cancelUpload"
android:paddingBottom="20dp"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/uploading_image"
android:textColor="@android:color/black"/>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="15dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:paddingTop="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View file

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:linphone="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:orientation="horizontal">
<org.linphone.ui.AvatarWithShadow
android:id="@+id/contactPicture"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
linphone:picture="@drawable/unknown_small" />
<TextView
android:id="@+id/contactName"
android:paddingLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/text_contrast" />
</LinearLayout>
<ListView
android:id="@+id/chatMessageList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@android:color/transparent"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
<TextView
android:id="@+id/remoteComposing"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_contrast"
android:text="@string/remote_composing" />
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_field_background">
<TextView
android:id="@+id/sendPicture"
android:text="@string/button_send_picture"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@drawable/chat_send_picture"
android:paddingLeft="5dp" />
<TextView
android:id="@+id/sendMessage"
android:text="@string/button_send_message"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:drawableTop="@drawable/chat_send_message"
android:paddingRight="7dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sendPicture"
android:layout_toLeftOf="@id/sendMessage"
android:background="@android:color/transparent"
android:padding="20dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/uploadLayout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_progressbar_background">
<ImageView
android:contentDescription="@string/content_description_cancel"
android:id="@+id/cancelUpload"
android:src="@drawable/chat_stop_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_alignParentRight="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/cancelUpload"
android:layout_toLeftOf="@id/cancelUpload"
android:paddingBottom="20dp"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/uploading_image"
android:textColor="@android:color/black"/>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="15dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:paddingTop="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>

View file

@ -1,19 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:linphone="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background"
android:orientation="vertical" >
android:background="@drawable/background" >
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center"
android:orientation="horizontal">
android:orientation="horizontal"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true">
<org.linphone.ui.AvatarWithShadow
android:id="@+id/contactPicture"
@ -30,17 +32,108 @@
android:textColor="@color/text_contrast" />
</LinearLayout>
<ListView
android:id="@+id/chatMessageList"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:divider="@android:color/transparent"
android:stackFromBottom="true"
android:transcriptMode="alwaysScroll"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp" />
<LinearLayout
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/chat_background">
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/sendPicture"
android:text="@string/button_send_picture"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@drawable/chat_send_picture"
android:paddingLeft="10dp"
android:paddingRight="10dp" />
<TextView
android:id="@+id/sendMessage"
android:text="@string/button_send_message"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:drawableTop="@drawable/chat_send_message"
android:paddingRight="10dp"
android:paddingLeft="10dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sendPicture"
android:layout_toLeftOf="@id/sendMessage"
android:background="@drawable/chat_field_background"
android:layout_centerVertical="true"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/uploadLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:contentDescription="@string/content_description_cancel"
android:id="@+id/cancelUpload"
android:src="@drawable/list_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_alignParentRight="true"
android:padding="20dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/cancelUpload"
android:layout_toLeftOf="@id/cancelUpload"
android:paddingBottom="20dp"
android:orientation="vertical"
android:gravity="center">
<TextView
android:id="@+id/progressBarText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/uploading_image"
android:textColor="@android:color/black"/>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="15dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:paddingTop="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<TextView
android:id="@+id/remoteComposing"
@ -48,98 +141,18 @@
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/text_contrast"
android:text="@string/remote_composing" />
android:text="@string/remote_composing"
android:layout_above="@id/footer"/>
<ListView
android:id="@+id/chatMessageList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@android:color/transparent"
android:stackFromBottom="true"
android:cacheColorHint="@color/transparent"
android:dividerHeight="1dp"
android:layout_above="@id/remoteComposing"
android:layout_below="@id/header"/>
<RelativeLayout
android:id="@+id/messageLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_field_background">
<TextView
android:id="@+id/sendPicture"
android:text="@string/button_send_picture"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:drawableTop="@drawable/chat_send_picture"
android:paddingLeft="5dp" />
<TextView
android:id="@+id/sendMessage"
android:text="@string/button_send_message"
android:gravity="center"
android:textColor="@drawable/text_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_alignParentRight="true"
android:drawableTop="@drawable/chat_send_message"
android:paddingRight="10dp" />
<EditText
android:textCursorDrawable="@null"
android:id="@+id/message"
android:inputType="textMultiLine"
android:maxLines="3"
android:textColor="@android:color/black"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/sendPicture"
android:layout_toLeftOf="@id/sendMessage"
android:background="@android:color/transparent"
android:padding="20dp"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/uploadLayout"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/chat_progressbar_background">
<ImageView
android:contentDescription="@string/content_description_cancel"
android:id="@+id/cancelUpload"
android:src="@drawable/chat_stop_upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_alignParentRight="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/cancelUpload"
android:layout_toLeftOf="@id/cancelUpload"
android:paddingBottom="20dp"
android:orientation="vertical"
android:gravity="center">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/uploading_image"
android:textColor="@android:color/black"/>
<ProgressBar
android:id="@+id/progressbar"
android:layout_width="match_parent"
android:layout_height="15dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:paddingTop="2dp"
android:paddingLeft="2dp"
android:paddingRight="2dp" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>

View file

@ -155,6 +155,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout);
uploadLayout.setVisibility(View.GONE);
textLayout = (RelativeLayout) view.findViewById(R.id.messageLayout);
progressBar = (ProgressBar) view.findViewById(R.id.progressbar);