Fix layout for SIP addresses in contact editor + fix native contacts with friends being duplicated in UI

This commit is contained in:
Sylvain Berfini 2016-07-21 10:49:48 +02:00
parent 3244418765
commit ed8734f55d
4 changed files with 21 additions and 12 deletions

View file

@ -94,9 +94,9 @@
android:textColor="@color/colorB"
android:imeOptions="flagNoExtractUi"
android:textCursorDrawable="@null"
android:inputType="textMultiLine"
android:inputType="textShortMessage|textMultiLine"
android:contentDescription="@string/content_description_message"
android:maxLines="3"
android:maxLines="2"
android:padding="5dp"
android:layout_margin="5dp"
android:layout_weight="1"

View file

@ -61,6 +61,7 @@ import android.os.Parcelable;
import android.provider.MediaStore;
import android.support.v4.content.CursorLoader;
import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher;
import android.view.ContextMenu;
import android.view.Gravity;
@ -183,7 +184,6 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
initNewChatConversation();
}
//Manage multiline
message = (EditText) view.findViewById(R.id.message);
sendImage = (ImageView) view.findViewById(R.id.send_picture);

View file

@ -512,7 +512,9 @@ public class ContactEditorFragment extends Fragment {
final View view = inflater.inflate(R.layout.contact_edit_row, null);
final EditText noa = (EditText) view.findViewById(R.id.numoraddr);
noa.setInputType(isSIP ? InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS : InputType.TYPE_CLASS_PHONE);
if (!isSIP) {
noa.setInputType(InputType.TYPE_CLASS_PHONE);
}
noa.setText(numberOrAddress);
noa.addTextChangedListener(new TextWatcher() {
@Override
@ -558,7 +560,9 @@ public class ContactEditorFragment extends Fragment {
final EditText noa = (EditText) view.findViewById(R.id.numoraddr);
numbersAndAddresses.add(nounoa);
noa.setHint(isSip ? getString(R.string.sip_address) : getString(R.string.phone_number));
noa.setInputType(isSip ? InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS : InputType.TYPE_CLASS_PHONE);
if (!isSip) {
noa.setInputType(InputType.TYPE_CLASS_PHONE);
}
noa.requestFocus();
noa.addTextChangedListener(new TextWatcher() {
@Override

View file

@ -250,20 +250,25 @@ public class ContactsManager extends ContentObserver {
boolean found = false;
for (LinphoneContact contact : contacts) {
if (refkey.equals(contact.getAndroidId())) {
// Native matching contact found, link the friend to it
contact.setFriend(friend);
found = true;
break;
}
}
if (!found && hasContactAccess) {
// If refkey != null but there isn't a native contact with this value, then this contact has been deleted. Let's do the same with the LinphoneFriend
if (!found) {
if (hasContactAccess) {
// If refkey != null and hasContactAccess but there isn't a native contact with this value, then this contact has been deleted. Let's do the same with the LinphoneFriend
LinphoneManager.getLc().removeFriend(friend);
} else {
// Refkey not null but no contact access => can't link it to native contact so display it on is own
LinphoneContact contact = new LinphoneContact();
contact.setFriend(friend);
contacts.add(contact);
}
}
} else {
// No refkey so it's a standalone contact
LinphoneContact contact = new LinphoneContact();
contact.setFriend(friend);
contacts.add(contact);