android.widget.AbsSpinner Java Examples

The following examples show how to use android.widget.AbsSpinner. 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: SimpleNoValuesExtractor.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Set Count of the Widget
 * 
 * @param v
 *            Widget
 * @param wd
 *            WidgetDescription instance
 */
@SuppressWarnings("rawtypes")
public static void setCount(View v, WidgetDescription w) {
	// For lists, the count is set to the number of rows in the list
	// (inactive rows - e.g. separators - count as well)
	if (v instanceof AdapterView) {
		w.setCount(((AdapterView) v).getCount());
		return;
	}

	// For Spinners, the count is set to the number of options
	if (v instanceof AbsSpinner) {
		w.setCount(((AbsSpinner) v).getCount());
		return;
	}

	// For the tab layout host, the count is set to the number of tabs
	if (v instanceof TabHost) {
		w.setCount(((TabHost) v).getTabWidget().getTabCount());
		return;
	}

	// For grids, the count is set to the number of icons, for RadioGroups
	// it's set to the number of RadioButtons
	if (v instanceof ViewGroup) {
		w.setCount(((ViewGroup) v).getChildCount());
		return;
	}

	// For progress bars, seek bars and rating bars, the count is set to the
	// maximum value allowed
	if (v instanceof ProgressBar) {
		w.setCount(((ProgressBar) v).getMax());
		return;
	}
}
 
Example #2
Source File: SimpleExtractor.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Set Count of the Widget
 * 
 * @param v
 *            Widget
 * @param wd
 *            WidgetDescription instance
 */
@SuppressWarnings("rawtypes")
public static void setCount(View v, WidgetDescription w) {
	// For lists, the count is set to the number of rows in the list
	// (inactive rows - e.g. separators - count as well)
	if (v instanceof AdapterView) {
		w.setCount(((AdapterView) v).getCount());
		return;
	}

	// For Spinners, the count is set to the number of options
	if (v instanceof AbsSpinner) {
		w.setCount(((AbsSpinner) v).getCount());
		return;
	}

	// For the tab layout host, the count is set to the number of tabs
	if (v instanceof TabHost) {
		w.setCount(((TabHost) v).getTabWidget().getTabCount());
		return;
	}

	// For grids, the count is set to the number of icons, for RadioGroups
	// it's set to the number of RadioButtons
	if (v instanceof ViewGroup) {
		w.setCount(((ViewGroup) v).getChildCount());
		return;
	}

	// For progress bars, seek bars and rating bars, the count is set to the
	// maximum value allowed
	if (v instanceof ProgressBar) {
		w.setCount(((ProgressBar) v).getMax());
		return;
	}
}
 
Example #3
Source File: ReflectionExtractor.java    From AndroidRipper with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Set Count of the Widget
 * 
 * @param v
 *            Widget
 * @param w
 *            WidgetDescription instance
 */
@SuppressWarnings("rawtypes")
public static void setCount(View v, WidgetDescription w) {
	// For lists, the count is set to the number of rows in the list
	// (inactive rows - e.g. separators - count as well)
	if (v instanceof AdapterView) {
		w.setCount(((AdapterView) v).getCount());
		return;
	}

	// For Spinners, the count is set to the number of options
	if (v instanceof AbsSpinner) {
		w.setCount(((AbsSpinner) v).getCount());
		return;
	}

	// For the tab layout host, the count is set to the number of tabs
	if (v instanceof TabHost) {
		w.setCount(((TabHost) v).getTabWidget().getTabCount());
		return;
	}

	// For grids, the count is set to the number of icons, for RadioGroups
	// it's set to the number of RadioButtons
	if (v instanceof ViewGroup) {
		w.setCount(((ViewGroup) v).getChildCount());
		return;
	}

	// For progress bars, seek bars and rating bars, the count is set to the
	// maximum value allowed
	if (v instanceof ProgressBar) {
		w.setCount(((ProgressBar) v).getMax());
		return;
	}
}
 
Example #4
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static BaseDSL.ViewClassResult absSpinner() {
  return BaseDSL.v(AbsSpinner.class);
}
 
Example #5
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void absSpinner(Anvil.Renderable r) {
  return BaseDSL.v(AbsSpinner.class, r);
}
 
Example #6
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static BaseDSL.ViewClassResult absSpinner() {
  return BaseDSL.v(AbsSpinner.class);
}
 
Example #7
Source File: DSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void absSpinner(Anvil.Renderable r) {
  return BaseDSL.v(AbsSpinner.class, r);
}
 
Example #8
Source File: AndroidTester.java    From aedict with GNU General Public License v3.0 4 votes vote down vote up
public void assertItem(final int spinnerId, final int position) {
	final AbsSpinner view = (AbsSpinner) get(spinnerId);
	assertEquals("Incorrect item selected: expected " + position + " but got " + view.getSelectedItemPosition(), position, view.getSelectedItemPosition());
}
 
Example #9
Source File: OnItemSelectedTest.java    From butterknife with Apache License 2.0 4 votes vote down vote up
@OnItemSelected(2) void selectAbsSpinner(AbsSpinner view) {
  last = view;
}
 
Example #10
Source File: OnItemSelectedTest.java    From butterknife with Apache License 2.0 4 votes vote down vote up
@OnItemSelected(value = 2, callback = NOTHING_SELECTED)
void clearAbsSpinner(AbsSpinner view) {
  last = view;
}
 
Example #11
Source File: OnItemClickTest.java    From butterknife with Apache License 2.0 4 votes vote down vote up
@OnItemClick(2) void itemClickAbsSpinner(AbsSpinner view) {
    last = view;
}
 
Example #12
Source File: OnItemLongClickTest.java    From butterknife with Apache License 2.0 4 votes vote down vote up
@OnItemLongClick(2) boolean itemLongClickAbsSpinner(AbsSpinner view) {
    last = view;
    return true;
}
 
Example #13
Source File: AbsSpinnerAssert.java    From assertj-android with Apache License 2.0 4 votes vote down vote up
public AbsSpinnerAssert(AbsSpinner actual) {
  super(actual, AbsSpinnerAssert.class);
}
 
Example #14
Source File: AndroidTester.java    From aedict with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Sets given item.
 * 
 * @param spinnerId
 *            the spinner id
 * @param position
 *            the item position.
 */
public void setItem(final int spinnerId, final int position) {
	final AbsSpinner view = (AbsSpinner) get(spinnerId);
	view.setSelection(position);
}