EMMA Coverage Report (generated Fri Aug 23 16:39:17 PDT 2013)
[all classes][org.chromium.ui.autofill]

COVERAGE SUMMARY FOR SOURCE FILE [AutofillListAdapter.java]

nameclass, %method, %block, %line, %
AutofillListAdapter.java100% (1/1)100% (2/2)94%  (58/62)94%  (15/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AutofillListAdapter100% (1/1)100% (2/2)94%  (58/62)94%  (15/16)
getView (int, View, ViewGroup): View 100% (1/1)92%  (49/53)92%  (12/13)
AutofillListAdapter (Context, ArrayList): void 100% (1/1)100% (9/9)100% (3/3)

1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4 
5 
6package org.chromium.ui.autofill;
7 
8import android.content.Context;
9import android.text.TextUtils;
10 
11import android.view.LayoutInflater;
12import android.view.View;
13import android.view.ViewGroup;
14import android.widget.ArrayAdapter;
15import android.widget.TextView;
16 
17import org.chromium.ui.R;
18 
19import java.util.ArrayList;
20 
21/**
22 * Autofill suggestion adapter for AutofillWindow.
23 */
24public class AutofillListAdapter extends ArrayAdapter<AutofillSuggestion> {
25    private Context mContext;
26 
27    AutofillListAdapter(Context context, ArrayList<AutofillSuggestion> objects) {
28        super(context, R.layout.autofill_text, objects);
29        mContext = context;
30    }
31 
32    @Override
33    public View getView(int position, View convertView, ViewGroup parent) {
34        View layout = convertView;
35        if (convertView == null) {
36            LayoutInflater inflater =
37                    (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
38            layout = inflater.inflate(R.layout.autofill_text, null);
39        }
40        TextView labelView = (TextView) layout.findViewById(R.id.autofill_label);
41        labelView.setText(getItem(position).mLabel);
42 
43        TextView sublabelView = (TextView) layout.findViewById(R.id.autofill_sublabel);
44        CharSequence sublabel = getItem(position).mSublabel;
45        if (TextUtils.isEmpty(sublabel)) {
46            sublabelView.setVisibility(View.GONE);
47        } else {
48            sublabelView.setText(sublabel);
49            sublabelView.setVisibility(View.VISIBLE);
50        }
51 
52        return layout;
53    }
54}

[all classes][org.chromium.ui.autofill]
EMMA 2.0.5312 (C) Vladimir Roubtsov