mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
conflict merged and errors fixed
This commit is contained in:
parent
afdfc7f55d
commit
71b9fc18e9
23 changed files with 4253 additions and 557 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -28,7 +28,6 @@ proguard-project.txt
|
|||
project.properties
|
||||
res/.DS_Store
|
||||
res/raw/lpconfig.xsd
|
||||
res/raw/rootca.pem
|
||||
submodules/externals/build/cunit/CUnit/
|
||||
submodules/externals/build/ffmpeg/arm/
|
||||
submodules/externals/build/ffmpeg/x86
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@
|
|||
|
||||
<RelativeLayout
|
||||
android:id="@+id/active_call"
|
||||
android:background="@color/colorA"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/calls_list"
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
android:layout_centerHorizontal="true"
|
||||
android:background="@color/colorD">
|
||||
|
||||
<RelativeLayout
|
||||
<LinearLayout
|
||||
android:id="@+id/message_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
|
@ -116,7 +116,7 @@
|
|||
android:background="@drawable/resizable_textfield"
|
||||
android:layout_centerVertical="true"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/layout"
|
||||
android:id="@+id/separator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/separator"
|
||||
android:id="@+id/separatorText"
|
||||
style="@style/font8"
|
||||
android:textStyle="bold"
|
||||
android:background="@color/colorA"
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/sip_addresse"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
|
|
@ -154,6 +155,7 @@
|
|||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/phone_numbers"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
|
|
|
|||
3931
res/raw/rootca.pem
Normal file
3931
res/raw/rootca.pem
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -509,7 +509,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
confsize = LinphoneManager.getLc().getConferenceSize() - (LinphoneManager.getLc().isInConference() ? 1 : 0);
|
||||
}
|
||||
|
||||
//Enabled transfer button
|
||||
/* //Enabled transfer button
|
||||
if(isTransferAllowed)
|
||||
enabledTransferButton(true);
|
||||
|
||||
|
|
@ -519,7 +519,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
} else {
|
||||
enabledConferenceButton(false);
|
||||
}
|
||||
|
||||
*/
|
||||
refreshInCallActions();
|
||||
refreshCallList(getResources());
|
||||
enableAndRefreshInCallActions();
|
||||
|
|
@ -534,10 +534,10 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
video.setImageResource(R.drawable.camera);
|
||||
videoProgress.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
video.setImageResource(R.drawable.camera_button);
|
||||
video.setImageResource(R.drawable.camera_default);
|
||||
}
|
||||
} else {
|
||||
video.setImageResource(R.drawable.camera_button);
|
||||
video.setImageResource(R.drawable.camera_default);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -581,7 +581,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
}
|
||||
|
||||
//Enabled transfer button
|
||||
if(isTransferAllowed && !LinphoneManager.getLc().soundResourcesLocked())
|
||||
/* if(isTransferAllowed && !LinphoneManager.getLc().soundResourcesLocked())
|
||||
enabledTransferButton(true);
|
||||
|
||||
//Enable conference button
|
||||
|
|
@ -590,7 +590,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
} else {
|
||||
enabledConferenceButton(false);
|
||||
}
|
||||
|
||||
*/
|
||||
addCall.setEnabled(LinphoneManager.getLc().getCallsNb() < LinphoneManager.getLc().getMaxCalls() && !LinphoneManager.getLc().soundResourcesLocked());
|
||||
options.setEnabled(!getResources().getBoolean(R.bool.disable_options_in_call) && (addCall.isEnabled() || transfer.isEnabled()));
|
||||
|
||||
|
|
@ -611,7 +611,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
transfer.setEnabled(true);
|
||||
pause.setEnabled(true);
|
||||
dialer.setEnabled(true);
|
||||
enabledConferenceButton(true);
|
||||
// enabledConferenceButton(true);
|
||||
}
|
||||
|
||||
public void updateStatusFragment(StatusFragment statusFragment) {
|
||||
|
|
@ -710,6 +710,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
private void enabledVideoButton(boolean enabled){
|
||||
if(enabled) {
|
||||
video.setEnabled(true);
|
||||
video.setAlpha(1f);
|
||||
} else {
|
||||
video.setEnabled(false);
|
||||
video.setAlpha(0.2f);
|
||||
|
|
@ -1368,6 +1369,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
status.getView().setVisibility(View.VISIBLE);
|
||||
}
|
||||
findViewById(R.id.status).setVisibility(View.VISIBLE);
|
||||
//TODO
|
||||
//findViewById(R.id.fragmentContainer).setPadding(0, LinphoneUtils.pixelsToDpi(getResources(), 40), 0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -1575,12 +1577,12 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
}
|
||||
|
||||
private void setContactInformation(TextView contactName, ImageView contactPicture, LinphoneAddress lAddress) {
|
||||
Contact lContact = ContactsManager.getInstance().findContactWithAddress(contactName.getContext().getContentResolver(), lAddress);
|
||||
LinphoneContact lContact = ContactsManager.getInstance().findContactFromAddress(lAddress); //findContactWithAddress(contactName.getContext().getContentResolver(), lAddress);
|
||||
if (lContact == null) {
|
||||
contactName.setText(LinphoneUtils.getAddressDisplayName(lAddress));
|
||||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
} else {
|
||||
contactName.setText(lContact.getName());
|
||||
contactName.setText(lContact.getFullName());
|
||||
LinphoneUtils.setImagePictureFromUri(contactPicture.getContext(), contactPicture, lContact.getPhotoUri(), lContact.getThumbnailUri());
|
||||
}
|
||||
}
|
||||
|
|
@ -1720,7 +1722,7 @@ public class CallActivity extends Activity implements OnClickListener, SensorEve
|
|||
public void pauseOrResumeConference() {
|
||||
LinphoneCore lc = LinphoneManager.getLc();
|
||||
if (lc.isInConference()) {
|
||||
conferenceStatus.setImageResource(R.drawable.pause_big_over_selected);
|
||||
conferenceStatus.setImageResource(R.drawable.pause_big_over);
|
||||
lc.leaveConference();
|
||||
} else {
|
||||
conferenceStatus.setImageResource(R.drawable.pause_big_default);
|
||||
|
|
|
|||
|
|
@ -236,14 +236,15 @@ public class CallIncomingActivity extends Activity implements LinphoneSliderTrig
|
|||
return;
|
||||
}
|
||||
LinphoneAddress address = mCall.getRemoteAddress();
|
||||
Contact contact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), address);
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); //)findContactWithAddress(getContentResolver(), address);
|
||||
if (contact != null) {
|
||||
LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
name.setText(contact.getName());
|
||||
} else {
|
||||
name.setText(contact.getFullName());
|
||||
}
|
||||
/* else {
|
||||
name.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
}
|
||||
number.setText(address.asStringUriOnly());
|
||||
*/number.setText(address.asStringUriOnly());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -150,13 +150,14 @@ public class CallOutgoingActivity extends Activity implements OnClickListener{
|
|||
}
|
||||
|
||||
LinphoneAddress address = mCall.getRemoteAddress();
|
||||
Contact contact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), address);
|
||||
//Contact contact = ContactsManager.getInstance().findContactWithAddress(getContentResolver(), address);
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address);
|
||||
if (contact != null) {
|
||||
LinphoneUtils.setImagePictureFromUri(this, contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
name.setText(contact.getName());
|
||||
} else {
|
||||
name.setText(contact.getFullName());
|
||||
} /*else {
|
||||
name.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
}
|
||||
}*/
|
||||
number.setText(address.asStringUriOnly());
|
||||
Log.w(address.asStringUriOnly());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,11 +58,11 @@ public class CallVideoFragment extends Fragment implements OnGestureListener, On
|
|||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view;
|
||||
if (LinphoneManager.getLc().hasCrappyOpenGL()) {
|
||||
/* if (LinphoneManager.getLc().hasCrappyOpenGL()) {
|
||||
view = inflater.inflate(R.layout.video_no_opengl, container, false);
|
||||
} else {
|
||||
view = inflater.inflate(R.layout.video, container, false);
|
||||
}
|
||||
*/ view = inflater.inflate(R.layout.video, container, false);
|
||||
//}
|
||||
|
||||
mVideoView = (SurfaceView) view.findViewById(R.id.videoSurface);
|
||||
mCaptureView = (SurfaceView) view.findViewById(R.id.videoCaptureSurface);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
resultContactsSearch = (ListView) view.findViewById(R.id.result_contacts);
|
||||
|
||||
editList = (LinearLayout) view.findViewById(R.id.edit_list);
|
||||
textLayout = (LinearLayout) view.findViewById(R.id.message_layout);
|
||||
topBar = (LinearLayout) view.findViewById(R.id.top_bar);
|
||||
|
||||
sendMessage = (ImageView) view.findViewById(R.id.send_message);
|
||||
|
|
@ -391,7 +390,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
registerForContextMenu(v);
|
||||
RelativeLayout rlayout = new RelativeLayout(context);
|
||||
|
||||
CheckBox deleteChatBubble = (CheckBox) v.findViewById(R.id.delete_message);
|
||||
CheckBox deleteChatBubble = (CheckBox) v.findViewById(R.id.delete);
|
||||
|
||||
if(isEditMode) {
|
||||
deleteChatBubble.setVisibility(View.VISIBLE);
|
||||
|
|
@ -401,7 +400,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
layoutParams.setMargins(100, 10, 10, 10);
|
||||
v.setLayoutParams(layoutParams);
|
||||
} else {
|
||||
LinearLayout message_layout = (LinearLayout) v.findViewById(R.id.message_content);
|
||||
LinearLayout message_layout = (LinearLayout) v.findViewById(R.id.message_layout);
|
||||
message_layout.setGravity(Gravity.RIGHT);
|
||||
}
|
||||
|
||||
|
|
@ -489,7 +488,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
private void displayChatHeader(LinphoneAddress address) {
|
||||
if(contact != null) {
|
||||
contactName.setText(contact.getName());
|
||||
contactName.setText(contact.getFullName());
|
||||
} else if(address != null){
|
||||
contactName.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
}
|
||||
|
|
@ -1012,16 +1011,16 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
List<LinphoneFriend> result = new ArrayList<LinphoneFriend>();
|
||||
if(search != null) {
|
||||
/* if(search != null) {
|
||||
for (ContactAddress c : searchAdapter.contacts) {
|
||||
String address = c.address;
|
||||
if(address.startsWith("sip:")) address = address.substring(4);
|
||||
if (c.contact.getName().toLowerCase().startsWith(search.toLowerCase()) || address.toLowerCase().startsWith(search.toLowerCase())) {
|
||||
if (c.contact.getFullName().toLowerCase().startsWith(search.toLowerCase()) || address.toLowerCase().startsWith(search.toLowerCase())) {
|
||||
result.add(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
resultContactsSearch.setAdapter(new SearchContactsListAdapter(result));
|
||||
searchAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
|
@ -1032,21 +1031,21 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
|
||||
SearchContactsListAdapter(List<LinphoneFriend> contactsList) {
|
||||
mInflater = inflater;
|
||||
if(contactsList == null){
|
||||
/* if(contactsList == null){
|
||||
contacts = getContactsList();
|
||||
} else {
|
||||
contacts = contactsList;
|
||||
}
|
||||
*/ contacts = contactsList;
|
||||
// }
|
||||
}
|
||||
|
||||
public List<ContactAddress>getContactsList(){
|
||||
List<ContactAddress> list = new ArrayList<ContactAddress>();
|
||||
for(Contact con: ContactsManager.getInstance().getAllContacts()){
|
||||
/*for(Contact con: ContactsManager.getInstance().getAllContacts()){
|
||||
for(String numberOrAddress : con.getNumbersOrAddresses()){
|
||||
list.add(new ContactAddress(con, numberOrAddress));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
*/return list;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
|
|
@ -1054,12 +1053,12 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
public LinphoneFriend getItem(int position) {
|
||||
if (contacts == null || position >= contacts.size()) {
|
||||
/* if (contacts == null || position >= contacts.size()) {
|
||||
contacts = getContactsList();
|
||||
return contacts.get(position);
|
||||
} else {
|
||||
return contacts.get(position);
|
||||
}
|
||||
*/ return contacts.get(position);
|
||||
// }
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
|
|
@ -1079,18 +1078,19 @@ 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;
|
||||
final String a = contact.getFullName();
|
||||
final LinphoneContact c = contact;
|
||||
|
||||
TextView name = (TextView) view.findViewById(R.id.contact_name);
|
||||
name.setText(c.getName());
|
||||
name.setText(c.getFullName());
|
||||
|
||||
final LinphoneAddress laddress = f.getAddress();
|
||||
|
||||
view.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
exitNewConversationMode(c, a, null);
|
||||
//exitNewConversationMode(c, a, null);
|
||||
exitNewConversationMode(laddress.toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -358,7 +358,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
return view;
|
||||
}
|
||||
|
||||
Contact contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), address);
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(address); //findContactWithAddress(getActivity().getContentResolver(), address);
|
||||
String message = "";
|
||||
Long time;
|
||||
|
||||
|
|
@ -391,7 +391,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
|||
}
|
||||
|
||||
displayName.setSelected(true); // For animation
|
||||
displayName.setText(contact == null ? LinphoneUtils.getAddressDisplayName(address) : contact.getName());
|
||||
displayName.setText(contact == null ? LinphoneUtils.getAddressDisplayName(address) : contact.getFullName());
|
||||
|
||||
|
||||
/*if(contact != null){
|
||||
|
|
|
|||
|
|
@ -17,17 +17,12 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
|
@ -43,7 +38,7 @@ import android.widget.TextView;
|
|||
*/
|
||||
public class ContactDetailsFragment extends Fragment implements OnClickListener {
|
||||
private LinphoneContact contact;
|
||||
private ImageView back;
|
||||
private ImageView editContact, deleteContact, back;
|
||||
private LayoutInflater inflater;
|
||||
private View view;
|
||||
private boolean displayChatAddressOnly = false;
|
||||
|
|
@ -66,7 +61,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
} else {
|
||||
to = v.getTag().toString();
|
||||
}
|
||||
LinphoneActivity.instance().setAddresGoToDialerAndCall(to, contact.getName(), contact.getPhotoUri());
|
||||
LinphoneActivity.instance().setAddresGoToDialerAndCall(to, contact.getFullName(), contact.getPhotoUri());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -90,6 +85,12 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
if (getArguments() != null) {
|
||||
displayChatAddressOnly = getArguments().getBoolean("ChatAddressOnly");
|
||||
}
|
||||
|
||||
// editContact = (ImageView) view.findViewById(R.id.editContact);
|
||||
// editContact.setOnClickListener(this);
|
||||
|
||||
// deleteContact = (ImageView) view.findViewById(R.id.deleteContact);
|
||||
// deleteContact.setOnClickListener(this);
|
||||
|
||||
back = (ImageView) view.findViewById(R.id.back);
|
||||
if(getResources().getBoolean(R.bool.isTablet)){
|
||||
|
|
@ -103,48 +104,48 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
|
||||
public void changeDisplayedContact(LinphoneContact newContact) {
|
||||
contact = newContact;
|
||||
contact.refresh(getActivity().getContentResolver());
|
||||
displayContact(inflater, view);
|
||||
}
|
||||
|
||||
@SuppressLint("InflateParams")
|
||||
private void displayContact(LayoutInflater inflater, View view) {
|
||||
ImageView contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
if (contact.getPhotoUri() != null) {
|
||||
InputStream input = Compatibility.getContactPictureInputStream(LinphoneActivity.instance().getContentResolver(), contact.getID());
|
||||
contactPicture.setImageBitmap(BitmapFactory.decodeStream(input));
|
||||
if (contact.hasPhoto()) {
|
||||
LinphoneUtils.setImagePictureFromUri(getActivity(), contactPicture, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
} else {
|
||||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
}
|
||||
|
||||
|
||||
TextView contactName = (TextView) view.findViewById(R.id.contact_name);
|
||||
contactName.setText(contact.getFullName());
|
||||
|
||||
|
||||
TableLayout controls = (TableLayout) view.findViewById(R.id.controls);
|
||||
controls.removeAllViews();
|
||||
for (String numberOrAddress : contact.getNumbersOrAddresses()) {
|
||||
for (LinphoneNumberOrAddress noa : contact.getNumbersOrAddresses()) {
|
||||
boolean skip = false;
|
||||
View v = inflater.inflate(R.layout.contact_control_row, null);
|
||||
|
||||
String displayednumberOrAddress = numberOrAddress;
|
||||
if (numberOrAddress.startsWith("sip:")) {
|
||||
String displayednumberOrAddress = noa.getValue();
|
||||
if (displayednumberOrAddress.startsWith("sip:")) {
|
||||
displayednumberOrAddress = displayednumberOrAddress.replace("sip:", "");
|
||||
}
|
||||
|
||||
TextView label = (TextView) v.findViewById(R.id.address_label);
|
||||
if(LinphoneUtils.isSipAddress(numberOrAddress)) {
|
||||
/* TextView label = (TextView) v.findViewById(R.id.address_label);
|
||||
if (noa.isSIPAddress()) {
|
||||
label.setText(R.string.sip_address);
|
||||
skip |= getResources().getBoolean(R.bool.hide_contact_sip_addresses);
|
||||
} else {
|
||||
label.setText(R.string.phone_number);
|
||||
skip |= getResources().getBoolean(R.bool.hide_contact_phone_numbers);
|
||||
}
|
||||
|
||||
*/
|
||||
TextView tv = (TextView) v.findViewById(R.id.numeroOrAddress);
|
||||
tv.setText(contact.getLinphoneAddress());
|
||||
|
||||
String displayednumberOrAddress = contact.getLinphoneAddress();
|
||||
|
||||
tv.setText(displayednumberOrAddress);
|
||||
tv.setSelected(true);
|
||||
|
||||
if (!displayChatAddressOnly) {
|
||||
v.findViewById(R.id.contact_call).setOnClickListener(dialListener);
|
||||
v.findViewById(R.id.contact_call).setTag(contact.getLinphoneAddress());
|
||||
v.findViewById(R.id.contact_call).setTag(displayednumberOrAddress);
|
||||
} else {
|
||||
v.findViewById(R.id.contact_call).setVisibility(View.GONE);
|
||||
}
|
||||
|
|
@ -153,20 +154,19 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
LinphoneProxyConfig lpc = LinphoneManager.getLc().getDefaultProxyConfig();
|
||||
if (lpc != null) {
|
||||
displayednumberOrAddress = lpc.normalizePhoneNumber(displayednumberOrAddress);
|
||||
if (!displayednumberOrAddress.startsWith("sip:")) {
|
||||
numberOrAddress = "sip:" + displayednumberOrAddress;
|
||||
String tag = noa.getValue();
|
||||
if (!tag.startsWith("sip:")) {
|
||||
tag = "sip:" + tag;
|
||||
}
|
||||
|
||||
String tag = numberOrAddress;
|
||||
if (!numberOrAddress.contains("@")) {
|
||||
tag = numberOrAddress + "@" + lpc.getDomain();
|
||||
if (!tag.contains("@")) {
|
||||
tag = tag + "@" + lpc.getDomain();
|
||||
}
|
||||
v.findViewById(R.id.contact_chat).setTag(tag);
|
||||
} else {
|
||||
v.findViewById(R.id.contact_chat).setTag(numberOrAddress);
|
||||
v.findViewById(R.id.contact_chat).setTag(noa.getValue());
|
||||
}
|
||||
|
||||
final String finalNumberOrAddress = numberOrAddress;
|
||||
/*ImageView friend = (ImageView) v.findViewById(R.id.addFriend);
|
||||
if (getResources().getBoolean(R.bool.enable_linphone_friends) && !displayChatAddressOnly) {
|
||||
friend.setVisibility(View.VISIBLE);
|
||||
|
|
@ -180,23 +180,23 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
if (ContactsManager.getInstance().createNewFriend(contact, finalNumberOrAddress)) {
|
||||
displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
friend.setImageResource(R.drawable.delete);
|
||||
friend.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (ContactsManager.getInstance().removeFriend(finalNumberOrAddress)) {
|
||||
displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
friend.setImageResource(R.drawable.delete);
|
||||
friend.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (ContactsManager.getInstance().removeFriend(finalNumberOrAddress)) {
|
||||
displayContact(ContactFragment.this.inflater, ContactFragment.this.view);
|
||||
}
|
||||
});
|
||||
}
|
||||
}*/
|
||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||
v.findViewById(R.id.contact_chat).setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
if (getResources().getBoolean(R.bool.disable_chat)) {
|
||||
v.findViewById(R.id.contact_chat).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
|
|
@ -213,8 +213,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
LinphoneActivity.instance().selectMenu(FragmentsAvailable.CONTACT_DETAIL);
|
||||
LinphoneActivity.instance().hideTabBar(false);
|
||||
}
|
||||
contact.refresh(getActivity().getContentResolver());
|
||||
if (contact.getName() == null || contact.getName().equals("")) {
|
||||
if (contact.getFullName() == null || contact.getFullName().equals("")) {
|
||||
//Contact has been deleted, return
|
||||
LinphoneActivity.instance().displayContacts(false);
|
||||
} else {
|
||||
|
|
@ -227,7 +226,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
if (id == R.id.editContact) {
|
||||
/* if (id == R.id.editContact) {
|
||||
LinphoneActivity.instance().editContact(contact);
|
||||
}
|
||||
if (id == R.id.deleteContact) {
|
||||
|
|
@ -238,8 +237,7 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
delete.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
deleteExistingContact();
|
||||
ContactsManager.getInstance().removeContactFromLists(getActivity().getContentResolver(), contact);
|
||||
contact.delete();
|
||||
LinphoneActivity.instance().displayContacts(false);
|
||||
dialog.dismiss();
|
||||
}
|
||||
|
|
@ -250,8 +248,13 @@ public class ContactDetailsFragment extends Fragment implements OnClickListener
|
|||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
|
||||
if (id == R.id.back) {
|
||||
LinphoneActivity.instance().displayContacts(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
}
|
||||
if (id == R.id.back) {
|
||||
LinphoneActivity.instance().displayContacts(false);
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ public class ContactEditorFragment extends Fragment {
|
|||
phoneNumbersSection.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
sipAddressesSection = (LinearLayout) view.findViewById(R.id.sip_addresses);
|
||||
sipAddressesSection = (LinearLayout) view.findViewById(R.id.sip_addresse);
|
||||
if (getResources().getBoolean(R.bool.hide_sip_addresses_in_editor)) {
|
||||
sipAddressesSection.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
@ -265,27 +265,27 @@ public class ContactEditorFragment extends Fragment {
|
|||
numbers = initNumbersFields(contact);
|
||||
|
||||
addSipAddress = (ImageView) view.findViewById(R.id.add_address_field);
|
||||
if (getResources().getBoolean(R.bool.allow_only_one_sip_address)) {
|
||||
//if (getResources().getBoolean(R.bool.allow_only_one_sip_address)) {
|
||||
addSipAddress.setVisibility(View.GONE);
|
||||
}
|
||||
/*}
|
||||
addSipAddress.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
addEmptyRowToAllowNewNumberOrAddress(sipAddresses,true);
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
addNumber = (ImageView) view.findViewById(R.id.add_number_field);
|
||||
if (getResources().getBoolean(R.bool.allow_only_one_phone_number)) {
|
||||
// if (getResources().getBoolean(R.bool.allow_only_one_phone_number)) {
|
||||
addNumber.setVisibility(View.GONE);
|
||||
}
|
||||
/* }
|
||||
addNumber.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
addEmptyRowToAllowNewNumberOrAddress(numbers,false);
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
lastName.requestFocus();
|
||||
|
||||
return view;
|
||||
|
|
@ -501,7 +501,7 @@ public class ContactEditorFragment extends Fragment {
|
|||
nounoa.setValue(noa.getText().toString());
|
||||
}
|
||||
|
||||
ImageView delete = (ImageView) view.findViewById(R.id.delete_field);
|
||||
/* ImageView delete = (ImageView) view.findViewById(R.id.delete_field);
|
||||
if ((getResources().getBoolean(R.bool.allow_only_one_phone_number) && !isSip) || (getResources().getBoolean(R.bool.allow_only_one_sip_address) && isSip)) {
|
||||
delete.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
@ -516,6 +516,7 @@ public class ContactEditorFragment extends Fragment {
|
|||
|
||||
}
|
||||
});
|
||||
*/
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
@ -544,7 +545,7 @@ public class ContactEditorFragment extends Fragment {
|
|||
}
|
||||
});
|
||||
|
||||
final ImageView delete = (ImageView) view.findViewById(R.id.delete_field);
|
||||
/*final ImageView delete = (ImageView) view.findViewById(R.id.delete_field);
|
||||
if ((getResources().getBoolean(R.bool.allow_only_one_phone_number) && !isSip) || (getResources().getBoolean(R.bool.allow_only_one_sip_address) && isSip)) {
|
||||
delete.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
@ -555,7 +556,7 @@ public class ContactEditorFragment extends Fragment {
|
|||
view.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
controls.addView(view);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,10 @@ import java.util.List;
|
|||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.PresenceActivityType;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
|
|
@ -38,7 +41,9 @@ import android.widget.AbsListView;
|
|||
import android.widget.AdapterView;
|
||||
import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
|
@ -53,6 +58,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
private LayoutInflater mInflater;
|
||||
private ListView contactsList;
|
||||
private TextView noSipContact, noContact;
|
||||
private ImageView allContacts, linphoneContacts, newContact, edit, selectAll, deselectAll, delete, cancel;
|
||||
private boolean onlyDisplayLinphoneContacts, isEditMode;
|
||||
private View allContactsSelected, linphoneContactsSelected;
|
||||
private LinearLayout editList, topbar;
|
||||
|
|
@ -86,13 +92,44 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
|
||||
noSipContact = (TextView) view.findViewById(R.id.noSipContact);
|
||||
noContact = (TextView) view.findViewById(R.id.noContact);
|
||||
|
||||
|
||||
contactsList = (ListView) view.findViewById(R.id.contactsList);
|
||||
contactsList.setOnItemClickListener(this);
|
||||
|
||||
/* allContacts = (ImageView) view.findViewById(R.id.all_contacts);
|
||||
allContacts.setOnClickListener(this);
|
||||
|
||||
linphoneContacts = (ImageView) 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);
|
||||
|
||||
newContact = (ImageView) view.findViewById(R.id.newContact);
|
||||
newContact.setOnClickListener(this);
|
||||
newContact.setEnabled(LinphoneManager.getLc().getCallsNb() == 0);
|
||||
|
||||
allContacts.setEnabled(onlyDisplayLinphoneContacts);
|
||||
linphoneContacts.setEnabled(!allContacts.isEnabled());
|
||||
|
||||
selectAll = (ImageView) view.findViewById(R.id.select_all);
|
||||
selectAll.setOnClickListener(this);
|
||||
|
||||
deselectAll = (ImageView) view.findViewById(R.id.deselect_all);
|
||||
deselectAll.setOnClickListener(this);
|
||||
|
||||
delete = (ImageView) view.findViewById(R.id.delete);
|
||||
delete.setOnClickListener(this);
|
||||
*/
|
||||
editList = (LinearLayout) view.findViewById(R.id.edit_list);
|
||||
topbar = (LinearLayout) view.findViewById(R.id.top_bar);
|
||||
/*
|
||||
cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||
cancel.setOnClickListener(this);
|
||||
|
||||
edit = (ImageView) view.findViewById(R.id.edit);
|
||||
edit.setOnClickListener(this);
|
||||
*/
|
||||
clearSearchField = (ImageView) view.findViewById(R.id.clearSearchField);
|
||||
clearSearchField.setOnClickListener(this);
|
||||
|
||||
|
|
@ -100,15 +137,15 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
searchField.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start, int count,
|
||||
int after) {
|
||||
|
||||
int after) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
searchContacts(searchField.getText().toString());
|
||||
|
|
@ -132,11 +169,9 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
public void enabledDeleteButton(Boolean enabled){
|
||||
if(enabled){
|
||||
delete.setEnabled(true);
|
||||
delete.setAlpha(1f);
|
||||
} else {
|
||||
if (getNbItemsChecked() == 0){
|
||||
delete.setEnabled(false);
|
||||
delete.setAlpha(0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -145,16 +180,95 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
public void onClick(View v) {
|
||||
int id = v.getId();
|
||||
|
||||
if (id == R.id.select_all) {
|
||||
deselectAll.setVisibility(View.VISIBLE);
|
||||
selectAll.setVisibility(View.GONE);
|
||||
enabledDeleteButton(true);
|
||||
selectAllList(true);
|
||||
return;
|
||||
}
|
||||
if (id == R.id.deselect_all) {
|
||||
deselectAll.setVisibility(View.GONE);
|
||||
selectAll.setVisibility(View.VISIBLE);
|
||||
enabledDeleteButton(false);
|
||||
selectAllList(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == R.id.cancel) {
|
||||
quitEditMode();
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
Button cancel = (Button) dialog.findViewById(R.id.cancel);
|
||||
|
||||
delete.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
removeContacts();
|
||||
dialog.dismiss();
|
||||
quitEditMode();
|
||||
}
|
||||
});
|
||||
|
||||
cancel.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dialog.dismiss();
|
||||
quitEditMode();
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == R.id.edit) {
|
||||
editList.setVisibility(View.VISIBLE);
|
||||
topbar.setVisibility(View.GONE);
|
||||
enabledDeleteButton(false);
|
||||
isEditMode = true;
|
||||
}
|
||||
|
||||
/* if (id == R.id.all_contacts) {
|
||||
onlyDisplayLinphoneContacts = false;
|
||||
allContactsSelected.setVisibility(View.VISIBLE);
|
||||
allContacts.setEnabled(false);
|
||||
linphoneContacts.setEnabled(true);
|
||||
linphoneContactsSelected.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
else if (id == R.id.linphone_contacts) {
|
||||
allContactsSelected.setVisibility(View.INVISIBLE);
|
||||
linphoneContactsSelected.setVisibility(View.VISIBLE);
|
||||
linphoneContacts.setEnabled(false);
|
||||
allContacts.setEnabled(true);
|
||||
onlyDisplayLinphoneContacts = true;
|
||||
|
||||
}
|
||||
*/
|
||||
if(isEditMode){
|
||||
deselectAll.setVisibility(View.GONE);
|
||||
selectAll.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
if (searchField.getText().toString().length() > 0) {
|
||||
searchContacts();
|
||||
} else {
|
||||
changeContactsAdapter();
|
||||
}
|
||||
|
||||
if (id == R.id.clearSearchField) {
|
||||
/* if (id == R.id.newContact) {
|
||||
editConsumed = true;
|
||||
LinphoneActivity.instance().addContact(null, sipAddressToAdd);
|
||||
}
|
||||
else
|
||||
*/
|
||||
if (id == R.id.clearSearchField) {
|
||||
searchField.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void selectAllList(boolean isSelectAll){
|
||||
int size = contactsList.getAdapter().getCount();
|
||||
|
|
@ -210,32 +324,17 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
return;
|
||||
}
|
||||
changeContactsToggle();
|
||||
|
||||
if (searchCursor != null) {
|
||||
searchCursor.close();
|
||||
}
|
||||
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)) {
|
||||
//searchCursor = Compatibility.getSIPContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
//indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
//contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
//contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
} else{
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
searchCursor = Compatibility.getSIPContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
} else {
|
||||
searchCursor = Compatibility.getContactsCursor(getActivity().getContentResolver(), search, ContactsManager.getInstance().getContactsId());
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
indexer = new AlphabetIndexer(searchCursor, Compatibility.getCursorDisplayNameColumnIndex(searchCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setAdapter(new ContactsListAdapter(null, searchCursor));
|
||||
}
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSIPContacts()));
|
||||
} else {
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getContacts()));
|
||||
}
|
||||
}
|
||||
|
||||
private void changeContactsAdapter() {
|
||||
changeContactsToggle();
|
||||
|
||||
noSipContact.setVisibility(View.GONE);
|
||||
noContact.setVisibility(View.GONE);
|
||||
|
|
@ -244,34 +343,29 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
if (onlyDisplayLinphoneContacts) {
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSIPContacts()));
|
||||
edit.setEnabled(true);
|
||||
// edit.setEnabled(true);
|
||||
} else {
|
||||
if (onlyDisplayLinphoneContacts) {
|
||||
if (sipContactsCursor != null && sipContactsCursor.getCount() == 0) {
|
||||
noSipContact.setVisibility(View.VISIBLE);
|
||||
contactsList.setVisibility(View.GONE);
|
||||
edit.setEnabled(false);
|
||||
} else if (sipContactsCursor != null) {
|
||||
indexer = new AlphabetIndexer(sipContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(sipContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getSIPContacts(), sipContactsCursor));
|
||||
edit.setEnabled(true);
|
||||
}
|
||||
} else {
|
||||
if (allContactsCursor != null && allContactsCursor.getCount() == 0) {
|
||||
noContact.setVisibility(View.VISIBLE);
|
||||
contactsList.setVisibility(View.GONE);
|
||||
edit.setEnabled(false);
|
||||
} else if (allContactsCursor != null) {
|
||||
indexer = new AlphabetIndexer(allContactsCursor, Compatibility.getCursorDisplayNameColumnIndex(allContactsCursor), " ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getAllContacts(), allContactsCursor));
|
||||
edit.setEnabled(true);
|
||||
}
|
||||
}
|
||||
contactsList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||
contactsList.setAdapter(new ContactsListAdapter(ContactsManager.getInstance().getContacts()));
|
||||
// edit.setEnabled(true);
|
||||
}
|
||||
ContactsManager.getInstance().setLinphoneContactsPrefered(onlyDisplayLinphoneContacts);
|
||||
}
|
||||
|
||||
private void changeContactsToggle() {
|
||||
/* if (onlyDisplayLinphoneContacts) {
|
||||
allContacts.setEnabled(true);
|
||||
allContactsSelected.setVisibility(View.INVISIBLE);
|
||||
linphoneContacts.setEnabled(false);
|
||||
linphoneContactsSelected.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
allContacts.setEnabled(false);
|
||||
allContactsSelected.setVisibility(View.VISIBLE);
|
||||
linphoneContacts.setEnabled(true);
|
||||
linphoneContactsSelected.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||
|
|
@ -302,7 +396,6 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
onlyDisplayLinphoneContacts = ContactsManager.getInstance().isLinphoneContactsPrefered();
|
||||
}
|
||||
changeContactsToggle();
|
||||
|
||||
invalidate();
|
||||
}
|
||||
|
||||
|
|
@ -352,19 +445,12 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
}
|
||||
|
||||
public int getCount() {
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)) {
|
||||
return LinphoneManager.getLc().getFriendList().length;
|
||||
} else {
|
||||
return cursor.getCount();
|
||||
}
|
||||
return contacts.size();
|
||||
}
|
||||
|
||||
public Object getItem(int position) {
|
||||
if (contacts == null || position >= contacts.size()) {
|
||||
return Compatibility.getContact(getActivity().getContentResolver(), cursor, position);
|
||||
} else {
|
||||
return contacts.get(position);
|
||||
}
|
||||
if (position >= getCount()) return null;
|
||||
return contacts.get(position);
|
||||
}
|
||||
|
||||
public long getItemId(int position) {
|
||||
|
|
@ -389,22 +475,23 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
TextView name = (TextView) view.findViewById(R.id.name);
|
||||
name.setText(contact.getFullName());
|
||||
|
||||
TextView separator = (TextView) view.findViewById(R.id.separator);
|
||||
LinearLayout separator = (LinearLayout) view.findViewById(R.id.separator);
|
||||
TextView separatorText = (TextView) view.findViewById(R.id.separatorText);
|
||||
if (getPositionForSection(getSectionForPosition(position)) != position) {
|
||||
separator.setVisibility(View.GONE);
|
||||
} else {
|
||||
separator.setVisibility(View.VISIBLE);
|
||||
separatorText.setText(String.valueOf(contact.getName().charAt(0)));
|
||||
separatorText.setText(String.valueOf(contact.getFullName().charAt(0)));
|
||||
}
|
||||
|
||||
ImageView icon = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
if (contact.getPhoto() != null) {
|
||||
icon.setImageBitmap(contact.getPhoto());
|
||||
if (contact.hasPhoto()) {
|
||||
LinphoneUtils.setImagePictureFromUri(getActivity(), icon, contact.getPhotoUri(), contact.getThumbnailUri());
|
||||
} else if (contact.getPhotoUri() != null) {
|
||||
icon.setImageURI(contact.getPhotoUri());
|
||||
} else {
|
||||
icon.setImageResource(R.drawable.avatar);
|
||||
}*/
|
||||
}
|
||||
|
||||
if (isEditMode) {
|
||||
delete.setVisibility(View.VISIBLE);
|
||||
|
|
@ -429,7 +516,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
}
|
||||
}
|
||||
});
|
||||
if(contactsList.isItemChecked(position)) {
|
||||
if (contactsList.isItemChecked(position)) {
|
||||
delete.setChecked(true);
|
||||
} else {
|
||||
delete.setChecked(false);
|
||||
|
|
@ -438,7 +525,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
delete.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
/*ImageView friendStatus = (ImageView) view.findViewById(R.id.friendStatus);
|
||||
ImageView friendStatus = (ImageView) view.findViewById(R.id.friendStatus);
|
||||
LinphoneFriend[] friends = LinphoneManager.getLc().getFriendList();
|
||||
if (!ContactsManager.getInstance().isContactPresenceDisabled() && friends != null) {
|
||||
friendStatus.setVisibility(View.VISIBLE);
|
||||
|
|
@ -454,10 +541,11 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
|
|||
} else {
|
||||
friendStatus.setImageResource(R.drawable.call_quality_indicator_0);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getSections() {
|
||||
return sections;
|
||||
|
|
|
|||
|
|
@ -42,24 +42,15 @@ import android.os.Message;
|
|||
import android.provider.ContactsContract;
|
||||
import android.provider.ContactsContract.Data;
|
||||
|
||||
import org.linphone.compatibility.Compatibility;
|
||||
import org.linphone.core.LinphoneAddress;
|
||||
import org.linphone.core.LinphoneCore;
|
||||
import org.linphone.core.LinphoneCoreException;
|
||||
import org.linphone.core.LinphoneCoreFactory;
|
||||
import org.linphone.core.LinphoneFriend;
|
||||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.mediastream.Log;
|
||||
interface ContactsUpdatedListener {
|
||||
void onContactsUpdated();
|
||||
}
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class ContactsManager {
|
||||
public class ContactsManager extends ContentObserver {
|
||||
private static final int CONTACTS_UPDATED = 543;
|
||||
|
||||
private static ContactsManager instance;
|
||||
private List<Contact> contactList, sipContactList;
|
||||
private Cursor contactCursor, sipContactCursor;
|
||||
private List<LinphoneContact> contacts, sipContacts;
|
||||
private Account mAccount;
|
||||
private boolean preferLinphoneContacts = false, isContactPresenceDisabled = true, hasContactAccess = false;
|
||||
private ContentResolver contentResolver;
|
||||
|
|
@ -122,14 +113,17 @@ public class ContactsManager {
|
|||
public synchronized List<LinphoneContact> getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
|
||||
public synchronized List<LinphoneContact> getSIPContacts() {
|
||||
return sipContacts;
|
||||
}
|
||||
public Cursor getAllContactsCursor() {
|
||||
return contactCursor;
|
||||
|
||||
public void enableContactsAccess() {
|
||||
hasContactAccess = true;
|
||||
}
|
||||
|
||||
public boolean hasContactsAccess() {
|
||||
return hasContactAccess && !context.getResources().getBoolean(R.bool.force_use_of_linphone_friends);
|
||||
return hasContactAccess ; //&& !context.getResources().getBoolean(R.bool.force_use_of_linphone_friends);
|
||||
}
|
||||
|
||||
public void setLinphoneContactsPrefered(boolean isPrefered) {
|
||||
|
|
@ -169,199 +163,11 @@ public class ContactsManager {
|
|||
}
|
||||
initializeContactManager(context, contentResolver);
|
||||
}
|
||||
|
||||
public String getDisplayName(String firstName, String lastName) {
|
||||
String displayName = null;
|
||||
if (firstName.length() > 0 && lastName.length() > 0)
|
||||
displayName = firstName + " " + lastName;
|
||||
else if (firstName.length() > 0)
|
||||
displayName = firstName;
|
||||
else if (lastName.length() > 0)
|
||||
displayName = lastName.toString();
|
||||
return displayName;
|
||||
}
|
||||
|
||||
//Contacts
|
||||
public void createNewContact(ArrayList<ContentProviderOperation> ops, String firstName, String lastName) {
|
||||
int contactID = 0;
|
||||
|
||||
ops.add(ContentProviderOperation.newInsert(ContactsContract.RawContacts.CONTENT_URI)
|
||||
.withValue(ContactsContract.RawContacts.AGGREGATION_MODE, ContactsContract.RawContacts.AGGREGATION_MODE_DEFAULT)
|
||||
.withValue(ContactsContract.RawContacts.ACCOUNT_TYPE, null)
|
||||
.withValue(ContactsContract.RawContacts.ACCOUNT_NAME, null)
|
||||
.build()
|
||||
);
|
||||
|
||||
if (getDisplayName(firstName, lastName) != null) {
|
||||
ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
|
||||
.withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, contactID)
|
||||
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
|
||||
.withValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, firstName)
|
||||
.withValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, lastName)
|
||||
.withValue(ContactsContract.CommonDataKinds.StructuredName.DISPLAY_NAME, getDisplayName(firstName, lastName))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateExistingContact(ArrayList<ContentProviderOperation> ops, Contact contact, String firstName, String lastName) {
|
||||
if (getDisplayName(firstName, lastName) != null) {
|
||||
String select = ContactsContract.Data.CONTACT_ID + "=? AND " + ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE + "'";
|
||||
String[] args = new String[]{String.valueOf(contact.getID())};
|
||||
|
||||
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
||||
.withSelection(select, args)
|
||||
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE)
|
||||
.withValue(ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, firstName)
|
||||
.withValue(ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME, lastName)
|
||||
.build()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public void updateExistingContactPicture(ArrayList<ContentProviderOperation> ops, Contact contact, String path){
|
||||
String select = ContactsContract.Data.CONTACT_ID + "=? AND " + ContactsContract.Data.MIMETYPE + "='" + ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE + "'";
|
||||
String[] args =new String[]{String.valueOf(contact.getID())};
|
||||
|
||||
ops.add(ContentProviderOperation.newUpdate(ContactsContract.Data.CONTENT_URI)
|
||||
.withSelection(select, args)
|
||||
.withValue(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE)
|
||||
.withValue(ContactsContract.CommonDataKinds.Photo.PHOTO_FILE_ID, path)
|
||||
//.withValue(ContactsContract.CommonDataKinds.Photo.PHOTO_FILE_ID, )
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
//Manage Linphone Friend if we cannot use Sip address
|
||||
public boolean createNewFriend(Contact contact, String sipUri) {
|
||||
if (!sipUri.startsWith("sip:")) {
|
||||
sipUri = "sip:" + sipUri;
|
||||
}
|
||||
|
||||
LinphoneFriend friend = LinphoneCoreFactory.instance().createLinphoneFriend(sipUri);
|
||||
if (friend != null) {
|
||||
friend.edit();
|
||||
friend.enableSubscribes(false);
|
||||
friend.setRefKey(contact.getID());
|
||||
friend.done();
|
||||
try {
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().addFriend(friend);
|
||||
return true;
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFriend(String oldSipUri, String newSipUri) {
|
||||
if (!newSipUri.startsWith("sip:")) {
|
||||
newSipUri = "sip:" + newSipUri;
|
||||
}
|
||||
|
||||
if (!oldSipUri.startsWith("sip:")) {
|
||||
oldSipUri = "sip:" + oldSipUri;
|
||||
}
|
||||
|
||||
LinphoneFriend friend = LinphoneManager.getLcIfManagerNotDestroyedOrNull().findFriendByAddress(oldSipUri);
|
||||
if (friend != null) {
|
||||
friend.edit();
|
||||
try {
|
||||
friend.setAddress(LinphoneCoreFactory.instance().createLinphoneAddress(newSipUri));
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
friend.done();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeFriend(String sipUri) {
|
||||
if (!sipUri.startsWith("sip:")) {
|
||||
sipUri = "sip:" + sipUri;
|
||||
}
|
||||
|
||||
LinphoneFriend friend = LinphoneManager.getLcIfManagerNotDestroyedOrNull().findFriendByAddress(sipUri);
|
||||
if (friend != null) {
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().removeFriend(friend);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeAllFriends(Contact contact) {
|
||||
for (LinphoneFriend friend : LinphoneManager.getLcIfManagerNotDestroyedOrNull().getFriendList()) {
|
||||
if (friend.getRefKey().equals(contact.getID())) {
|
||||
LinphoneManager.getLcIfManagerNotDestroyedOrNull().removeFriend(friend);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Contact findContactWithDisplayName(String displayName) {
|
||||
String[] projection = {ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME};
|
||||
String selection = new StringBuilder()
|
||||
.append(ContactsContract.Data.DISPLAY_NAME)
|
||||
.append(" = ?").toString();
|
||||
|
||||
Cursor c = contentResolver.query(ContactsContract.Data.CONTENT_URI, projection, selection,
|
||||
new String[]{displayName}, null);
|
||||
if (c != null) {
|
||||
if (c.moveToFirst()) {
|
||||
Contact contact = Compatibility.getContact(contentResolver, c, c.getPosition());
|
||||
c.close();
|
||||
|
||||
if (contact != null) {
|
||||
return contact;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
c.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Contact getContact(String id, ContentResolver contentResolver){
|
||||
String[] projection = {ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME};
|
||||
String selection = new StringBuilder()
|
||||
.append(ContactsContract.Data.CONTACT_ID)
|
||||
.append(" = ?").toString();
|
||||
|
||||
Cursor c = contentResolver.query(ContactsContract.Data.CONTENT_URI, projection, selection, new String[]{id}, null);
|
||||
if(c!=null){
|
||||
if (c.moveToFirst()) {
|
||||
Contact contact = Compatibility.getContact(contentResolver, c, c.getPosition());
|
||||
c.close();
|
||||
|
||||
if (contact != null) {
|
||||
return contact;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
c.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<String> getContactsId(){
|
||||
List<String> ids = new ArrayList<String>();
|
||||
if(LinphoneManager.getLcIfManagerNotDestroyedOrNull().getFriendList() == null) return null;
|
||||
for(LinphoneFriend friend : LinphoneManager.getLcIfManagerNotDestroyedOrNull().getFriendList()) {
|
||||
friend.edit();
|
||||
friend.enableSubscribes(false);
|
||||
friend.done();
|
||||
if(!ids.contains(friend.getRefKey())){
|
||||
ids.add(friend.getRefKey());
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
//End linphone Friend
|
||||
|
||||
public boolean removeContactTagIsNeeded(Contact contact){
|
||||
|
||||
public LinphoneContact findContactFromAddress(LinphoneAddress address) {
|
||||
String sipUri = address.asStringUriOnly();
|
||||
String username = address.getUserName();
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
LinphoneProxyConfig lpc = null;
|
||||
if (lc != null) {
|
||||
|
|
@ -377,57 +183,10 @@ public class ContactsManager {
|
|||
|
||||
if ((noa.isSIPAddress() && noa.getValue().equals(sipUri)) || (normalized != null && !noa.isSIPAddress() && normalized.equals(username)) || (!noa.isSIPAddress() && noa.getValue().equals(username))) {
|
||||
return c;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Contact findContactWithAddress(ContentResolver contentResolver, LinphoneAddress address){
|
||||
String sipUri = address.asStringUriOnly();
|
||||
if (sipUri.startsWith("sip:"))
|
||||
sipUri = sipUri.substring(4);
|
||||
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
if(lc != null && lc.getFriendList() != null && LinphoneManager.getLcIfManagerNotDestroyedOrNull().getFriendList().length > 0) {
|
||||
for (LinphoneFriend friend : LinphoneManager.getLcIfManagerNotDestroyedOrNull().getFriendList()) {
|
||||
if (friend.getAddress().equals(address)) {
|
||||
return getContact(friend.getRefKey(), contentResolver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Find Sip address
|
||||
Contact contact;
|
||||
String [] projection = new String[] {ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME};
|
||||
String selection = new StringBuilder()
|
||||
.append(ContactsContract.CommonDataKinds.SipAddress.SIP_ADDRESS)
|
||||
.append(" = ?").toString();
|
||||
|
||||
Cursor cur = contentResolver.query(ContactsContract.Data.CONTENT_URI, projection, selection,
|
||||
new String[]{sipUri}, null);
|
||||
if (cur != null) {
|
||||
if (cur.moveToFirst()) {
|
||||
contact = Compatibility.getContact(contentResolver, cur, cur.getPosition());
|
||||
cur.close();
|
||||
|
||||
if (contact != null) {
|
||||
return contact;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Find number
|
||||
Uri lookupUri = Uri.withAppendedPath(android.provider.ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(address.getUserName()));
|
||||
projection = new String[] {ContactsContract.PhoneLookup._ID,ContactsContract.PhoneLookup.NUMBER,ContactsContract.PhoneLookup.DISPLAY_NAME };
|
||||
Cursor c = contentResolver.query(lookupUri, projection, null, null, null);
|
||||
contact = checkPhoneQueryResult(contentResolver, c, ContactsContract.PhoneLookup.NUMBER, ContactsContract.PhoneLookup._ID, address.getUserName());
|
||||
|
||||
if (contact != null) {
|
||||
return contact;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public synchronized void setContacts(List<LinphoneContact> c) {
|
||||
|
|
@ -486,75 +245,8 @@ public class ContactsManager {
|
|||
for (LinphoneContact contact : contacts) {
|
||||
contact.refresh();
|
||||
}
|
||||
if (sipContactCursor != null) {
|
||||
sipContactCursor.close();
|
||||
}
|
||||
|
||||
if(LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_friend)){
|
||||
contactList = new ArrayList<Contact>();
|
||||
for(LinphoneFriend friend : LinphoneManager.getLc().getFriendList()){
|
||||
Contact contact = new Contact(friend.getRefKey(),friend.getAddress());
|
||||
contactList.add(contact);
|
||||
}
|
||||
|
||||
contactCursor = getFriendListCursor(contactList,true);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mAccount == null) return;
|
||||
|
||||
contactCursor = Compatibility.getContactsCursor(contentResolver, getContactsId());
|
||||
sipContactCursor = Compatibility.getSIPContactsCursor(contentResolver, getContactsId());
|
||||
|
||||
Thread sipContactsHandler = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(sipContactCursor != null && sipContactCursor.getCount() > 0) {
|
||||
for (int i = 0; i < sipContactCursor.getCount(); i++) {
|
||||
Contact contact = Compatibility.getContact(contentResolver, sipContactCursor, i);
|
||||
if (contact == null)
|
||||
continue;
|
||||
|
||||
contact.refresh(contentResolver);
|
||||
//Add tag to Linphone contact if it not existed
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_tag)) {
|
||||
if (!isContactHasLinphoneTag(contact, contentResolver)) {
|
||||
Compatibility.createLinphoneContactTag(context, contentResolver, contact,
|
||||
findRawContactID(contentResolver, String.valueOf(contact.getID())));
|
||||
}
|
||||
}
|
||||
|
||||
sipContactList.add(contact);
|
||||
}
|
||||
}
|
||||
if (contactCursor != null) {
|
||||
for (int i = 0; i < contactCursor.getCount(); i++) {
|
||||
Contact contact = Compatibility.getContact(contentResolver, contactCursor, i);
|
||||
if (contact == null)
|
||||
continue;
|
||||
|
||||
//Remove linphone contact tag if the contact has no sip address
|
||||
if (LinphoneActivity.isInstanciated() && LinphoneActivity.instance().getResources().getBoolean(R.bool.use_linphone_tag)) {
|
||||
if (removeContactTagIsNeeded(contact) && findRawLinphoneContactID(contact.getID()) != null) {
|
||||
removeLinphoneContactTag(contact);
|
||||
}
|
||||
}
|
||||
for (Contact c : sipContactList) {
|
||||
if (c != null && c.getID().equals(contact.getID())) {
|
||||
contact = c;
|
||||
break;
|
||||
}
|
||||
}
|
||||
contactList.add(contact);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
contactList = new ArrayList<Contact>();
|
||||
sipContactList = new ArrayList<Contact>();
|
||||
|
||||
sipContactsHandler.start();
|
||||
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public static String getAddressOrNumberForAndroidContact(ContentResolver resolver, Uri contactUri) {
|
||||
|
|
@ -607,29 +299,7 @@ public class ContactsManager {
|
|||
Log.e(e);
|
||||
}
|
||||
}
|
||||
|
||||
public Cursor getFriendListCursor(List<Contact> contacts, boolean shouldGroupBy){
|
||||
String[] columns = new String[] { ContactsContract.Data.CONTACT_ID, ContactsContract.Data.DISPLAY_NAME };
|
||||
|
||||
|
||||
if (!shouldGroupBy) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MatrixCursor result = new MatrixCursor(columns);
|
||||
Set<String> groupBy = new HashSet<String>();
|
||||
for (Contact contact: contacts) {
|
||||
String name = contact.getName();
|
||||
if (!groupBy.contains(name)) {
|
||||
groupBy.add(name);
|
||||
Object[] newRow = new Object[2];
|
||||
|
||||
newRow[0] = contact.getID();
|
||||
newRow[1] = contact.getName();
|
||||
|
||||
result.addRow(newRow);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
public String getString(int resourceID) {
|
||||
return context.getString(resourceID);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import org.linphone.core.LinphoneCoreFactory;
|
|||
import org.linphone.core.LinphoneFriend;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Fragment;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
|
|
@ -97,7 +98,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
LinphoneAddress lAddress = null;
|
||||
try {
|
||||
lAddress = LinphoneCoreFactory.instance().createLinphoneAddress(sipUri);
|
||||
Contact contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
||||
/* Contact contact = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), lAddress);
|
||||
|
||||
if (contact != null) {
|
||||
LinphoneUtils.setImagePictureFromUri(view.getContext(),contactPicture,contact.getPhotoUri(),contact.getThumbnailUri());
|
||||
|
|
@ -106,6 +107,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
view.findViewById(R.id.add_contact).setVisibility(View.VISIBLE);
|
||||
}
|
||||
*/
|
||||
} catch (LinphoneCoreException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,21 +431,21 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
|||
holder.callDirection.setImageResource(R.drawable.call_status_outgoing);
|
||||
}
|
||||
|
||||
Contact c = ContactsManager.getInstance().findContactWithAddress(getActivity().getContentResolver(), address);
|
||||
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(address); //findContactWithAddress(getActivity().getContentResolver(), address);
|
||||
String displayName = null;
|
||||
final String sipUri = address.asStringUriOnly();
|
||||
if(c != null){
|
||||
displayName = c.getName();
|
||||
displayName = c.getFullName();
|
||||
LinphoneUtils.setImagePictureFromUri(view.getContext(),holder.contactPicture,c.getPhotoUri(),c.getThumbnailUri());
|
||||
} else {
|
||||
holder.contactPicture.setImageResource(R.drawable.avatar);
|
||||
}
|
||||
|
||||
if(friend != null) {
|
||||
/* if(friend != null) {
|
||||
holder.contact.setText(LinphoneUtils.getAddressDisplayName(friend.getAddress()));
|
||||
} else {
|
||||
holder.contact.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
}
|
||||
*/ holder.contact.setText(LinphoneUtils.getAddressDisplayName(address));
|
||||
// }
|
||||
|
||||
if (isEditMode) {
|
||||
holder.select.setVisibility(View.VISIBLE);
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
private ChatFragment chatFragment;
|
||||
private Fragment.SavedState dialerSavedState;
|
||||
private boolean newProxyConfig;
|
||||
private boolean isAnimationDisabled = false, preferLinphoneContacts = false;
|
||||
private boolean isAnimationDisabled = false, preferLinphoneContacts = false, emptyFragment = false, permissionAsked = false;
|
||||
private OrientationEventListener mOrientationHelper;
|
||||
private LinphoneCoreListenerBase mListener;
|
||||
private LinearLayout mTabBar;
|
||||
|
|
@ -493,9 +493,6 @@ public class LinphoneActivity extends Activity implements OnClickListener, Conta
|
|||
case CHAT:
|
||||
newFragment = new ChatFragment();
|
||||
break;
|
||||
case EMPTY:
|
||||
newFragment = new EmptyFragment();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -693,7 +693,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
|
|||
private void copyAssetsFromPackage() throws IOException {
|
||||
copyIfNotExist(R.raw.oldphone_mono, mRingSoundFile);
|
||||
copyIfNotExist(R.raw.ringback, mRingbackSoundFile);
|
||||
copyIfNotExist(R.raw.hold, mPauseSoundFile);
|
||||
//copyIfNotExist(R.raw.hold, mPauseSoundFile);
|
||||
copyIfNotExist(R.raw.incoming_chat, mErrorToneFile);
|
||||
copyIfNotExist(R.raw.linphonerc_default, mLinphoneConfigFile);
|
||||
copyFromPackage(R.raw.linphonerc_factory, new File(mLinphoneFactoryConfigFile).getName());
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ private static AssistantActivity instance;
|
|||
d.setAlpha(200);
|
||||
progress.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
|
||||
progress.getWindow().setBackgroundDrawable(d);
|
||||
progress.setContentView(R.layout.progress_dialog);
|
||||
progress.setContentView(R.layout.dialog);
|
||||
progress.show();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,17 +54,17 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
|
|||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.tuto_carddav);
|
||||
/* setContentView(R.layout.tuto_carddav);
|
||||
|
||||
username = (EditText) findViewById(R.id.carddav_username);
|
||||
password = (EditText) findViewById(R.id.carddav_pwd);
|
||||
ha1 = (EditText) findViewById(R.id.carddav_ha1);
|
||||
server = (EditText) findViewById(R.id.carddav_server);
|
||||
logs = (TextView) findViewById(R.id.carddav_events);
|
||||
|
||||
|
||||
synchronize = (Button) findViewById(R.id.carddav_synchronize);
|
||||
synchronize.setOnClickListener(this);
|
||||
|
||||
*/
|
||||
LinphoneCoreFactory.instance().setDebugMode(true, "CardDAV sync tutorial");
|
||||
try {
|
||||
lc = LinphoneCoreFactory.instance().createLinphoneCore(this, this);
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ public class BubbleChat implements LinphoneChatMessage.LinphoneChatMessageListen
|
|||
final String sipUri = nativeMessage.getFrom().asStringUriOnly();
|
||||
if(!nativeMessage.isOutgoing()) {
|
||||
if (c != null) {
|
||||
displayName = c.getName();
|
||||
displayName = c.getFullName();
|
||||
LinphoneUtils.setImagePictureFromUri(view.getContext(), contactPicture, c.getPhotoUri(), c.getThumbnailUri());
|
||||
} else {
|
||||
contactPicture.setImageResource(R.drawable.avatar);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue