Fixed contact edition crashes
This commit is contained in:
parent
4d58d71dbe
commit
e40a59ff92
4 changed files with 12 additions and 13 deletions
|
@ -675,6 +675,7 @@ public abstract class MainActivity extends LinphoneGenericActivity
|
||||||
|
|
||||||
private void displayDNDSettingsDialog() {
|
private void displayDNDSettingsDialog() {
|
||||||
if (!LinphonePreferences.instance().isDNDSettingsPopupEnabled()) return;
|
if (!LinphonePreferences.instance().isDNDSettingsPopupEnabled()) return;
|
||||||
|
Log.w("[Permission] Asking user to grant us permission to read DND settings");
|
||||||
|
|
||||||
final Dialog dialog =
|
final Dialog dialog =
|
||||||
displayDialog(getString(R.string.pref_grant_read_dnd_settings_permission_desc));
|
displayDialog(getString(R.string.pref_grant_read_dnd_settings_permission_desc));
|
||||||
|
@ -705,8 +706,6 @@ public abstract class MainActivity extends LinphoneGenericActivity
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Log.w(
|
|
||||||
"[Permission] Asking user to grant us permission to read DND settings");
|
|
||||||
startActivity(
|
startActivity(
|
||||||
new Intent("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"));
|
new Intent("android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS"));
|
||||||
dialog.dismiss();
|
dialog.dismiss();
|
||||||
|
|
|
@ -220,7 +220,7 @@ public class ContactDetailsFragment extends Fragment implements ContactsUpdatedL
|
||||||
TableLayout controls = view.findViewById(R.id.controls);
|
TableLayout controls = view.findViewById(R.id.controls);
|
||||||
controls.removeAllViews();
|
controls.removeAllViews();
|
||||||
for (LinphoneNumberOrAddress noa : mContact.getNumbersOrAddresses()) {
|
for (LinphoneNumberOrAddress noa : mContact.getNumbersOrAddresses()) {
|
||||||
boolean skip = false;
|
boolean skip;
|
||||||
View v = inflater.inflate(R.layout.contact_control_row, null);
|
View v = inflater.inflate(R.layout.contact_control_row, null);
|
||||||
|
|
||||||
String value = noa.getValue();
|
String value = noa.getValue();
|
||||||
|
|
|
@ -194,7 +194,7 @@ public class ContactEditorFragment extends Fragment {
|
||||||
ContactsManager.getInstance().fetchContactsAsync();
|
ContactsManager.getInstance().fetchContactsAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
getFragmentManager().popBackStackImmediate();
|
getFragmentManager().popBackStack();
|
||||||
if (mIsNewContact || getResources().getBoolean(R.bool.isTablet)) {
|
if (mIsNewContact || getResources().getBoolean(R.bool.isTablet)) {
|
||||||
((ContactsActivity) getActivity()).showContactDetails(mContact);
|
((ContactsActivity) getActivity()).showContactDetails(mContact);
|
||||||
}
|
}
|
||||||
|
|
|
@ -199,7 +199,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
Number or address related
|
Number or address related
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void addNumberOrAddress(LinphoneNumberOrAddress noa) {
|
private synchronized void addNumberOrAddress(LinphoneNumberOrAddress noa) {
|
||||||
if (noa == null) return;
|
if (noa == null) return;
|
||||||
if (noa.isSIPAddress()) {
|
if (noa.isSIPAddress()) {
|
||||||
mHasSipAddress = true;
|
mHasSipAddress = true;
|
||||||
|
@ -220,7 +220,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<LinphoneNumberOrAddress> getNumbersOrAddresses() {
|
public synchronized List<LinphoneNumberOrAddress> getNumbersOrAddresses() {
|
||||||
return mAddresses;
|
return mAddresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
return mHasSipAddress;
|
return mHasSipAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeNumberOrAddress(LinphoneNumberOrAddress noa) {
|
public synchronized void removeNumberOrAddress(LinphoneNumberOrAddress noa) {
|
||||||
if (noa != null && noa.getOldValue() != null) {
|
if (noa != null && noa.getOldValue() != null) {
|
||||||
|
|
||||||
removeNumberOrAddress(noa.getOldValue(), noa.isSIPAddress());
|
removeNumberOrAddress(noa.getOldValue(), noa.isSIPAddress());
|
||||||
|
@ -268,7 +268,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addOrUpdateNumberOrAddress(LinphoneNumberOrAddress noa) {
|
public synchronized void addOrUpdateNumberOrAddress(LinphoneNumberOrAddress noa) {
|
||||||
if (noa != null && noa.getValue() != null) {
|
if (noa != null && noa.getValue() != null) {
|
||||||
|
|
||||||
addNumberOrAddress(noa.getValue(), noa.getOldValue(), noa.isSIPAddress());
|
addNumberOrAddress(noa.getValue(), noa.getOldValue(), noa.isSIPAddress());
|
||||||
|
@ -299,7 +299,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void clearAddresses() {
|
public synchronized void clearAddresses() {
|
||||||
mAddresses.clear();
|
mAddresses.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
mFriend.removePhoneNumber(phone);
|
mFriend.removePhoneNumber(phone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (LinphoneNumberOrAddress noa : mAddresses) {
|
for (LinphoneNumberOrAddress noa : getNumbersOrAddresses()) {
|
||||||
if (noa.isSIPAddress()) {
|
if (noa.isSIPAddress()) {
|
||||||
Address addr = core.interpretUrl(noa.getValue());
|
Address addr = core.interpretUrl(noa.getValue());
|
||||||
if (addr != null) {
|
if (addr != null) {
|
||||||
|
@ -401,7 +401,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
|
|
||||||
public boolean isInFriendList() {
|
public boolean isInFriendList() {
|
||||||
if (mFriend == null) return false;
|
if (mFriend == null) return false;
|
||||||
for (LinphoneNumberOrAddress noa : mAddresses) {
|
for (LinphoneNumberOrAddress noa : getNumbersOrAddresses()) {
|
||||||
PresenceModel pm = mFriend.getPresenceModelForUriOrTel(noa.getValue());
|
PresenceModel pm = mFriend.getPresenceModelForUriOrTel(noa.getValue());
|
||||||
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
|
if (pm != null && pm.getBasicStatus().equals(PresenceBasicStatus.Open)) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -451,7 +451,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
setPhotoUri(getContactPictureUri());
|
setPhotoUri(getContactPictureUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void syncValuesFromFriend() {
|
public synchronized void syncValuesFromFriend() {
|
||||||
if (isFriend()) {
|
if (isFriend()) {
|
||||||
mAddresses = new ArrayList<>();
|
mAddresses = new ArrayList<>();
|
||||||
mFullName = mFriend.getName();
|
mFullName = mFriend.getName();
|
||||||
|
@ -482,7 +482,7 @@ public class LinphoneContact extends AndroidContact
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void syncValuesFromAndroidContact(Context context) {
|
private synchronized void syncValuesFromAndroidContact(Context context) {
|
||||||
Cursor c =
|
Cursor c =
|
||||||
context.getContentResolver()
|
context.getContentResolver()
|
||||||
.query(
|
.query(
|
||||||
|
|
Loading…
Reference in a new issue