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

Commit 0133589f authored by Makoto Onuki's avatar Makoto Onuki Committed by Android (Google) Code Review
Browse files

Merge "Makke DONE button close activity on readonly group editor"

parents 607d947a ad8e1406
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
@@ -345,13 +345,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 ?
@@ -449,8 +463,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