Add chat view and otger stuff
This commit is contained in:
parent
7388723f40
commit
c6035e841f
9 changed files with 346 additions and 268 deletions
|
@ -13,61 +13,23 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/back"
|
android:id="@+id/back"
|
||||||
android:contentDescription="@string/content_description_back"
|
|
||||||
android:src="@drawable/back"
|
android:src="@drawable/back"
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:layout_width="wrap_content"
|
android:contentDescription="@string/content_description_back"
|
||||||
|
android:layout_width="70dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:padding="10dp"
|
android:padding="20dp"/>
|
||||||
android:adjustViewBounds="true"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/delete"
|
|
||||||
android:src="@drawable/delete"
|
|
||||||
android:background="@drawable/toolbar_button"
|
|
||||||
android:contentDescription="@string/content_description_valid"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/select_all"
|
|
||||||
android:src="@drawable/select_all"
|
|
||||||
android:background="@drawable/toolbar_button"
|
|
||||||
android:contentDescription="@string/content_description_valid"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_toLeftOf="@id/delete"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/deselect_all"
|
|
||||||
android:src="@drawable/deselect_all"
|
|
||||||
android:background="@drawable/toolbar_button"
|
|
||||||
android:contentDescription="@string/content_description_valid"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_toLeftOf="@id/delete"
|
|
||||||
android:padding="10dp"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/edit"
|
android:id="@+id/edit"
|
||||||
android:src="@drawable/edit_list_button"
|
android:src="@drawable/edit_list_button"
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_edit"
|
android:contentDescription="@string/content_description_edit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="70dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:padding="10dp"
|
android:padding="15dp"/>
|
||||||
android:adjustViewBounds="true"/>
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/start_call"
|
android:id="@+id/start_call"
|
||||||
|
@ -75,10 +37,9 @@
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_call"
|
android:contentDescription="@string/content_description_call"
|
||||||
android:layout_toLeftOf="@id/edit"
|
android:layout_toLeftOf="@id/edit"
|
||||||
android:padding="10dp"
|
android:layout_width="70dp"
|
||||||
android:gravity="center"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="wrap_content"
|
android:padding="15dp"/>
|
||||||
android:layout_height="match_parent"/>
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/contact_name"
|
android:id="@+id/contact_name"
|
||||||
|
@ -91,9 +52,10 @@
|
||||||
android:layout_toLeftOf="@id/start_call"
|
android:layout_toLeftOf="@id/start_call"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:gravity="center"/>
|
android:gravity="center"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/edit_list"/>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/footer"
|
android:id="@+id/footer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -161,33 +123,6 @@
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:padding="20dp" />
|
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>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,34 @@
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:orientation="horizontal" >
|
android:orientation="horizontal" >
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/avatar_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="10dp">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/contact_picture"
|
android:id="@+id/contact_picture"
|
||||||
android:src="@drawable/avatar"
|
android:src="@drawable/avatar"
|
||||||
android:layout_width="50dp"
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
android:layout_height="50dp"
|
android:layout_width="40dp"
|
||||||
android:paddingTop="10dp"
|
android:layout_height="40dp"
|
||||||
android:paddingLeft="10dp"/>
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/mask"
|
||||||
|
android:src="@drawable/avatar_mask"
|
||||||
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:adjustViewBounds="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_marginLeft="5dp"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -41,9 +62,9 @@
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image"
|
android:id="@+id/image"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:adjustViewBounds="true"
|
android:layout_width="150dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:scaleType="center"
|
||||||
android:maxWidth="250dp"
|
android:maxWidth="250dp"
|
||||||
android:maxHeight="250dp" />
|
android:maxHeight="250dp" />
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,21 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/image"
|
android:id="@+id/image"
|
||||||
android:adjustViewBounds="true"
|
android:visibility="gone"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="150dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="150dp"
|
||||||
|
android:scaleType="center"
|
||||||
android:maxWidth="250dp"
|
android:maxWidth="250dp"
|
||||||
android:maxHeight="250dp" />
|
android:maxHeight="250dp" />
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/spinner"
|
||||||
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_marginTop="20dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="5dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|
|
@ -43,18 +43,35 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/avatar_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_centerHorizontal="true">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/contact_picture"
|
android:id="@+id/contact_picture"
|
||||||
android:layout_width="40dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:src="@drawable/avatar"
|
android:src="@drawable/avatar"
|
||||||
android:layout_centerHorizontal="true"/>
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:adjustViewBounds="true"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/mask"
|
||||||
|
android:src="@drawable/avatar_mask"
|
||||||
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
|
android:layout_width="35dp"
|
||||||
|
android:layout_height="35dp"
|
||||||
|
android:adjustViewBounds="true"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/date"
|
android:id="@+id/date"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/contact_picture"
|
android:layout_below="@id/avatar_layout"
|
||||||
style="@style/font2"/>
|
style="@style/font2"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
@ -83,7 +100,7 @@
|
||||||
android:layout_width="25dp"
|
android:layout_width="25dp"
|
||||||
android:layout_height="25dp"
|
android:layout_height="25dp"
|
||||||
android:background="@drawable/chat_list_indicator"
|
android:background="@drawable/chat_list_indicator"
|
||||||
style="@style/font17"
|
style="@style/font18"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:layout_above="@+id/lastMessage"
|
android:layout_above="@+id/lastMessage"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
|
|
@ -1,41 +1,48 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<TableRow 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_width="match_parent"
|
||||||
android:layout_height="75dp"
|
android:layout_height="75dp"
|
||||||
android:orientation="horizontal"
|
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="@color/colorF">
|
android:background="@color/colorH">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="10dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:gravity="center_vertical|left"
|
|
||||||
android:paddingLeft="20dp"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textColor="@color/text_header"
|
|
||||||
android:text="@string/conference"
|
android:text="@string/conference"
|
||||||
android:textSize="26dp" />
|
style="@style/font5"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<Chronometer
|
||||||
|
android:id="@+id/callTimer"
|
||||||
|
style="@style/font2"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:contentDescription="@string/content_description_pause"
|
android:contentDescription="@string/content_description_pause"
|
||||||
android:id="@+id/conferenceStatus"
|
android:id="@+id/conferenceStatus"
|
||||||
android:layout_width="30dp"
|
|
||||||
android:layout_height="30dp"
|
|
||||||
android:scaleType="fitCenter"
|
|
||||||
android:adjustViewBounds="true"
|
|
||||||
android:src="@drawable/pause" />
|
|
||||||
|
|
||||||
<Chronometer
|
|
||||||
android:visibility="invisible"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingLeft="10dp"
|
android:layout_alignParentRight="true"
|
||||||
android:paddingRight="20dp"
|
android:scaleType="fitCenter"
|
||||||
android:gravity="center_vertical|right"
|
android:adjustViewBounds="true"
|
||||||
android:textColor="@android:color/white"
|
android:layout_centerInParent="true"
|
||||||
android:textSize="22dp" />
|
android:padding="10dp"
|
||||||
|
android:src="@drawable/pause_big_default"/>
|
||||||
|
|
||||||
</TableRow>
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:background="@color/colorE"
|
||||||
|
android:layout_alignParentBottom="true"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
|
@ -20,7 +20,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:padding="10dp"
|
android:padding="20dp"
|
||||||
android:adjustViewBounds="true"/>
|
android:adjustViewBounds="true"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
android:background="@drawable/toolbar_button"
|
android:background="@drawable/toolbar_button"
|
||||||
android:contentDescription="@string/content_description_add_contact"
|
android:contentDescription="@string/content_description_add_contact"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:padding="10dp"
|
android:padding="15dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:adjustViewBounds="true"/>
|
android:adjustViewBounds="true"/>
|
||||||
|
@ -57,8 +57,8 @@
|
||||||
android:id="@+id/contact_picture"
|
android:id="@+id/contact_picture"
|
||||||
android:src="@drawable/avatar"
|
android:src="@drawable/avatar"
|
||||||
android:contentDescription="@string/content_description_contact_picture"
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
android:layout_width="120dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="120dp"
|
android:layout_height="100dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_marginLeft="5dp"/>
|
android:layout_marginLeft="5dp"/>
|
||||||
|
@ -67,8 +67,8 @@
|
||||||
android:id="@+id/mask"
|
android:id="@+id/mask"
|
||||||
android:src="@drawable/avatar_mask"
|
android:src="@drawable/avatar_mask"
|
||||||
android:contentDescription="@string/content_description_contact_picture"
|
android:contentDescription="@string/content_description_contact_picture"
|
||||||
android:layout_width="120dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="120dp"
|
android:layout_height="100dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_marginLeft="5dp"/>
|
android:layout_marginLeft="5dp"/>
|
||||||
|
@ -78,6 +78,7 @@
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/contact_name"
|
android:id="@+id/contact_name"
|
||||||
style="@style/font5"
|
style="@style/font5"
|
||||||
|
android:singleLine="true"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
@ -96,40 +97,26 @@
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingRight="10dp">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/call"
|
android:id="@+id/call"
|
||||||
android:src="@drawable/call_start_body_default"
|
android:src="@drawable/call_start_body_default"
|
||||||
android:contentDescription="@string/content_description_dial_back"
|
android:contentDescription="@string/content_description_dial_back"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:layout_centerInParent="true"/>
|
android:layout_centerInParent="true"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/chat_row"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingLeft="10dp"
|
|
||||||
android:paddingRight="10dp">
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/chat"
|
android:id="@+id/chat"
|
||||||
android:src="@drawable/chat_start_body_default"
|
android:src="@drawable/chat_start_body_default"
|
||||||
android:contentDescription="@string/content_description_chat"
|
android:contentDescription="@string/content_description_chat"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="60dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="60dp"
|
||||||
|
android:layout_margin="10dp"
|
||||||
android:adjustViewBounds="true"
|
android:adjustViewBounds="true"
|
||||||
android:layout_centerInParent="true" />
|
android:layout_centerInParent="true" />
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.graphics.Matrix;
|
import android.graphics.Matrix;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -78,9 +79,11 @@ import android.view.ViewGroup;
|
||||||
import android.view.ViewTreeObserver;
|
import android.view.ViewTreeObserver;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.AbsListView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.AutoCompleteTextView;
|
import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.BaseAdapter;
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Filter;
|
import android.widget.Filter;
|
||||||
|
@ -115,14 +118,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
private String displayName;
|
private String displayName;
|
||||||
private String pictureUri;
|
private String pictureUri;
|
||||||
private EditText message;
|
private EditText message;
|
||||||
private ImageView cancelUpload, edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage;
|
private ImageView cancelUpload, edit, selectAll, deselectAll, startCall, delete, sendImage, sendMessage, cancel;
|
||||||
private TextView contactName, remoteComposing;
|
private TextView contactName, remoteComposing;
|
||||||
private ImageView back;
|
private ImageView back;
|
||||||
private AutoCompleteTextView searchContactField;
|
private AutoCompleteTextView searchContactField;
|
||||||
private RelativeLayout uploadLayout, textLayout, topBar;
|
private RelativeLayout uploadLayout, textLayout, topBar, editList;
|
||||||
private ListView messagesList;
|
private ListView messagesList;
|
||||||
|
|
||||||
private ProgressBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
private boolean isEditMode = false;
|
||||||
|
private Contact contact;
|
||||||
private Uri imageToUploadUri;
|
private Uri imageToUploadUri;
|
||||||
private String filePathToUpload;
|
private String filePathToUpload;
|
||||||
private TextWatcher textWatcher;
|
private TextWatcher textWatcher;
|
||||||
|
@ -164,7 +169,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
searchContactField = (AutoCompleteTextView) view.findViewById(R.id.searchContactField);
|
searchContactField = (AutoCompleteTextView) view.findViewById(R.id.searchContactField);
|
||||||
|
|
||||||
textLayout = (RelativeLayout) view.findViewById(R.id.messageLayout);
|
textLayout = (RelativeLayout) view.findViewById(R.id.messageLayout);
|
||||||
progressBar = (ProgressBar) view.findViewById(R.id.progressbar);
|
|
||||||
topBar = (RelativeLayout) view.findViewById(R.id.top_bar);
|
topBar = (RelativeLayout) view.findViewById(R.id.top_bar);
|
||||||
|
|
||||||
sendMessage = (ImageView) view.findViewById(R.id.sendMessage);
|
sendMessage = (ImageView) view.findViewById(R.id.sendMessage);
|
||||||
|
@ -176,6 +180,11 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout);
|
uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout);
|
||||||
uploadLayout.setVisibility(View.GONE);
|
uploadLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
editList = (RelativeLayout) view.findViewById(R.id.edit_list);
|
||||||
|
|
||||||
|
cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||||
|
cancel.setOnClickListener(this);
|
||||||
|
|
||||||
edit = (ImageView) view.findViewById(R.id.edit);
|
edit = (ImageView) view.findViewById(R.id.edit);
|
||||||
edit.setOnClickListener(this);
|
edit.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -206,6 +215,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinphoneAddress lAddress;
|
||||||
|
try {
|
||||||
|
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||||
|
contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
||||||
|
} catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//Manage multiline
|
//Manage multiline
|
||||||
message = (EditText) view.findViewById(R.id.message);
|
message = (EditText) view.findViewById(R.id.message);
|
||||||
if (!getResources().getBoolean(R.bool.allow_chat_multiline)) {
|
if (!getResources().getBoolean(R.bool.allow_chat_multiline)) {
|
||||||
|
@ -228,10 +245,10 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
|
|
||||||
back = (ImageView) view.findViewById(R.id.back);
|
back = (ImageView) view.findViewById(R.id.back);
|
||||||
if (back != null) {
|
if (back != null) {
|
||||||
back.setOnClickListener(new View.OnClickListener() {
|
back.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
getActivity().finish();
|
getFragmentManager().popBackStackImmediate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -371,7 +388,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
public View getView(int position, View convertView, ViewGroup parent) {
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
LinphoneChatMessage message = history[position];
|
LinphoneChatMessage message = history[position];
|
||||||
|
|
||||||
BubbleChat bubble = new BubbleChat(context, message);
|
BubbleChat bubble = new BubbleChat(context, message, contact);
|
||||||
View v = bubble.getView();
|
View v = bubble.getView();
|
||||||
|
|
||||||
registerForContextMenu(v);
|
registerForContextMenu(v);
|
||||||
|
@ -400,28 +417,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayChatHeader(String displayName, String pictureUri) {
|
private void displayChatHeader(String displayName, String pictureUri) {
|
||||||
LinphoneAddress lAddress;
|
if(contact != null) {
|
||||||
try {
|
contactName.setText(contact.getName());
|
||||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
} else if (displayName == null && getResources().getBoolean(R.bool.only_display_username_if_unknown) && LinphoneUtils.isSipAddress(sipUri)) {
|
||||||
Contact contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
|
||||||
if (contact != null) {
|
|
||||||
//LinphoneUtils.setImagePictureFromUri(getActivity(), contactPicture.getView(), contact.getPhotoUri(), contact.getThumbnailUri(), R.drawable.unknown_small);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//contactPicture.setImageResource(R.drawable.unknown_small);
|
|
||||||
}
|
|
||||||
} catch (LinphoneCoreException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (displayName == null && getResources().getBoolean(R.bool.only_display_username_if_unknown) && LinphoneUtils.isSipAddress(sipUri)) {
|
|
||||||
contactName.setText(LinphoneUtils.getUsernameFromAddress(sipUri));
|
contactName.setText(LinphoneUtils.getUsernameFromAddress(sipUri));
|
||||||
} else if (displayName == null) {
|
} else if (displayName == null) {
|
||||||
contactName.setText(sipUri);
|
contactName.setText(sipUri);
|
||||||
} else {
|
} else {
|
||||||
contactName.setText(displayName);
|
contactName.setText(displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeDisplayedChat(String newSipUri, String displayName, String pictureUri) {
|
public void changeDisplayedChat(String newSipUri, String displayName, String pictureUri) {
|
||||||
|
@ -447,6 +451,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
message.setText(draft);
|
message.setText(draft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinphoneAddress lAddress;
|
||||||
|
try {
|
||||||
|
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||||
|
contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
||||||
|
} catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
chatRoom = lc.getOrCreateChatRoom(sipUri);
|
chatRoom = lc.getOrCreateChatRoom(sipUri);
|
||||||
|
@ -532,9 +544,9 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
|
|
||||||
onSaveInstanceState(getArguments());
|
onSaveInstanceState(getArguments());
|
||||||
|
|
||||||
uploadLayout.setVisibility(View.GONE);
|
// uploadLayout.setVisibility(View.GONE);
|
||||||
textLayout.setVisibility(View.VISIBLE);
|
// textLayout.setVisibility(View.VISIBLE);
|
||||||
progressBar.setProgress(0);
|
//progressBar.setProgress(0);
|
||||||
|
|
||||||
//Hide keybord
|
//Hide keybord
|
||||||
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
InputMethodManager imm = (InputMethodManager)getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||||
|
@ -560,17 +572,25 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
LinphoneActivity.instance().updateChatFragment(this);
|
LinphoneActivity.instance().updateChatFragment(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LinphoneAddress lAddress;
|
||||||
|
try {
|
||||||
|
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||||
|
contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
||||||
|
} catch (Exception e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
LinphoneManager.addListener(this);
|
LinphoneManager.addListener(this);
|
||||||
|
|
||||||
final LinphoneChatMessage msg = LinphoneManager.getInstance().getMessageUploadPending();
|
final LinphoneChatMessage msg = LinphoneManager.getInstance().getMessageUploadPending();
|
||||||
if(msg != null && msg.getTo().asString().equals(sipUri)){
|
if(msg != null && msg.getTo().asString().equals(sipUri)){
|
||||||
uploadLayout.setVisibility(View.VISIBLE);
|
//uploadLayout.setVisibility(View.VISIBLE);
|
||||||
textLayout.setVisibility(View.GONE);
|
// textLayout.setVisibility(View.GONE);
|
||||||
if(msg.getFileTransferInformation() != null){
|
// if(msg.getFileTransferInformation() != null){
|
||||||
progressBar.setProgress(msg.getFileTransferInformation().getRealSize());
|
// progressBar.setProgress(msg.getFileTransferInformation().getRealSize());
|
||||||
}
|
// }
|
||||||
|
|
||||||
cancelUpload.setOnClickListener(new View.OnClickListener() {
|
/* cancelUpload.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
uploadLayout.setVisibility(View.GONE);
|
uploadLayout.setVisibility(View.GONE);
|
||||||
|
@ -580,7 +600,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
LinphoneManager.getInstance().setUploadPendingFileMessage(null);
|
LinphoneManager.getInstance().setUploadPendingFileMessage(null);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
}
|
}
|
||||||
|
|
||||||
String draft = getArguments().getString("messageDraft");
|
String draft = getArguments().getString("messageDraft");
|
||||||
|
@ -594,34 +614,68 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
super.onResume();
|
super.onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void selectAllList(boolean isSelectAll){
|
||||||
|
//TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
public void quitEditMode(){
|
||||||
|
isEditMode = false;
|
||||||
|
editList.setVisibility(View.GONE);
|
||||||
|
topBar.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
int id = v.getId();
|
int id = v.getId();
|
||||||
|
|
||||||
if(id == R.id.sendMessage){
|
if (id == R.id.select_all) {
|
||||||
sendTextMessage();
|
|
||||||
} else if (id == R.id.delete) {
|
|
||||||
edit.setVisibility(View.VISIBLE);
|
|
||||||
selectAll.setVisibility(View.GONE);
|
|
||||||
deselectAll.setVisibility(View.GONE);
|
|
||||||
startCall.setVisibility(View.VISIBLE);
|
|
||||||
delete.setVisibility(View.GONE);;
|
|
||||||
}
|
|
||||||
else if (id == R.id.select_all) {
|
|
||||||
deselectAll.setVisibility(View.VISIBLE);
|
deselectAll.setVisibility(View.VISIBLE);
|
||||||
selectAll.setVisibility(View.GONE);
|
selectAll.setVisibility(View.GONE);
|
||||||
//TODO select all chatrooms
|
//selectAllList(true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (id == R.id.deselect_all) {
|
if (id == R.id.deselect_all) {
|
||||||
deselectAll.setVisibility(View.GONE);
|
deselectAll.setVisibility(View.GONE);
|
||||||
selectAll.setVisibility(View.VISIBLE);
|
selectAll.setVisibility(View.VISIBLE);
|
||||||
//TODO deselect all chatrooms
|
//selectAllList(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (id == R.id.edit) {
|
|
||||||
startCall.setVisibility(View.INVISIBLE);
|
if (id == R.id.cancel) {
|
||||||
edit.setVisibility(View.GONE);
|
quitEditMode();
|
||||||
selectAll.setVisibility(View.VISIBLE);
|
return;
|
||||||
delete.setVisibility(View.VISIBLE);
|
}
|
||||||
|
|
||||||
|
if (id == R.id.delete) {
|
||||||
|
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.delete_text));
|
||||||
|
Button delete = (Button) dialog.findViewById(R.id.delete);
|
||||||
|
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
||||||
|
|
||||||
|
delete.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
// removeCallLogs();
|
||||||
|
dialog.dismiss();
|
||||||
|
quitEditMode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cancel.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dialog.dismiss();
|
||||||
|
quitEditMode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dialog.show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(id == R.id.sendMessage){
|
||||||
|
sendTextMessage();
|
||||||
|
} else if (id == R.id.edit) {
|
||||||
|
topBar.setVisibility(View.GONE);
|
||||||
|
editList.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
else if (id == R.id.new_discussion) {
|
else if (id == R.id.new_discussion) {
|
||||||
//TODO call sipUri
|
//TODO call sipUri
|
||||||
|
@ -643,17 +697,15 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
if(newChatConversation){
|
if(newChatConversation){
|
||||||
String address = searchContactField.getText().toString();
|
String address = searchContactField.getText().toString();
|
||||||
if(address != null && !address.equals("")) {
|
if(address != null && !address.equals("")) {
|
||||||
|
if(!address.startsWith("sip:"))
|
||||||
|
address = "sip:" + address;
|
||||||
if (!LinphoneUtils.isSipAddress(address)) {
|
if (!LinphoneUtils.isSipAddress(address)) {
|
||||||
if (LinphoneManager.getLc().getDefaultProxyConfig() == null) {
|
if (LinphoneManager.getLc().getDefaultProxyConfig() == null) {
|
||||||
Log.w("Error");
|
Log.w("Error");
|
||||||
}
|
}
|
||||||
address = address + "@" + LinphoneManager.getLc().getDefaultProxyConfig().getDomain();
|
address = address + "@" + LinphoneManager.getLc().getDefaultProxyConfig().getDomain();
|
||||||
if (!LinphoneUtils.isStrictSipAddress(address)) {
|
|
||||||
address = "sip:" + address;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.w(address);
|
|
||||||
LinphoneAddress lAddress;
|
LinphoneAddress lAddress;
|
||||||
try {
|
try {
|
||||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(address);
|
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(address);
|
||||||
|
@ -667,7 +719,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) {
|
if (chatRoom != null && messageToSend != null && messageToSend.length() > 0 && isNetworkReachable) {
|
||||||
LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend);
|
LinphoneChatMessage message = chatRoom.createLinphoneChatMessage(messageToSend);
|
||||||
chatRoom.sendChatMessage(message);
|
chatRoom.sendChatMessage(message);
|
||||||
LinphoneActivity.instance().displayChat(lAddress.toString());
|
message.setListener(LinphoneManager.getInstance());
|
||||||
|
Contact lContact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
||||||
|
if(lContact != null)
|
||||||
|
exitNewConversationMode(lContact,lAddress.asStringUriOnly(),null);
|
||||||
|
else
|
||||||
|
exitNewConversationMode(null,lAddress.asStringUriOnly(),lAddress.getUserName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -692,6 +749,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
private void sendImageMessage(String path, int imageSize) {
|
private void sendImageMessage(String path, int imageSize) {
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
|
boolean isNetworkReachable = lc == null ? false : lc.isNetworkReachable();
|
||||||
|
invalidate();
|
||||||
|
|
||||||
if (chatRoom != null && path != null && path.length() > 0 && isNetworkReachable) {
|
if (chatRoom != null && path != null && path.length() > 0 && isNetworkReachable) {
|
||||||
try {
|
try {
|
||||||
|
@ -718,8 +776,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
public FileUploadPrepareTask(Context context, String fileToUploadPath, int size) {
|
public FileUploadPrepareTask(Context context, String fileToUploadPath, int size) {
|
||||||
path = fileToUploadPath;
|
path = fileToUploadPath;
|
||||||
imageSize = size;
|
imageSize = size;
|
||||||
uploadLayout.setVisibility(View.VISIBLE);
|
//uploadLayout.setVisibility(View.VISIBLE);
|
||||||
textLayout.setVisibility(View.GONE);
|
//textLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
progressDialog = new ProgressDialog(context);
|
progressDialog = new ProgressDialog(context);
|
||||||
progressDialog.setIndeterminate(true);
|
progressDialog.setIndeterminate(true);
|
||||||
|
@ -860,6 +918,24 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void exitNewConversationMode(Contact c, String address, String username){
|
||||||
|
searchContactField.setVisibility(View.GONE);
|
||||||
|
sipUri = address;
|
||||||
|
messagesList.setVisibility(View.VISIBLE);
|
||||||
|
contactName.setVisibility(View.VISIBLE);
|
||||||
|
edit.setVisibility(View.VISIBLE);
|
||||||
|
back.setVisibility(View.VISIBLE);
|
||||||
|
startCall.setVisibility(View.VISIBLE);
|
||||||
|
newChatConversation = false;
|
||||||
|
chatRoom = LinphoneManager.getLc().getOrCreateChatRoom(address);
|
||||||
|
|
||||||
|
if(c != null)
|
||||||
|
changeDisplayedChat(address,c.getName(),null);
|
||||||
|
else
|
||||||
|
changeDisplayedChat(address,username,null);
|
||||||
|
dispayMessageList();
|
||||||
|
}
|
||||||
|
|
||||||
private void showPopupMenuAskingImageSize(final String filePath) {
|
private void showPopupMenuAskingImageSize(final String filePath) {
|
||||||
filePathToUpload = filePath;
|
filePathToUpload = filePath;
|
||||||
try {
|
try {
|
||||||
|
@ -891,12 +967,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) {
|
public void onLinphoneChatMessageStateChanged(LinphoneChatMessage msg, State state) {
|
||||||
if (state == State.FileTransferDone || state == State.FileTransferError) {
|
//if (state == State.FileTransferDone || state == State.FileTransferError) {
|
||||||
uploadLayout.setVisibility(View.GONE);
|
// uploadLayout.setVisibility(View.GONE);
|
||||||
textLayout.setVisibility(View.VISIBLE);
|
// textLayout.setVisibility(View.VISIBLE);
|
||||||
progressBar.setProgress(0);
|
// progressBar.setProgress(0);
|
||||||
currentMessageInFileTransferUploadState = null;
|
// currentMessageInFileTransferUploadState = null;
|
||||||
}
|
//}
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -937,7 +1013,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
FilterResults results) {
|
FilterResults results) {
|
||||||
|
|
||||||
if (results.count > 0) {
|
if (results.count > 0) {
|
||||||
Log.w(results.count);
|
|
||||||
contacts.clear();
|
contacts.clear();
|
||||||
contacts = (List<ContactAddress>) results.values;
|
contacts = (List<ContactAddress>) results.values;
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
|
@ -953,9 +1028,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
List<ContactAddress> result = new ArrayList<ContactAddress>();
|
List<ContactAddress> result = new ArrayList<ContactAddress>();
|
||||||
if(constraint != null) {
|
if(constraint != null) {
|
||||||
for (ContactAddress c : contacts) {
|
for (ContactAddress c : contacts) {
|
||||||
Log.w(constraint.toString());
|
|
||||||
Log.w(c.mContact.getName());
|
|
||||||
Log.w(c.mAddress);
|
|
||||||
if (c.mContact.getName().toLowerCase().startsWith(constraint.toString()) || c.mAddress.startsWith(constraint.toString())) {
|
if (c.mContact.getName().toLowerCase().startsWith(constraint.toString()) || c.mAddress.startsWith(constraint.toString())) {
|
||||||
result.add(c);
|
result.add(c);
|
||||||
}
|
}
|
||||||
|
@ -1025,15 +1097,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
final TextView address = (TextView) view.findViewById(R.id.contact_address);
|
final TextView address = (TextView) view.findViewById(R.id.contact_address);
|
||||||
address.setText(contact.mAddress);
|
address.setText(contact.mAddress);
|
||||||
|
|
||||||
|
final String a = contact.mAddress;
|
||||||
|
final Contact c = contact.mContact;
|
||||||
|
|
||||||
view.setOnClickListener(new OnClickListener() {
|
view.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
searchContactField.setVisibility(View.GONE);
|
exitNewConversationMode(c, a,null);
|
||||||
sipUri = address.getText().toString();
|
|
||||||
messagesList.setVisibility(View.VISIBLE);
|
|
||||||
newChatConversation = false;
|
|
||||||
chatRoom = LinphoneManager.getLc().getOrCreateChatRoom(address.getText().toString());
|
|
||||||
dispayMessageList();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,7 @@ import android.widget.CheckBox;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,7 +70,8 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
private List<String> mConversations, mDrafts;
|
private List<String> mConversations, mDrafts;
|
||||||
private ListView chatList;
|
private ListView chatList;
|
||||||
private TextView noChatHistory;
|
private TextView noChatHistory;
|
||||||
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, contactPicture;
|
private ImageView edit, selectAll, deselectAll, delete, newDiscussion, contactPicture, cancel;
|
||||||
|
private RelativeLayout editList, topbar;
|
||||||
private boolean isEditMode = false;
|
private boolean isEditMode = false;
|
||||||
private boolean useLinphoneStorage;
|
private boolean useLinphoneStorage;
|
||||||
|
|
||||||
|
@ -85,6 +87,12 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
noChatHistory = (TextView) view.findViewById(R.id.noChatHistory);
|
noChatHistory = (TextView) view.findViewById(R.id.noChatHistory);
|
||||||
|
|
||||||
|
editList = (RelativeLayout) view.findViewById(R.id.edit_list);
|
||||||
|
topbar = (RelativeLayout) view.findViewById(R.id.top_bar);
|
||||||
|
|
||||||
|
cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||||
|
cancel.setOnClickListener(this);
|
||||||
|
|
||||||
edit = (ImageView) view.findViewById(R.id.edit);
|
edit = (ImageView) view.findViewById(R.id.edit);
|
||||||
edit.setOnClickListener(this);
|
edit.setOnClickListener(this);
|
||||||
|
|
||||||
|
@ -99,7 +107,6 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
delete = (ImageView) view.findViewById(R.id.delete);
|
delete = (ImageView) view.findViewById(R.id.delete);
|
||||||
delete.setOnClickListener(this);
|
delete.setOnClickListener(this);
|
||||||
delete.setVisibility(View.INVISIBLE);
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,10 +134,8 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
public void quitEditMode(){
|
public void quitEditMode(){
|
||||||
isEditMode = false;
|
isEditMode = false;
|
||||||
selectAll.setVisibility(View.GONE);
|
editList.setVisibility(View.GONE);
|
||||||
deselectAll.setVisibility(View.GONE);
|
topbar.setVisibility(View.VISIBLE);
|
||||||
delete.setVisibility(View.GONE);
|
|
||||||
edit.setVisibility(View.VISIBLE);
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,6 +262,11 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (id == R.id.cancel) {
|
||||||
|
quitEditMode();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (id == R.id.delete) {
|
if (id == R.id.delete) {
|
||||||
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.delete_text));
|
final Dialog dialog = LinphoneActivity.instance().displayDialog(getString(R.string.delete_text));
|
||||||
Button delete = (Button) dialog.findViewById(R.id.delete);
|
Button delete = (Button) dialog.findViewById(R.id.delete);
|
||||||
|
@ -282,9 +292,8 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (id == R.id.edit) {
|
else if (id == R.id.edit) {
|
||||||
edit.setVisibility(View.GONE);
|
topbar.setVisibility(View.GONE);
|
||||||
selectAll.setVisibility(View.VISIBLE);
|
editList.setVisibility(View.VISIBLE);
|
||||||
delete.setVisibility(View.VISIBLE);
|
|
||||||
isEditMode = true;
|
isEditMode = true;
|
||||||
hideAndDisplayMessageIfNoChat();
|
hideAndDisplayMessageIfNoChat();
|
||||||
}
|
}
|
||||||
|
@ -461,26 +470,22 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
Contact lContact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), address);
|
Contact lContact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), address);
|
||||||
|
|
||||||
String message = "";
|
String message = "";
|
||||||
Long time = null;
|
Long time;
|
||||||
TextView lastMessageView = (TextView) view.findViewById(R.id.lastMessage);
|
TextView lastMessageView = (TextView) view.findViewById(R.id.lastMessage);
|
||||||
LinphoneChatRoom chatRoom = LinphoneManager.getLc().getOrCreateChatRoom(contact);
|
LinphoneChatRoom chatRoom = LinphoneManager.getLc().getOrCreateChatRoom(contact);
|
||||||
LinphoneChatMessage[] history = chatRoom.getHistory(1);
|
LinphoneChatMessage[] history = chatRoom.getHistory(1);
|
||||||
LinphoneChatMessage msg = history[0];
|
LinphoneChatMessage msg = history[0];
|
||||||
if (msg.getText() != null && msg.getText().length() > 0) {
|
TextView date = (TextView) view.findViewById(R.id.date);
|
||||||
message = msg.getText();
|
if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null || msg.getAppData() != null ){
|
||||||
time = msg.getTime();
|
|
||||||
lastMessageView.setText(message);
|
|
||||||
} else {
|
|
||||||
if(msg.getFileTransferInformation() != null || msg.getExternalBodyUrl() != null){
|
|
||||||
lastMessageView.setBackgroundResource(R.drawable.chat_file_message);
|
lastMessageView.setBackgroundResource(R.drawable.chat_file_message);
|
||||||
time = msg.getTime();
|
time = msg.getTime();
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TextView date = (TextView) view.findViewById(R.id.date);
|
|
||||||
if(time != null)
|
|
||||||
date.setText(timestampToHumanDate(time));
|
date.setText(timestampToHumanDate(time));
|
||||||
|
} else if (msg.getText() != null && msg.getText().length() > 0 ){
|
||||||
|
message = msg.getText();
|
||||||
|
time = msg.getTime();
|
||||||
|
date.setText(timestampToHumanDate(time));
|
||||||
|
lastMessageView.setText(message);
|
||||||
|
}
|
||||||
|
|
||||||
TextView sipUri = (TextView) view.findViewById(R.id.sipUri);
|
TextView sipUri = (TextView) view.findViewById(R.id.sipUri);
|
||||||
sipUri.setSelected(true); // For animation
|
sipUri.setSelected(true); // For animation
|
||||||
|
@ -495,8 +500,11 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
view.findViewById(R.id.draft).setVisibility(View.VISIBLE);
|
view.findViewById(R.id.draft).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextView unreadMessages = (TextView) view.findViewById(R.id.unreadMessages);
|
||||||
|
|
||||||
CheckBox select = (CheckBox) view.findViewById(R.id.delete);
|
CheckBox select = (CheckBox) view.findViewById(R.id.delete);
|
||||||
if (isEditMode) {
|
if (isEditMode) {
|
||||||
|
unreadMessages.setVisibility(View.GONE);
|
||||||
select.setVisibility(View.VISIBLE);
|
select.setVisibility(View.VISIBLE);
|
||||||
select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
select.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -510,11 +518,10 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
select.setChecked(false);
|
select.setChecked(false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
delete.setVisibility(View.GONE);
|
unreadMessages.setVisibility(View.GONE);
|
||||||
|
//delete.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView unreadMessages = (TextView) view.findViewById(R.id.unreadMessages);
|
|
||||||
|
|
||||||
if (unreadMessagesCount > 0) {
|
if (unreadMessagesCount > 0) {
|
||||||
unreadMessages.setVisibility(View.VISIBLE);
|
unreadMessages.setVisibility(View.VISIBLE);
|
||||||
unreadMessages.setText(String.valueOf(unreadMessagesCount));
|
unreadMessages.setText(String.valueOf(unreadMessagesCount));
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.util.Calendar;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import org.linphone.Contact;
|
||||||
|
import org.linphone.ContactsManager;
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.LinphoneUtils;
|
import org.linphone.LinphoneUtils;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
@ -73,7 +75,7 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
private static final HashMap<String, Integer> emoticons = new HashMap<String, Integer>();
|
private static final HashMap<String, Integer> emoticons = new HashMap<String, Integer>();
|
||||||
|
|
||||||
private LinearLayout view;
|
private LinearLayout view;
|
||||||
private ImageView statusView;
|
private ImageView statusView, contactPicture;
|
||||||
private LinphoneChatMessage nativeMessage;
|
private LinphoneChatMessage nativeMessage;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private static final int SIZE_MAX = 512;
|
private static final int SIZE_MAX = 512;
|
||||||
|
@ -81,7 +83,7 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
private Bitmap defaultBitmap;
|
private Bitmap defaultBitmap;
|
||||||
|
|
||||||
@SuppressLint("InflateParams")
|
@SuppressLint("InflateParams")
|
||||||
public BubbleChat(final Context context, LinphoneChatMessage message) {
|
public BubbleChat(final Context context, LinphoneChatMessage message, Contact c) {
|
||||||
if (message == null) {
|
if (message == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +96,7 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null);
|
view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.chat_photo_default);
|
defaultBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.chat_picture_over);
|
||||||
|
|
||||||
view.setId(message.getStorageId());
|
view.setId(message.getStorageId());
|
||||||
|
|
||||||
|
@ -102,6 +104,12 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
|
|
||||||
String externalBodyUrl = message.getExternalBodyUrl();
|
String externalBodyUrl = message.getExternalBodyUrl();
|
||||||
LinphoneContent fileTransferContent = message.getFileTransferInformation();
|
LinphoneContent fileTransferContent = message.getFileTransferInformation();
|
||||||
|
|
||||||
|
if(LinphoneManager.getInstance().getMessageUploadPending() != null){
|
||||||
|
spinner.setVisibility(View.VISIBLE);
|
||||||
|
nativeMessage.setListener(LinphoneManager.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
if (externalBodyUrl != null || fileTransferContent != null) {
|
if (externalBodyUrl != null || fileTransferContent != null) {
|
||||||
Button download = (Button) view.findViewById(R.id.download);
|
Button download = (Button) view.findViewById(R.id.download);
|
||||||
ImageView imageView = (ImageView) view.findViewById(R.id.image);
|
ImageView imageView = (ImageView) view.findViewById(R.id.image);
|
||||||
|
@ -158,7 +166,23 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
}
|
}
|
||||||
|
|
||||||
TextView contact = (TextView) view.findViewById(R.id.contact_header);
|
TextView contact = (TextView) view.findViewById(R.id.contact_header);
|
||||||
contact.setText(timestampToHumanDate(context, message.getTime()) + " - " + LinphoneUtils.getUsernameFromAddress(message.getFrom().asStringUriOnly()));
|
|
||||||
|
|
||||||
|
|
||||||
|
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||||
|
|
||||||
|
String displayName = nativeMessage.getFrom().getUserName();
|
||||||
|
final String sipUri = nativeMessage.getFrom().asStringUriOnly();
|
||||||
|
if(!nativeMessage.isOutgoing()) {
|
||||||
|
if (c != null) {
|
||||||
|
displayName = c.getName();
|
||||||
|
LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, c.getPhotoUri(), c.getThumbnailUri());
|
||||||
|
} else {
|
||||||
|
contactPicture.setImageResource(R.drawable.avatar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
contact.setText(timestampToHumanDate(context, message.getTime()) + " - " + displayName);
|
||||||
|
|
||||||
LinphoneChatMessage.State status = message.getStatus();
|
LinphoneChatMessage.State status = message.getStatus();
|
||||||
statusView = (ImageView) view.findViewById(R.id.status);
|
statusView = (ImageView) view.findViewById(R.id.status);
|
||||||
|
|
Loading…
Reference in a new issue