public void setAccounts(List<AccountsModel> accounts) { iBanCardaccounts = accounts; user_my_card_sbtn.setEnabled(accounts != null && accounts.size() > 0); selectedPosition = -1; disAblePosition = -1; AccountsModel payer = getAccountsModel(); if (accounts != null) { int length = accounts.size(); for (int i = 0; i < length; i++) { Holder mHolder; if (i + 1 < beneficiary_rg.getChildCount() - 1) { mHolder = (Holder) beneficiary_rg.getChildAt(i + 1).getTag(); } else { View itemView = mLayoutInflater.inflate(R.layout.bper_payment_entry_beneficiary_item, null); itemView.setOnClickListener(mItemOnClickListener); beneficiary_rg.addView(itemView); mHolder = new Holder(itemView); } AccountsModel mAccountsModel = accounts.get(i); if (payer != null && payer.getAccountCode().equals(mAccountsModel.getAccountCode())) { disAblePosition = i; } mHolder.setData(i, mAccountsModel); if (i == length - 1) { mHolder.divider.setVisibility(View.GONE); } else { mHolder.divider.setVisibility(View.VISIBLE); } } for (int i = beneficiary_rg.getChildCount() - 1; i > length; i--) { beneficiary_rg.getChildAt(i).setVisibility(View.GONE); } } mPaymentStepViewUtils.view.setFocusable(true); mPaymentStepViewUtils.view.requestFocusFromTouch(); }
public static <T1 extends T2, T2> T2 copyTo(Holder<T1> h1, Holder<T2> h2) { return h2.setData(h1.getData()); }