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

Commit 2bbfae8f authored by Isaac Katzenelson's avatar Isaac Katzenelson
Browse files

Remove "suggested contacts" while editing profile

Bug: 5155177 The "suggested contact" pop-up shouldn't
     show up while editing a local profile

Added a check to remove the call to get suggestion when the contact
is the profile.
Did some cleanup and created a method for detecting if we editing
a user profile.

Change-Id: I54b3a009f9fe3dd5f899b8b903b6830e71835874
parent f63c770f
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -693,7 +693,7 @@ public class ContactEditorFragment extends Fragment implements

                    @Override
                    public void onRequest(int request) {
                        if (request == EditorListener.FIELD_CHANGED) {
                        if (request == EditorListener.FIELD_CHANGED && !isEditingUserProfile()) {
                            acquireAggregationSuggestions(rawContactEditor);
                        }
                    }
@@ -803,12 +803,11 @@ public class ContactEditorFragment extends Fragment implements
        // TODO: Find a better way to handle shortcuts, i.e. onKeyDown()?
        menu.findItem(R.id.menu_done).setVisible(false);

        boolean editingUserProfile = mIsUserProfile || mNewLocalProfile;
        // Split only if more than one raw profile and not a user profile
        menu.findItem(R.id.menu_split).setVisible(mState != null && mState.size() > 1 &&
                !editingUserProfile);
                !isEditingUserProfile());
        // Cannot join a user profile
        menu.findItem(R.id.menu_join).setVisible(!editingUserProfile);
        menu.findItem(R.id.menu_join).setVisible(!isEditingUserProfile());


        int size = menu.size();
@@ -974,7 +973,7 @@ public class ContactEditorFragment extends Fragment implements
        setEnabled(false);

        Intent intent = ContactSaveService.createSaveContactIntent(getActivity(), mState,
                SAVE_MODE_EXTRA_KEY, saveMode, mNewLocalProfile || mIsUserProfile,
                SAVE_MODE_EXTRA_KEY, saveMode, isEditingUserProfile(),
                getActivity().getClass(), ContactEditorActivity.ACTION_SAVE_COMPLETED);
        getActivity().startService(intent);
        return true;
@@ -1150,6 +1149,10 @@ public class ContactEditorFragment extends Fragment implements
        return false;
    }

    private boolean isEditingUserProfile() {
        return mNewLocalProfile || mIsUserProfile;
    }

    public static interface Listener {
        /**
         * Contact was not found, so somehow close this fragment. This is raised after a contact