Fixed minor contact related issues
This commit is contained in:
parent
92b3832ab8
commit
e550efc094
3 changed files with 21 additions and 18 deletions
|
@ -136,12 +136,15 @@ public class ContactEditorFragment extends Fragment {
|
|||
if (mIsNewContact) {
|
||||
boolean areAllFielsEmpty = true;
|
||||
for (LinphoneNumberOrAddress nounoa : mNumbersAndAddresses) {
|
||||
if (nounoa.getValue() != null && !nounoa.getValue().equals("")) {
|
||||
String value = nounoa.getValue();
|
||||
if (value != null && !value.trim().isEmpty()) {
|
||||
areAllFielsEmpty = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (areAllFielsEmpty) {
|
||||
Log.i(
|
||||
"[Contact Editor] All SIP and phone fields are empty, aborting");
|
||||
getFragmentManager().popBackStackImmediate();
|
||||
return;
|
||||
}
|
||||
|
@ -158,27 +161,24 @@ public class ContactEditorFragment extends Fragment {
|
|||
}
|
||||
|
||||
for (LinphoneNumberOrAddress noa : mNumbersAndAddresses) {
|
||||
if (noa.getValue() == null || noa.getValue().isEmpty()) {
|
||||
if (noa.getOldValue() != null && !noa.getOldValue().isEmpty()) {
|
||||
Log.i("[Contact Editor] Removing number " + noa.getOldValue());
|
||||
String value = noa.getValue();
|
||||
String oldValue = noa.getOldValue();
|
||||
|
||||
if (value == null || value.trim().isEmpty()) {
|
||||
if (oldValue != null && !oldValue.isEmpty()) {
|
||||
Log.i("[Contact Editor] Removing number " + oldValue);
|
||||
mContact.removeNumberOrAddress(noa);
|
||||
}
|
||||
} else {
|
||||
if (noa.getOldValue() != null
|
||||
&& noa.getOldValue().equals(noa.getValue())) {
|
||||
Log.i(
|
||||
"[Contact Editor] Keeping existing number "
|
||||
+ noa.getValue());
|
||||
if (oldValue != null && oldValue.equals(value)) {
|
||||
Log.i("[Contact Editor] Keeping existing number " + value);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (noa.isSIPAddress()) {
|
||||
|
||||
noa.setValue(
|
||||
LinphoneUtils.getFullAddressFromUsername(
|
||||
noa.getValue()));
|
||||
noa.setValue(LinphoneUtils.getFullAddressFromUsername(value));
|
||||
}
|
||||
Log.i("[Contact Editor] Adding new number " + noa.getValue());
|
||||
Log.i("[Contact Editor] Adding new number " + value);
|
||||
|
||||
mContact.addOrUpdateNumberOrAddress(noa);
|
||||
}
|
||||
|
|
|
@ -559,7 +559,8 @@ public class LinphoneContact extends AndroidContact
|
|||
String data3 = c.getString(c.getColumnIndex("data3"));
|
||||
String data4 = c.getString(c.getColumnIndex("data4"));
|
||||
|
||||
if (getFullName() == null) {
|
||||
String fullName = getFullName();
|
||||
if (fullName == null || !fullName.equals(displayName)) {
|
||||
Log.d("[Linphone Contact] Setting display name " + displayName);
|
||||
setFullName(displayName);
|
||||
}
|
||||
|
|
|
@ -221,14 +221,15 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
private void enableVideoPreviewIfTablet(boolean enable) {
|
||||
Core core = LinphoneManager.getCore();
|
||||
TextureView preview = findViewById(R.id.video_preview);
|
||||
if (preview != null && core != null) {
|
||||
ImageView changeCamera = findViewById(R.id.video_preview_change_camera);
|
||||
|
||||
if (preview != null && changeCamera != null && core != null) {
|
||||
if (enable && isTablet() && LinphonePreferences.instance().isVideoPreviewEnabled()) {
|
||||
preview.setVisibility(View.VISIBLE);
|
||||
core.setNativePreviewWindowId(preview);
|
||||
core.enableVideoPreview(true);
|
||||
|
||||
ImageView changeCamera = findViewById(R.id.video_preview_change_camera);
|
||||
if (changeCamera != null && core.getVideoDevicesList().length > 1) {
|
||||
if (core.getVideoDevicesList().length > 1) {
|
||||
changeCamera.setVisibility(View.VISIBLE);
|
||||
changeCamera.setOnClickListener(
|
||||
new View.OnClickListener() {
|
||||
|
@ -240,6 +241,7 @@ public class DialerActivity extends MainActivity implements AddressText.AddressC
|
|||
}
|
||||
} else {
|
||||
preview.setVisibility(View.GONE);
|
||||
changeCamera.setVisibility(View.GONE);
|
||||
core.setNativePreviewWindowId(null);
|
||||
core.enableVideoPreview(false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue