@Test(expected = IllegalArgumentException.class) public void testSetNullLabelsException() { mSingleChoiceOptionItem.setLabels(TITLE, null); }
public SingleChoiceOptionItem setLabels(final String title, final List<String> labels) { if (labels == null) { throw new IllegalArgumentException(getContext().getString(R.string.msdkui_exception_labels_null)); } View.inflate(getContext(), R.layout.single_option_item, this); final TextView titleView = (TextView) findViewById(R.id.single_item_label); if (title == null) { titleView.setVisibility(GONE); } else { titleView.setText(title); } mTitle = title; mLabels = labels; mSpinner = (Spinner) findViewById(R.id.single_item_value); mSpinner.setAdapter(new ArrayAdapter<String>(getContext(), R.layout.spinner_row_item, labels)); mSpinner.setOnItemSelectedListener(this); return this; }
SingleChoiceOptionItem extends OptionItem implements AdapterView.OnItemSelectedListener { public SingleChoiceOptionItem setLabels(final String title, final List<String> labels) { if (labels == null) { throw new IllegalArgumentException(getContext().getString(R.string.msdkui_exception_labels_null)); } View.inflate(getContext(), R.layout.single_option_item, this); final TextView titleView = (TextView) findViewById(R.id.single_item_label); if (title == null) { titleView.setVisibility(GONE); } else { titleView.setText(title); } mTitle = title; mLabels = labels; mSpinner = (Spinner) findViewById(R.id.single_item_value); mSpinner.setAdapter(new ArrayAdapter<String>(getContext(), R.layout.spinner_row_item, labels)); mSpinner.setOnItemSelectedListener(this); return this; } }
SingleChoiceOptionItem extends OptionItem implements AdapterView.OnItemSelectedListener { public SingleChoiceOptionItem setLabels(final String title, final List<String> labels) { if (labels == null) { throw new IllegalArgumentException(getContext().getString(R.string.msdkui_exception_labels_null)); } View.inflate(getContext(), R.layout.single_option_item, this); final TextView titleView = (TextView) findViewById(R.id.single_item_label); if (title == null) { titleView.setVisibility(GONE); } else { titleView.setText(title); } mTitle = title; mLabels = labels; mSpinner = (Spinner) findViewById(R.id.single_item_value); mSpinner.setAdapter(new ArrayAdapter<String>(getContext(), R.layout.spinner_row_item, labels)); mSpinner.setOnItemSelectedListener(this); return this; } SingleChoiceOptionItem(final Context context);  SingleChoiceOptionItem(final Context context, final AttributeSet attrs);  SingleChoiceOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  SingleChoiceOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr,
            final int defStyleRes); }
SingleChoiceOptionItem extends OptionItem implements AdapterView.OnItemSelectedListener { public SingleChoiceOptionItem setLabels(final String title, final List<String> labels) { if (labels == null) { throw new IllegalArgumentException(getContext().getString(R.string.msdkui_exception_labels_null)); } View.inflate(getContext(), R.layout.single_option_item, this); final TextView titleView = (TextView) findViewById(R.id.single_item_label); if (title == null) { titleView.setVisibility(GONE); } else { titleView.setText(title); } mTitle = title; mLabels = labels; mSpinner = (Spinner) findViewById(R.id.single_item_value); mSpinner.setAdapter(new ArrayAdapter<String>(getContext(), R.layout.spinner_row_item, labels)); mSpinner.setOnItemSelectedListener(this); return this; } SingleChoiceOptionItem(final Context context);  SingleChoiceOptionItem(final Context context, final AttributeSet attrs);  SingleChoiceOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  SingleChoiceOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr,
            final int defStyleRes); List<String> getLabels(); String getTitle(); SingleChoiceOptionItem setLabels(final String title, final List<String> labels); void selectLabel(final String label); void selectIndex(final int index); String getSelectedItemLabel(); @Override void onItemSelected(AdapterView<?> parent, View view, int position, long id); @Override void onNothingSelected(AdapterView<?> parent); }
SingleChoiceOptionItem extends OptionItem implements AdapterView.OnItemSelectedListener { public SingleChoiceOptionItem setLabels(final String title, final List<String> labels) { if (labels == null) { throw new IllegalArgumentException(getContext().getString(R.string.msdkui_exception_labels_null)); } View.inflate(getContext(), R.layout.single_option_item, this); final TextView titleView = (TextView) findViewById(R.id.single_item_label); if (title == null) { titleView.setVisibility(GONE); } else { titleView.setText(title); } mTitle = title; mLabels = labels; mSpinner = (Spinner) findViewById(R.id.single_item_value); mSpinner.setAdapter(new ArrayAdapter<String>(getContext(), R.layout.spinner_row_item, labels)); mSpinner.setOnItemSelectedListener(this); return this; } SingleChoiceOptionItem(final Context context);  SingleChoiceOptionItem(final Context context, final AttributeSet attrs);  SingleChoiceOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr); @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)  SingleChoiceOptionItem(final Context context, final AttributeSet attrs, final int defStyleAttr,
            final int defStyleRes); List<String> getLabels(); String getTitle(); SingleChoiceOptionItem setLabels(final String title, final List<String> labels); void selectLabel(final String label); void selectIndex(final int index); String getSelectedItemLabel(); @Override void onItemSelected(AdapterView<?> parent, View view, int position, long id); @Override void onNothingSelected(AdapterView<?> parent);  }