Java Code Examples for android.widget.Spinner#setTag()

The following examples show how to use android.widget.Spinner#setTag() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ViewMatchersTest.java    From android-test with Apache License 2.0 6 votes vote down vote up
@UiThreadTest
@Test
public void withSpinnerTextString() {
  Spinner spinner = new Spinner(this.context);
  List<String> values = Lists.newArrayList();
  values.add("Hello World");
  values.add("Goodbye!!");
  ArrayAdapter<String> adapter =
      new ArrayAdapter<String>(this.context, android.R.layout.simple_spinner_item, values);
  spinner.setAdapter(adapter);
  spinner.setSelection(0);
  spinner.setTag("spinner");
  assertTrue(withSpinnerText(is("Hello World")).matches(spinner));
  assertFalse(withSpinnerText(is("Goodbye!!")).matches(spinner));
  assertFalse(withSpinnerText(is("")).matches(spinner));
}
 
Example 2
Source File: KeyBindingsDialog.java    From document-viewer with GNU General Public License v3.0 6 votes vote down vote up
@Override
public View getChildView(final int groupPosition, final int childPosition, final boolean isLastChild,
        View convertView, final ViewGroup parent) {
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.keybinding_action, parent, false);
    }

    final KeyAction action = getChild(groupPosition, childPosition);

    final TextView keyView = (TextView) convertView.findViewById(R.id.keybinding_key);
    keyView.setText(action.label);

    final Spinner actionsView = (Spinner) convertView.findViewById(R.id.keybinding_actions);
    actionsView.setOnItemSelectedListener(this);
    actionsView.setAdapter(actionsAdapter);
    actionsView.setTag(action);
    updateAction(actionsView);

    return convertView;
}
 
Example 3
Source File: TouchConfigDialog.java    From document-viewer with GNU General Public License v3.0 4 votes vote down vote up
public TouchConfigDialog(final IActivityController base, final TouchManagerView view, final TouchProfile profile,
        final Region region) {
    super(base.getContext());
    this.view = view;
    this.profile = profile;
    this.actions = new DialogController<TouchConfigDialog>(this);

    setTitle("Tap configuration");
    setContentView(R.layout.tap_zones_config);

    final ActionSelectionListener actionListener = new ActionSelectionListener();

    actionsAdapter = new ActionsAdapter(getContext());

    stList = (Spinner) this.findViewById(R.id.tapZonesConfigSingleAction);
    stList.setAdapter(actionsAdapter);
    stList.setTag(TouchManager.Touch.SingleTap);
    stList.setOnItemSelectedListener(actionListener);

    dtList = (Spinner) this.findViewById(R.id.tapZonesConfigDoubleAction);
    dtList.setAdapter(actionsAdapter);
    dtList.setTag(TouchManager.Touch.DoubleTap);
    dtList.setOnItemSelectedListener(actionListener);

    ltList = (Spinner) this.findViewById(R.id.tapZonesConfigLongAction);
    ltList.setAdapter(actionsAdapter);
    ltList.setTag(TouchManager.Touch.LongTap);
    ltList.setOnItemSelectedListener(actionListener);

    tftList = (Spinner) this.findViewById(R.id.tapZonesConfigTwoFingerAction);
    tftList.setAdapter(actionsAdapter);
    tftList.setTag(TouchManager.Touch.TwoFingerTap);
    tftList.setOnItemSelectedListener(actionListener);

    adapter = new RegionsAdapter(getContext(), wraps(profile.regions));
    regionList = (Spinner) this.findViewById(R.id.tapZonesConfigRegions);
    regionList.setAdapter(adapter);
    regionList.setSelection(profile.regions.indexOf(region));
    regionList.setOnItemSelectedListener(new RegionSelectionListener());

    actions.connectViewToAction(R.id.tapZonesConfigClear);
    actions.connectViewToAction(R.id.tapZonesConfigDelete);
    actions.connectViewToAction(R.id.tapZonesConfigReset);

    // for (Region r : this.profile.regions) {
    // System.out.println("TouchConfigDialog.TouchConfigDialog(): " + r);
    // }
}