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

Commit 80e02580 authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Change padding in account selection dialog (2/2)

This CL fixes the padding in account selection dialog opened
when importing contacts. The account_selector_list_item_condensed.xml
is created based on account_selector_list_item.xml and with unique
margin settings. This is because account_selector_list_item.xml was
used in 3 places, and it didn't align well with the importing contacts
dialog.

Screenshots: https://drive.google.com/a/google.com/folderview?id=0BwSNbQ_IWQd2Zlh0OExxSkJtQ0U&usp=sharing

Bug: 22292872
Change-Id: I98f3093dd20bf87354676647355984d1427e21af
parent eec094a2
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.app.FragmentManager;
import android.content.DialogInterface;
import android.os.Bundle;

import com.android.contacts.common.R;
import com.android.contacts.common.model.account.AccountWithDataSet;
import com.android.contacts.common.util.AccountsListAdapter;
import com.android.contacts.common.util.AccountsListAdapter.AccountListFilter;
@@ -76,6 +77,7 @@ public final class SelectAccountDialogFragment extends DialogFragment {
        final AccountListFilter filter = (AccountListFilter) args.getSerializable(KEY_LIST_FILTER);
        final AccountsListAdapter accountAdapter = new AccountsListAdapter(builder.getContext(),
                filter);
        accountAdapter.setCustomLayout(R.layout.account_selector_list_item_condensed);

        final DialogInterface.OnClickListener clickListener =
                new DialogInterface.OnClickListener() {
+8 −2
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ public final class AccountsListAdapter extends BaseAdapter {
    private final List<AccountWithDataSet> mAccounts;
    private final AccountTypeManager mAccountTypes;
    private final Context mContext;
    private int mCustomLayout = -1;

    /**
     * Filters that affect the list of accounts that is displayed by this adapter.
@@ -81,10 +82,15 @@ public final class AccountsListAdapter extends BaseAdapter {
                accountListFilter == AccountListFilter.ACCOUNTS_CONTACT_WRITABLE));
    }

    public void setCustomLayout(int customLayout) {
        mCustomLayout = customLayout;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final View resultView = convertView != null ? convertView
                : mInflater.inflate(R.layout.account_selector_list_item, parent, false);
        final View resultView = convertView != null ? convertView :
                mInflater.inflate(mCustomLayout > 0 ? mCustomLayout :
                        R.layout.account_selector_list_item, parent, false);

        final TextView text1 = (TextView) resultView.findViewById(android.R.id.text1);
        final TextView text2 = (TextView) resultView.findViewById(android.R.id.text2);