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

Commit ad8e1406 authored by Makoto Onuki's avatar Makoto Onuki
Browse files

Makke DONE button close activity on readonly group editor

Bug 5142181

Change-Id: I5b300b150113b77800de698dbb7bdd40c35b15f4
parent 96a051e2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ public class GroupEditorActivity extends ContactsActivity
            saveMenuItem.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    mFragment.doSaveAction();
                    mFragment.onDoneClicked();
                }
            });
            // Show the custom action bar but hide the home icon and title
+24 −5
Original line number Diff line number Diff line
@@ -359,13 +359,27 @@ public class GroupEditorFragment extends Fragment implements SelectAccountDialog
        }
    }

    private AccountType getAccountType() {
        return AccountTypeManager.getInstance(mContext).getAccountType(mAccountType, mDataSet);
    }

    /**
     * @return true if the group membership is editable on this account type.  false otherwise,
     *         or account is not set yet.
     */
    private boolean isGroupMembershipEditable() {
        if (mAccountType == null) {
            return false;
        }
        return getAccountType().isGroupMembershipEditable();
    }

    /**
     * Sets up the editor based on the group's account name and type.
     */
    private void setupEditorForAccount() {
        final AccountTypeManager accountTypeManager = AccountTypeManager.getInstance(mContext);
        final AccountType accountType = accountTypeManager.getAccountType(mAccountType, mDataSet);
        final boolean editable = accountType.isGroupMembershipEditable();
        final AccountType accountType = getAccountType();
        final boolean editable = isGroupMembershipEditable();
        mMemberListAdapter.setIsGroupMembershipEditable(editable);

        View editorView = mLayoutInflater.inflate(editable ?
@@ -463,8 +477,13 @@ public class GroupEditorFragment extends Fragment implements SelectAccountDialog
        mListener = value;
    }

    public void doSaveAction() {
    public void onDoneClicked() {
        if (isGroupMembershipEditable()) {
            save(SaveMode.CLOSE);
        } else {
            // Just revert it.
            doRevertAction();
        }
    }

    @Override