Commit bdafed7f authored by sungmann.cho's avatar sungmann.cho Committed by Commit bot

Use View Holder pattern in AccountsAdapter.getView().

Currently, the lint warns at:
AccountsAdapter.java:29 Unconditional layout inflation from view adapter:
    Should use View Holder pattern (use recycled view passed into this method
    as the second parameter) for smoother scrolling: ViewHolder [warning]

This CL fixes the above lint error.

BUG=327768

Review URL: https://codereview.chromium.org/628133003

Cr-Commit-Position: refs/heads/master@{#299406}
parent f80eef13
...@@ -26,7 +26,10 @@ public class AccountsAdapter extends ArrayAdapter<Account> { ...@@ -26,7 +26,10 @@ public class AccountsAdapter extends ArrayAdapter<Account> {
@Override @Override
public View getView(int position, View convertView, ViewGroup parent) { public View getView(int position, View convertView, ViewGroup parent) {
View view = mInflater.inflate(R.layout.account_selected, parent, false); View view = convertView;
if (view == null) {
view = mInflater.inflate(R.layout.account_selected, parent, false);
}
Account account = getItem(position); Account account = getItem(position);
TextView target = (TextView) view.findViewById(R.id.account_name); TextView target = (TextView) view.findViewById(R.id.account_name);
target.setText(account.name); target.setText(account.name);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment