Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9ebe9f40 authored by Amit Kumar's avatar Amit Kumar Committed by Nishith Khanna
Browse files

Contacts: Sort /e/ account with first priority and allow user to modify primary account for profile

Change-Id: I27755aa319359ec33438f0a6bd470be126fd0f9a
parent a16a79f6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -794,7 +794,7 @@ public class RawContactEditorView extends LinearLayout implements View.OnClickLi
        }

        // If we're saving a new contact and there are multiple accounts, add the account selector.
        if (mHasNewContact && !mIsUserProfile && mAccounts.size() > 1) {
        if (mHasNewContact && mAccounts.size() > 1) {
            addAccountSelector(mCurrentRawContactDelta);
        }
    }
+6 −6
Original line number Diff line number Diff line
@@ -38,13 +38,13 @@ public class AccountComparator implements Comparator<AccountWithDataSet> {
            return -1;
        } else if (a.name == null || a.type == null) {
            return 1;
        } else if (isWritableGoogleAccount(a) && a.equals(mDefaultAccount)) {
        } else if (isWritableEAccount(a) && a.equals(mDefaultAccount)) {
            return -1;
        } else if (isWritableGoogleAccount(b) && b.equals(mDefaultAccount)) {
        } else if (isWritableEAccount(b) && b.equals(mDefaultAccount)) {
            return 1;
        } else if (isWritableGoogleAccount(a) && !isWritableGoogleAccount(b)) {
        } else if (isWritableEAccount(a) && !isWritableEAccount(b)) {
            return -1;
        } else if (isWritableGoogleAccount(b) && !isWritableGoogleAccount(a)) {
        } else if (isWritableEAccount(b) && !isWritableEAccount(a)) {
            return 1;
        } else {
            int diff = a.name.compareToIgnoreCase(b.name);
@@ -65,7 +65,7 @@ public class AccountComparator implements Comparator<AccountWithDataSet> {
        }
    }

    private static boolean isWritableGoogleAccount(AccountWithDataSet account) {
        return GoogleAccountType.ACCOUNT_TYPE.equals(account.type) && account.dataSet == null;
    private static boolean isWritableEAccount(AccountWithDataSet account) {
        return "foundation.e.accountmanager.eelo.address_book".equals(account.type) && account.dataSet == null;
    }
}