diff --git a/res/layout/chat.xml b/res/layout/chat.xml
index ebd3bc687..b43ce632c 100644
--- a/res/layout/chat.xml
+++ b/res/layout/chat.xml
@@ -62,89 +62,71 @@
android:layout_toRightOf="@id/back"
android:layout_toLeftOf="@id/start_call"
android:paddingLeft="10dp"
- android:gravity="center"/>
+ android:gravity="center_vertical"/>
-
-
-
-
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
+ android:text="@string/remote_composing"
+ android:layout_above="@id/footer"/>
-
\ No newline at end of file
diff --git a/res/layout/chat_bubble_incoming.xml b/res/layout/chat_bubble_incoming.xml
index 8870b3fcc..91739a4ec 100644
--- a/res/layout/chat_bubble_incoming.xml
+++ b/res/layout/chat_bubble_incoming.xml
@@ -108,12 +108,13 @@
android:id="@+id/delete"
android:button="@drawable/checkbox"
android:contentDescription="@string/content_description_delete"
- android:paddingRight="5dp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_marginLeft="5dp"
+ android:layout_marginRight="5dp"
+ android:layout_width="30dp"
+ android:layout_height="30dp"
android:adjustViewBounds="true"
android:layout_alignParentRight="true"
- android:layout_centerVertical="true"
android:visibility="gone" />
+
\ No newline at end of file
diff --git a/res/layout/chat_bubble_outgoing.xml b/res/layout/chat_bubble_outgoing.xml
index 13ead5d46..887f19eda 100644
--- a/res/layout/chat_bubble_outgoing.xml
+++ b/res/layout/chat_bubble_outgoing.xml
@@ -1,13 +1,26 @@
-
+
+
@@ -41,15 +54,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
-
-
-
-
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/org/linphone/ChatFragment.java b/src/org/linphone/ChatFragment.java
index 8e49bc652..279fdeea0 100644
--- a/src/org/linphone/ChatFragment.java
+++ b/src/org/linphone/ChatFragment.java
@@ -26,10 +26,7 @@ import android.app.Dialog;
import android.app.Fragment;
import android.graphics.Matrix;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
import org.linphone.compatibility.Compatibility;
@@ -65,7 +62,6 @@ import android.os.Environment;
import android.os.Parcelable;
import android.provider.MediaStore;
import android.text.Editable;
-import android.text.InputType;
import android.text.TextWatcher;
import android.view.ContextMenu;
import android.view.LayoutInflater;
@@ -76,9 +72,12 @@ import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
+import android.widget.AbsListView;
import android.widget.AutoCompleteTextView;
import android.widget.BaseAdapter;
import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.Filter;
import android.widget.Filterable;
@@ -86,10 +85,10 @@ import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
-import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
+
public class ChatFragment extends Fragment implements OnClickListener, LinphoneChatMessage.LinphoneChatMessageListener {
private static ChatFragment instance;
@@ -170,9 +169,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
remoteComposing = (TextView) view.findViewById(R.id.remoteComposing);
remoteComposing.setVisibility(View.GONE);
- uploadLayout = (RelativeLayout) view.findViewById(R.id.uploadLayout);
- uploadLayout.setVisibility(View.GONE);
-
cancel = (ImageView) view.findViewById(R.id.cancel);
cancel.setOnClickListener(this);
@@ -200,6 +196,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
searchContactField.setAdapter(new SearchContactsListAdapter(ContactsManager.getInstance().getAllContacts(), null, inflater));
edit.setVisibility(View.INVISIBLE);
startCall.setVisibility(View.INVISIBLE);
+ contactName.setVisibility(View.INVISIBLE);
} else {
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc != null) {
@@ -243,22 +240,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
});
}
-
- cancelUpload = (ImageView) view.findViewById(R.id.cancelUpload);
- cancelUpload.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (currentMessageInFileTransferUploadState != null) {
- uploadLayout.setVisibility(View.GONE);
- textLayout.setVisibility(View.VISIBLE);
-
- //progressBar.setProgress(0);
- currentMessageInFileTransferUploadState.cancelFileTransfer();
- currentMessageInFileTransferUploadState = null;
- LinphoneManager.getInstance().setUploadPendingFileMessage(null);
- }
- }
- });
mListener = new LinphoneCoreListenerBase(){
@Override
@@ -348,6 +329,29 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
}
}
+ public int getNbItemsChecked(){
+ int size = messagesList.getAdapter().getCount();
+ int nb = 0;
+ for(int i=0; i contacts;
- private HashMap contactsList2;
+ private List contacts;
private Cursor cursor;
private LayoutInflater mInflater;
SearchContactsListAdapter(List contactsList, Cursor c, LayoutInflater inflater) {
cursor = c;
mInflater = inflater;
- contactsList2 = new HashMap();
- //contacts = new ArrayList();
- for(Contact con: ContactsManager.getInstance().getAllContacts()){
- for(String numberOrAddress : con.getNumbersOrAddresses()){
- contactsList2.put(con,numberOrAddress);
- //contacts.add(new ContactAddress(con,numberOrAddress));
- }
- }
+ contacts = getContactsList();
}
@Override
@@ -1045,27 +1103,25 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
FilterResults results) {
if (results.count > 0) {
- //contacts.clear();
- contactsList2.clear();
- contactsList2 = ( HashMap) results.values;
- //contacts = (List) results.values;
+ contacts.clear();
+ contacts = (List) results.values;
notifyDataSetChanged();
} else {;
- //contacts.clear();
- contactsList2.clear();
- contactsList2 = getContactsList();
+ contacts.clear();
+ contacts = getContactsList();
notifyDataSetInvalidated();
}
}
@Override
protected FilterResults performFiltering(CharSequence constraint) {
- //List result = new ArrayList();
- HashMap result = new HashMap();
+ List result = new ArrayList();
if(constraint != null) {
- for (HashMap.Entry entry : contactsList2.entrySet()) {
- if (entry.getKey().getName().toLowerCase().startsWith(constraint.toString()) || entry.getValue().startsWith(constraint.toString())) {
- result.put(entry.getKey(),entry.getValue());
+ for (ContactAddress c : contacts) {
+ String address = c.address;
+ if(address.startsWith("sip")) address.substring(4);
+ if (c.contact.getName().toLowerCase().startsWith(constraint.toString()) || address.toLowerCase().startsWith(constraint.toString())) {
+ result.add(c);
}
}
}
@@ -1077,29 +1133,26 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
};
}
- public HashMap getContactsList(){
- HashMap contacts = new HashMap();
+ public ListgetContactsList(){
+ List list = new ArrayList();
for(Contact con: ContactsManager.getInstance().getAllContacts()){
for(String numberOrAddress : con.getNumbersOrAddresses()){
- contacts.put(con, numberOrAddress);
+ list.add(new ContactAddress(con, numberOrAddress));
}
}
- return contacts;
+ return list;
}
public int getCount() {
- return contactsList2.size();
+ return contacts.size();
}
- public Contact getItem(int position) {
- if (contactsList2 == null || position >= contactsList2.size()) {
- contactsList2 = getContactsList();
- Contact[] s = (Contact[]) contactsList2.keySet().toArray();
- return s[position];
+ public ContactAddress getItem(int position) {
+ if (contacts == null || position >= contacts.size()) {
+ contacts = getContactsList();
+ return contacts.get(position);
} else {
- Object[] s = (Object[]) contactsList2.keySet().toArray();
- return (Contact) s[position];
- //return contactsList2.get();
+ return contacts.get(position);
}
}
@@ -1109,7 +1162,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
public View getView(int position, View convertView, ViewGroup parent) {
View view = null;
- Contact contact;
+ ContactAddress contact;
do {
contact = getItem(position);
} while (contact == null);
@@ -1120,14 +1173,14 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
view = mInflater.inflate(R.layout.search_contact_cell, parent, false);
}
+ final String a = contact.address;
+ final Contact c = contact.contact;
+
TextView name = (TextView) view.findViewById(R.id.Contact_name);
- name.setText(contact.getName());
+ name.setText(c.getName());
final TextView address = (TextView) view.findViewById(R.id.contact_address);
- address.setText(contactsList2.get(contact));
-
- final String a = contactsList2.get(contact);
- final Contact c = contact;
+ address.setText(a);
view.setOnClickListener(new OnClickListener() {
@Override
diff --git a/src/org/linphone/ChatStorage.java b/src/org/linphone/ChatStorage.java
index f2f52bce4..c7a5a36bc 100644
--- a/src/org/linphone/ChatStorage.java
+++ b/src/org/linphone/ChatStorage.java
@@ -78,7 +78,7 @@ public class ChatStorage {
private ChatStorage(Context c) {
context = c;
- boolean useLinphoneStorage = false;
+ boolean useLinphoneStorage = true;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(LinphoneService.instance());
boolean updateNeeded = prefs.getBoolean(c.getString(R.string.pref_first_time_linphone_chat_storage), !LinphonePreferences.instance().isFirstLaunch());
updateNeeded = updateNeeded && !isVersionUsingNewChatStorage();
@@ -378,7 +378,6 @@ public class ChatStorage {
for (LinphoneChatRoom chatroom : chats) {
if (chatroom.getHistory(1).length > 0) {
- Log.w("History non nul " + chatroom.getPeerAddress().asString());
rooms.add(chatroom);
}
}
diff --git a/src/org/linphone/ui/BubbleChat.java b/src/org/linphone/ui/BubbleChat.java
index 3bf58bbf8..b0822a134 100644
--- a/src/org/linphone/ui/BubbleChat.java
+++ b/src/org/linphone/ui/BubbleChat.java
@@ -74,10 +74,11 @@ import android.widget.TextView;
public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListener {
private static final HashMap emoticons = new HashMap();
- private LinearLayout view;
+ private View view;
private ImageView statusView, contactPicture;
private LinphoneChatMessage nativeMessage;
private Context mContext;
+ private Button cancelUpload, acceptDownload;
private static final int SIZE_MAX = 512;
private ProgressBar progressBar, inprogress;
private Bitmap defaultBitmap;
@@ -91,9 +92,9 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
mContext = context;
if (message.isOutgoing()) {
- view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_outgoing, null);
+ view = LayoutInflater.from(context).inflate(R.layout.chat_bubble_outgoing, null);
} else {
- view = (LinearLayout) LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null);
+ view = LayoutInflater.from(context).inflate(R.layout.chat_bubble_incoming, null);
}
defaultBitmap = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.chat_picture_over);
@@ -119,12 +120,29 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
}
}
+ if(nativeMessage.isOutgoing()){
+ cancelUpload = (Button) view.findViewById(R.id.cancel_upload);
+ cancelUpload.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (LinphoneManager.getInstance().getMessageUploadPending() != null) {
+ progressBar.setVisibility(View.GONE);
+ //tex.setVisibility(View.VISIBLE);
+
+ progressBar.setProgress(0);
+ nativeMessage.cancelFileTransfer();
+ LinphoneManager.getInstance().setUploadPendingFileMessage(null);
+ }
+ }
+ });
+ }
+
String externalBodyUrl = message.getExternalBodyUrl();
LinphoneContent fileTransferContent = message.getFileTransferInformation();
if(LinphoneManager.getInstance().getMessageUploadPending() != null){
progressBar.setVisibility(View.VISIBLE);
- nativeMessage.setListener(LinphoneManager.getInstance());
+ LinphoneManager.addListener(this);
}
if (externalBodyUrl != null || fileTransferContent != null ) {