Improve chat view and new conversation
This commit is contained in:
parent
a106c51f0d
commit
18c2eef5b8
7 changed files with 41 additions and 32 deletions
|
@ -144,19 +144,17 @@
|
||||||
android:layout_below="@+id/top_bar"/>
|
android:layout_below="@+id/top_bar"/>
|
||||||
|
|
||||||
<AutoCompleteTextView
|
<AutoCompleteTextView
|
||||||
android:contentDescription="@string/content_description_search"
|
android:id="@+id/searchContactField"
|
||||||
|
android:background="@drawable/resizable_textfield"
|
||||||
|
android:hint="@string/search"
|
||||||
|
android:inputType="textPersonName"
|
||||||
|
android:completionThreshold="1"
|
||||||
android:textCursorDrawable="@null"
|
android:textCursorDrawable="@null"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:layout_below="@id/top_bar"
|
android:layout_below="@id/top_bar"
|
||||||
android:id="@+id/searchContactField"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
android:textColor="@android:color/black"
|
android:paddingRight="5dp"/>
|
||||||
android:background="@drawable/resizable_textfield"
|
|
||||||
android:gravity="center"
|
|
||||||
android:completionThreshold="1"
|
|
||||||
android:paddingRight="5dp"
|
|
||||||
android:inputType="textPersonName"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
|
@ -69,8 +69,7 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="150dp"
|
android:layout_height="150dp"
|
||||||
android:scaleType="center"
|
android:scaleType="centerInside"
|
||||||
android:layout_centerInParent="true"
|
|
||||||
android:maxWidth="250dp"
|
android:maxWidth="250dp"
|
||||||
android:maxHeight="250dp" />
|
android:maxHeight="250dp" />
|
||||||
|
|
||||||
|
@ -83,8 +82,10 @@
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress_bar"
|
android:id="@+id/progress_bar"
|
||||||
android:paddingRight="5dp"
|
android:paddingRight="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
android:layout_width="200dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="5dp"/>
|
android:layout_height="5dp"/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
|
|
|
@ -59,10 +59,8 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="150dp"
|
android:layout_height="150dp"
|
||||||
android:scaleType="center"
|
android:scaleType="centerInside"
|
||||||
android:layout_centerInParent="true"
|
android:layout_centerInParent="true" />
|
||||||
android:maxWidth="250dp"
|
|
||||||
android:maxHeight="250dp" />
|
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/imageLayout"
|
android:id="@+id/imageLayout"
|
||||||
|
@ -73,6 +71,8 @@
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress_bar"
|
android:id="@+id/progress_bar"
|
||||||
android:paddingRight="5dp"
|
android:paddingRight="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||||
android:layout_width="150dp"
|
android:layout_width="150dp"
|
||||||
android:layout_height="5dp"/>
|
android:layout_height="5dp"/>
|
||||||
|
@ -84,7 +84,6 @@
|
||||||
android:contentDescription="@string/content_description_validate"
|
android:contentDescription="@string/content_description_validate"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:layout_below="@id/progress_bar"/>
|
android:layout_below="@id/progress_bar"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/layout"
|
android:id="@+id/layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="50dp"
|
android:layout_height="60dp"
|
||||||
|
android:padding="5dp"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:background="@drawable/list_selector"
|
android:background="@drawable/list_selector"
|
||||||
android:orientation="vertical" >
|
android:orientation="vertical" >
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/contact_address"
|
android:id="@+id/contact_address"
|
||||||
|
style="@style/font3"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
<string name="about">About</string>
|
<string name="about">About</string>
|
||||||
<string name="deny">Deny</string>
|
<string name="deny">Deny</string>
|
||||||
<string name="no_account">No account configured</string>
|
<string name="no_account">No account configured</string>
|
||||||
|
<string name="search">Search</string>
|
||||||
|
|
||||||
<!-- splashscreen -->
|
<!-- splashscreen -->
|
||||||
<string name="app_description">free SIP VOIP client</string>
|
<string name="app_description">free SIP VOIP client</string>
|
||||||
|
@ -44,7 +45,6 @@
|
||||||
<string name="assistant_remote_provisioning_login">Enter your login</string>
|
<string name="assistant_remote_provisioning_login">Enter your login</string>
|
||||||
<string name="assistant_connect">Connection</string>
|
<string name="assistant_connect">Connection</string>
|
||||||
|
|
||||||
|
|
||||||
<!-- 1. Dailer -->
|
<!-- 1. Dailer -->
|
||||||
<string name="address_bar_hint">Enter a number or an address</string>
|
<string name="address_bar_hint">Enter a number or an address</string>
|
||||||
|
|
||||||
|
|
|
@ -194,6 +194,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
messagesList.setVisibility(View.GONE);
|
messagesList.setVisibility(View.GONE);
|
||||||
searchContactField.setVisibility(View.VISIBLE);
|
searchContactField.setVisibility(View.VISIBLE);
|
||||||
searchContactField.setAdapter(new SearchContactsListAdapter(ContactsManager.getInstance().getAllContacts(), null, inflater));
|
searchContactField.setAdapter(new SearchContactsListAdapter(ContactsManager.getInstance().getAllContacts(), null, inflater));
|
||||||
|
searchContactField.showDropDown();
|
||||||
|
searchContactField.requestFocus();
|
||||||
edit.setVisibility(View.INVISIBLE);
|
edit.setVisibility(View.INVISIBLE);
|
||||||
startCall.setVisibility(View.INVISIBLE);
|
startCall.setVisibility(View.INVISIBLE);
|
||||||
contactName.setVisibility(View.INVISIBLE);
|
contactName.setVisibility(View.INVISIBLE);
|
||||||
|
@ -506,12 +508,18 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
|
|
||||||
LinphoneAddress lAddress = null;
|
LinphoneAddress lAddress = null;
|
||||||
try {
|
try {
|
||||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
|
||||||
|
if(contact == null)
|
||||||
contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
Log.w("error");
|
Log.w("error");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(lAddress == null){
|
||||||
|
//TODO SHOW POPUP
|
||||||
|
LinphoneActivity.instance().displayChatList();
|
||||||
|
}
|
||||||
|
|
||||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||||
if (lc != null) {
|
if (lc != null) {
|
||||||
chatRoom = lc.getOrCreateChatRoom(sipUri);
|
chatRoom = lc.getOrCreateChatRoom(sipUri);
|
||||||
|
@ -1017,10 +1025,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
newChatConversation = false;
|
newChatConversation = false;
|
||||||
chatRoom = LinphoneManager.getLc().getOrCreateChatRoom(address);
|
chatRoom = LinphoneManager.getLc().getOrCreateChatRoom(address);
|
||||||
|
|
||||||
if(c != null)
|
if(c != null) {
|
||||||
|
contact = c;
|
||||||
changeDisplayedChat(address,c.getName(),null);
|
changeDisplayedChat(address,c.getName(),null);
|
||||||
else
|
} else {
|
||||||
changeDisplayedChat(address,username,null);
|
changeDisplayedChat(address,username,null);
|
||||||
|
}
|
||||||
dispayMessageList();
|
dispayMessageList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,7 +1129,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
||||||
if(constraint != null) {
|
if(constraint != null) {
|
||||||
for (ContactAddress c : contacts) {
|
for (ContactAddress c : contacts) {
|
||||||
String address = c.address;
|
String address = c.address;
|
||||||
if(address.startsWith("sip")) address.substring(4);
|
if(address.startsWith("sip:")) address = address.substring(4);
|
||||||
if (c.contact.getName().toLowerCase().startsWith(constraint.toString()) || address.toLowerCase().startsWith(constraint.toString())) {
|
if (c.contact.getName().toLowerCase().startsWith(constraint.toString()) || address.toLowerCase().startsWith(constraint.toString())) {
|
||||||
result.add(c);
|
result.add(c);
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,7 +382,6 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
||||||
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
|
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
|
||||||
if (this == bitmapWorkerTask && imageView != null) {
|
if (this == bitmapWorkerTask && imageView != null) {
|
||||||
imageView.setImageBitmap(bitmap);
|
imageView.setImageBitmap(bitmap);
|
||||||
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
|
||||||
imageView.setTag(path);
|
imageView.setTag(path);
|
||||||
imageView.setOnClickListener(new OnClickListener() {
|
imageView.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue