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