Fix add contact in dialer
This commit is contained in:
parent
9b4d661b84
commit
96f4e9b0c1
2 changed files with 8 additions and 2 deletions
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.linphone.compatibility.Compatibility;
|
import org.linphone.compatibility.Compatibility;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.ui.AvatarWithShadow;
|
import org.linphone.ui.AvatarWithShadow;
|
||||||
|
|
||||||
|
@ -209,7 +210,7 @@ public class EditContactFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newSipOrNumberToAdd != null) {
|
if (newSipOrNumberToAdd != null) {
|
||||||
View view = displayNumberOrAddress(controls, newSipOrNumberToAdd, true);
|
View view = displayNumberOrAddress(controls, newSipOrNumberToAdd);
|
||||||
if (view != null)
|
if (view != null)
|
||||||
controls.addView(view);
|
controls.addView(view);
|
||||||
}
|
}
|
||||||
|
@ -243,7 +244,8 @@ public class EditContactFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private View displayNumberOrAddress(final TableLayout controls, String numberOrAddress, boolean forceAddNumber) {
|
private View displayNumberOrAddress(final TableLayout controls, String numberOrAddress, boolean forceAddNumber) {
|
||||||
boolean isSip = numberOrAddress.startsWith("sip:");
|
boolean isSip = LinphoneUtils.isStrictSipAddress(numberOrAddress) || !LinphoneUtils.isNumberAddress(numberOrAddress);
|
||||||
|
|
||||||
if (isSip) {
|
if (isSip) {
|
||||||
if (firstSipAddressIndex == -1) {
|
if (firstSipAddressIndex == -1) {
|
||||||
firstSipAddressIndex = controls.getChildCount();
|
firstSipAddressIndex = controls.getChildCount();
|
||||||
|
|
|
@ -86,6 +86,10 @@ public final class LinphoneUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isNumberAddress(String numberOrAddress) {
|
||||||
|
return numberOrAddress.matches("[-+]?\\d*\\.?\\d+");
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isStrictSipAddress(String numberOrAddress) {
|
public static boolean isStrictSipAddress(String numberOrAddress) {
|
||||||
return isSipAddress(numberOrAddress) && numberOrAddress.startsWith("sip:");
|
return isSipAddress(numberOrAddress) && numberOrAddress.startsWith("sip:");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue