Improve chat view and new conversation

This commit is contained in:
Margaux Clerc 2015-11-13 15:09:45 +01:00
parent a106c51f0d
commit 18c2eef5b8
7 changed files with 41 additions and 32 deletions

View file

@ -143,20 +143,18 @@
android:layout_marginBottom="10dp"
android:layout_below="@+id/top_bar"/>
<AutoCompleteTextView
android:contentDescription="@string/content_description_search"
android:textCursorDrawable="@null"
android:visibility="gone"
android:layout_margin="10dp"
android:layout_below="@id/top_bar"
android:id="@+id/searchContactField"
android:layout_width="match_parent"
android:layout_height="40dp"
android:textColor="@android:color/black"
android:background="@drawable/resizable_textfield"
android:gravity="center"
android:completionThreshold="1"
android:paddingRight="5dp"
android:inputType="textPersonName"/>
<AutoCompleteTextView
android:id="@+id/searchContactField"
android:background="@drawable/resizable_textfield"
android:hint="@string/search"
android:inputType="textPersonName"
android:completionThreshold="1"
android:textCursorDrawable="@null"
android:visibility="gone"
android:layout_margin="10dp"
android:layout_below="@id/top_bar"
android:layout_width="match_parent"
android:layout_height="40dp"
android:paddingRight="5dp"/>
</RelativeLayout>

View file

@ -69,8 +69,7 @@
android:visibility="gone"
android:layout_width="150dp"
android:layout_height="150dp"
android:scaleType="center"
android:layout_centerInParent="true"
android:scaleType="centerInside"
android:maxWidth="250dp"
android:maxHeight="250dp" />
@ -83,8 +82,10 @@
<ProgressBar
android:id="@+id/progress_bar"
android:paddingRight="5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="200dp"
android:layout_width="150dp"
android:layout_height="5dp"/>
<Button

View file

@ -59,10 +59,8 @@
android:visibility="gone"
android:layout_width="150dp"
android:layout_height="150dp"
android:scaleType="center"
android:layout_centerInParent="true"
android:maxWidth="250dp"
android:maxHeight="250dp" />
android:scaleType="centerInside"
android:layout_centerInParent="true" />
<RelativeLayout
android:id="@+id/imageLayout"
@ -73,6 +71,8 @@
<ProgressBar
android:id="@+id/progress_bar"
android:paddingRight="5dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="150dp"
android:layout_height="5dp"/>
@ -84,7 +84,6 @@
android:contentDescription="@string/content_description_validate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@id/progress_bar"/>
</RelativeLayout>

View file

@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_height="60dp"
android:padding="5dp"
android:gravity="center_vertical"
android:background="@drawable/list_selector"
android:orientation="vertical" >
@ -19,6 +20,7 @@
<TextView
android:id="@+id/contact_address"
style="@style/font3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"

View file

@ -19,6 +19,7 @@
<string name="about">About</string>
<string name="deny">Deny</string>
<string name="no_account">No account configured</string>
<string name="search">Search</string>
<!-- splashscreen -->
<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_connect">Connection</string>
<!-- 1. Dailer -->
<string name="address_bar_hint">Enter a number or an address</string>

View file

@ -194,6 +194,8 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
messagesList.setVisibility(View.GONE);
searchContactField.setVisibility(View.VISIBLE);
searchContactField.setAdapter(new SearchContactsListAdapter(ContactsManager.getInstance().getAllContacts(), null, inflater));
searchContactField.showDropDown();
searchContactField.requestFocus();
edit.setVisibility(View.INVISIBLE);
startCall.setVisibility(View.INVISIBLE);
contactName.setVisibility(View.INVISIBLE);
@ -506,12 +508,18 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
LinphoneAddress lAddress = null;
try {
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
lAddress = LinphoneManager.getLc().interpretUrl(sipUri);
if(contact == null)
contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
} catch (Exception e){
Log.w("error");
}
if(lAddress == null){
//TODO SHOW POPUP
LinphoneActivity.instance().displayChatList();
}
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
chatRoom = lc.getOrCreateChatRoom(sipUri);
@ -959,7 +967,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if (message.getText() != null && message.getText().length() > 0) {
sendTextMessage(message.getText());
} else {
sendImageMessage(message.getAppData(),0);
sendImageMessage(message.getAppData(), 0);
}
}
@ -1017,10 +1025,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
newChatConversation = false;
chatRoom = LinphoneManager.getLc().getOrCreateChatRoom(address);
if(c != null)
if(c != null) {
contact = c;
changeDisplayedChat(address,c.getName(),null);
else
} else {
changeDisplayedChat(address,username,null);
}
dispayMessageList();
}
@ -1119,7 +1129,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
if(constraint != null) {
for (ContactAddress c : contacts) {
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())) {
result.add(c);
}

View file

@ -382,7 +382,6 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
if (this == bitmapWorkerTask && imageView != null) {
imageView.setImageBitmap(bitmap);
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setTag(path);
imageView.setOnClickListener(new OnClickListener() {
@Override