diff --git a/res/drawable-xhdpi/contact_sip_default.png b/res/drawable-xhdpi/contact_sip_default.png
new file mode 100644
index 000000000..48184b73a
Binary files /dev/null and b/res/drawable-xhdpi/contact_sip_default.png differ
diff --git a/res/drawable-xhdpi/contacts_all.png b/res/drawable-xhdpi/contacts_all.png
deleted file mode 100644
index eb98ed424..000000000
Binary files a/res/drawable-xhdpi/contacts_all.png and /dev/null differ
diff --git a/res/drawable-xhdpi/contacts_all_.png b/res/drawable-xhdpi/contacts_all_.png
new file mode 100644
index 000000000..07d00c6a2
Binary files /dev/null and b/res/drawable-xhdpi/contacts_all_.png differ
diff --git a/res/drawable-xhdpi/contacts_all_default.png b/res/drawable-xhdpi/contacts_all_default.png
index 07d00c6a2..eb98ed424 100644
Binary files a/res/drawable-xhdpi/contacts_all_default.png and b/res/drawable-xhdpi/contacts_all_default.png differ
diff --git a/res/drawable-xhdpi/contacts_sip.png b/res/drawable-xhdpi/contacts_sip.png
deleted file mode 100644
index 2a89067f0..000000000
Binary files a/res/drawable-xhdpi/contacts_sip.png and /dev/null differ
diff --git a/res/drawable-xhdpi/contacts_sip_default.png b/res/drawable-xhdpi/contacts_sip_default.png
index 48184b73a..2a89067f0 100644
Binary files a/res/drawable-xhdpi/contacts_sip_default.png and b/res/drawable-xhdpi/contacts_sip_default.png differ
diff --git a/res/drawable/chat_room_creation_next.xml b/res/drawable/chat_room_creation_next.xml
new file mode 100644
index 000000000..52e7ebefc
--- /dev/null
+++ b/res/drawable/chat_room_creation_next.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/res/layout/create_chat.xml b/res/layout/create_chat.xml
index 7bf28d99b..b61eae178 100644
--- a/res/layout/create_chat.xml
+++ b/res/layout/create_chat.xml
@@ -70,7 +70,7 @@
contactsList, LayoutInflater inflater, ProgressBar pB) {
+ public SearchContactsListAdapter(List contactsList, LayoutInflater inflater, ProgressBar pB) {
mInflater = inflater;
progressBar = pB;
setContactsSelectedList(null);
diff --git a/src/android/org/linphone/ChatCreationFragment.java b/src/android/org/linphone/chat/ChatCreationFragment.java
similarity index 84%
rename from src/android/org/linphone/ChatCreationFragment.java
rename to src/android/org/linphone/chat/ChatCreationFragment.java
index 6dc60d67c..9d2838cf7 100644
--- a/src/android/org/linphone/ChatCreationFragment.java
+++ b/src/android/org/linphone/chat/ChatCreationFragment.java
@@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-package org.linphone;
+package org.linphone.chat;
import android.app.Fragment;
import android.os.Bundle;
@@ -35,13 +35,16 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
+import org.linphone.ContactAddress;
+import org.linphone.ContactSelectView;
+import org.linphone.ContactsUpdatedListener;
+import org.linphone.LinphoneActivity;
+import org.linphone.R;
+import org.linphone.SearchContactsListAdapter;
+
import java.util.ArrayList;
import java.util.List;
-/**
- * Created by Erwan Croze.
- */
-
public class ChatCreationFragment extends Fragment implements View.OnClickListener, AdapterView.OnItemClickListener, ContactsUpdatedListener {
private LayoutInflater mInflater;
private ListView contactsList;
@@ -62,39 +65,40 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mInflater = inflater;
View view = inflater.inflate(R.layout.create_chat, container, false);
- contactsSelected = new ArrayList();
+ contactsSelected = new ArrayList<>();
- noSipContact = (TextView) view.findViewById(R.id.noSipContact);
- noContact = (TextView) view.findViewById(R.id.noContact);
+ noSipContact = view.findViewById(R.id.noSipContact);
+ noContact = view.findViewById(R.id.noContact);
- contactsList = (ListView) view.findViewById(R.id.contactsList);
- contactsSelectedLayout = (LinearLayout) view.findViewById(R.id.contactsSelected);
- contactsSelectLayout = (HorizontalScrollView) view.findViewById(R.id.layoutContactsSelected);
+ contactsList = view.findViewById(R.id.contactsList);
+ contactsSelectedLayout = view.findViewById(R.id.contactsSelected);
+ contactsSelectLayout = view.findViewById(R.id.layoutContactsSelected);
- allContacts = (ImageView) view.findViewById(R.id.all_contacts);
+ allContacts = view.findViewById(R.id.all_contacts);
allContacts.setOnClickListener(this);
- linphoneContacts = (ImageView) view.findViewById(R.id.linphone_contacts);
+ linphoneContacts = view.findViewById(R.id.linphone_contacts);
linphoneContacts.setOnClickListener(this);
allContactsSelected = view.findViewById(R.id.all_contacts_select);
linphoneContactsSelected = view.findViewById(R.id.linphone_contacts_select);
- back = (ImageView) view.findViewById(R.id.back);
+ back = view.findViewById(R.id.back);
back.setOnClickListener(this);
- next = (ImageView) view.findViewById(R.id.next);
+ next = view.findViewById(R.id.next);
next.setOnClickListener(this);
+ next.setEnabled(false);
- clearSearchField = (ImageView) view.findViewById(R.id.clearSearchField);
+ clearSearchField = view.findViewById(R.id.clearSearchField);
clearSearchField.setOnClickListener(this);
- contactsFetchInProgress = (ProgressBar) view.findViewById(R.id.contactsFetchInProgress);
+ contactsFetchInProgress = view.findViewById(R.id.contactsFetchInProgress);
contactsFetchInProgress.setVisibility(View.VISIBLE);
searchAdapter = new SearchContactsListAdapter(null, mInflater, contactsFetchInProgress);
- searchField = (EditText) view.findViewById(R.id.searchField);
+ searchField = view.findViewById(R.id.searchField);
searchField.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
@@ -102,8 +106,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
}
@Override
- public void beforeTextChanged(CharSequence s, int start, int count,
- int after) {
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@@ -157,9 +160,9 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
if (contactsSelected.size() > 0) {
contactsSelectLayout.setVisibility(View.VISIBLE);
contactsSelectLayout.invalidate();
- next.setImageResource(R.drawable.next);
+ next.setEnabled(true);
} else {
- next.setImageResource(R.drawable.dialer_alt_next);
+ next.setEnabled(false);
contactsSelectLayout.setVisibility(View.GONE);
}
}
@@ -174,14 +177,16 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
private void updateContactsClick(ContactAddress ca, List caSelectedList) {
ca.setSelect((getIndexOfCa(ca, caSelectedList) == -1));
- if(ca.isSelect()) {
+ if (ca.isSelect()) {
ContactSelectView csv = new ContactSelectView(LinphoneActivity.instance());
csv.setListener(this);
csv.setContactName(ca);
contactsSelected.add(ca);
View viewContact = LayoutInflater.from(LinphoneActivity.instance()).inflate(R.layout.contact_selected, null);
((TextView)viewContact.findViewById(R.id.sipUri)).setText(ca.getContact().getFullName());
- viewContact.findViewById(R.id.contactChatDelete).setOnClickListener(this);
+ View removeContact = viewContact.findViewById(R.id.contactChatDelete);
+ removeContact.setTag(ca);
+ removeContact.setOnClickListener(this);
viewContact.setOnClickListener(this);
ca.setView(viewContact);
contactsSelectedLayout.addView(viewContact);
@@ -197,13 +202,10 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
contactsSelectedLayout.invalidate();
}
- private void removeContactFromView(View v) {
- for (ContactAddress ca : contactsSelected) {
- if (ca.getView() == v) {
- ca.setSelect(false);
- updateContactsClick(ca, searchAdapter.getContactsSelectedList());
- }
- }
+ private void removeContactFromSelection(ContactAddress ca) {
+ updateContactsClick(ca, searchAdapter.getContactsSelectedList());
+ updateList();
+ updateListSelected();
}
@Override
@@ -250,9 +252,9 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
} else if (id == R.id.clearSearchField) {
searchField.setText("");
searchAdapter.searchContacts("", contactsList);
- } else if (id == R.id.deleteContact) {
- //TODO
- removeContactFromView(view);
+ } else if (id == R.id.contactChatDelete) {
+ ContactAddress ca = (ContactAddress) view.getTag();
+ removeContactFromSelection(ca);
}
}
@@ -260,9 +262,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
public void onItemClick(AdapterView> adapterView, View view, int i, long l) {
// Get contact
ContactAddress ca = searchAdapter.getContacts().get(i);
- updateContactsClick(ca, searchAdapter.getContactsSelectedList());
- updateList();
- updateListSelected();
+ removeContactFromSelection(ca);
}
@Override
diff --git a/src/android/org/linphone/ChatFragment.java b/src/android/org/linphone/chat/ChatFragment.java
similarity index 99%
rename from src/android/org/linphone/ChatFragment.java
rename to src/android/org/linphone/chat/ChatFragment.java
index 1097869e9..e234d9874 100644
--- a/src/android/org/linphone/ChatFragment.java
+++ b/src/android/org/linphone/chat/ChatFragment.java
@@ -1,4 +1,4 @@
-package org.linphone;
+package org.linphone.chat;
/*
ChatFragment.java
@@ -76,6 +76,15 @@ import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
+import org.linphone.ContactsManager;
+import org.linphone.ContactsUpdatedListener;
+import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneContact;
+import org.linphone.LinphoneManager;
+import org.linphone.LinphoneService;
+import org.linphone.LinphoneUtils;
+import org.linphone.R;
+import org.linphone.SearchContactsListAdapter;
import org.linphone.compatibility.Compatibility;
import org.linphone.core.Address;
import org.linphone.core.Buffer;
diff --git a/src/android/org/linphone/ChatGroupCreationFragment.java b/src/android/org/linphone/chat/ChatGroupCreationFragment.java
similarity index 97%
rename from src/android/org/linphone/ChatGroupCreationFragment.java
rename to src/android/org/linphone/chat/ChatGroupCreationFragment.java
index a05beb909..ca36a29c8 100644
--- a/src/android/org/linphone/ChatGroupCreationFragment.java
+++ b/src/android/org/linphone/chat/ChatGroupCreationFragment.java
@@ -1,4 +1,4 @@
-package org.linphone;
+package org.linphone.chat;
/*
ChatGroupCreationFragment.java
diff --git a/src/android/org/linphone/ChatListFragment.java b/src/android/org/linphone/chat/ChatListFragment.java
similarity index 97%
rename from src/android/org/linphone/ChatListFragment.java
rename to src/android/org/linphone/chat/ChatListFragment.java
index abb764964..47c611e31 100644
--- a/src/android/org/linphone/ChatListFragment.java
+++ b/src/android/org/linphone/chat/ChatListFragment.java
@@ -1,4 +1,4 @@
-package org.linphone;
+package org.linphone.chat;
/*
ChatListFragment.java
@@ -43,14 +43,20 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
+import org.linphone.ContactsManager;
+import org.linphone.ContactsUpdatedListener;
+import org.linphone.FragmentsAvailable;
+import org.linphone.LinphoneActivity;
+import org.linphone.LinphoneContact;
+import org.linphone.LinphoneManager;
+import org.linphone.LinphoneUtils;
+import org.linphone.R;
import org.linphone.core.Address;
import org.linphone.core.ChatMessage;
import org.linphone.core.ChatRoom;
import org.linphone.core.Core;
-import org.linphone.core.CoreException;
import org.linphone.core.Factory;
import org.linphone.core.CoreListenerStub;
-import org.linphone.mediastream.Log;
import java.util.List;