use of android.widget.Spinner in project double-espresso by JakeWharton.
the class ViewMatchersTest method testCheckBoxMatchers.
public void testCheckBoxMatchers() {
assertFalse(isChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
assertFalse(isNotChecked().matches(new Spinner(getInstrumentation().getTargetContext())));
CheckBox checkBox = new CheckBox(getInstrumentation().getTargetContext());
checkBox.setChecked(true);
assertTrue(isChecked().matches(checkBox));
assertFalse(isNotChecked().matches(checkBox));
checkBox.setChecked(false);
assertFalse(isChecked().matches(checkBox));
assertTrue(isNotChecked().matches(checkBox));
RadioButton radioButton = new RadioButton(getInstrumentation().getTargetContext());
radioButton.setChecked(false);
assertFalse(isChecked().matches(radioButton));
assertTrue(isNotChecked().matches(radioButton));
radioButton.setChecked(true);
assertTrue(isChecked().matches(radioButton));
assertFalse(isNotChecked().matches(radioButton));
CheckedTextView checkedText = new CheckedTextView(getInstrumentation().getTargetContext());
checkedText.setChecked(false);
assertFalse(isChecked().matches(checkedText));
assertTrue(isNotChecked().matches(checkedText));
checkedText.setChecked(true);
assertTrue(isChecked().matches(checkedText));
assertFalse(isNotChecked().matches(checkedText));
Checkable checkable = new Checkable() {
@Override
public boolean isChecked() {
return true;
}
@Override
public void setChecked(boolean ignored) {
}
@Override
public void toggle() {
}
};
assertFalse(isChecked().matches(checkable));
assertFalse(isNotChecked().matches(checkable));
}
use of android.widget.Spinner in project android_frameworks_base by AOSPA.
the class ActionBarView method setNavigationMode.
public void setNavigationMode(int mode) {
final int oldMode = mNavigationMode;
if (mode != oldMode) {
switch(oldMode) {
case ActionBar.NAVIGATION_MODE_LIST:
if (mListNavLayout != null) {
removeView(mListNavLayout);
}
break;
case ActionBar.NAVIGATION_MODE_TABS:
if (mTabScrollView != null && mIncludeTabs) {
removeView(mTabScrollView);
}
}
switch(mode) {
case ActionBar.NAVIGATION_MODE_LIST:
if (mSpinner == null) {
mSpinner = new Spinner(mContext, null, com.android.internal.R.attr.actionDropDownStyle);
mSpinner.setId(com.android.internal.R.id.action_bar_spinner);
mListNavLayout = new LinearLayout(mContext, null, com.android.internal.R.attr.actionBarTabBarStyle);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT);
params.gravity = Gravity.CENTER;
mListNavLayout.addView(mSpinner, params);
}
if (mSpinner.getAdapter() != mSpinnerAdapter) {
mSpinner.setAdapter(mSpinnerAdapter);
}
mSpinner.setOnItemSelectedListener(mNavItemSelectedListener);
addView(mListNavLayout);
break;
case ActionBar.NAVIGATION_MODE_TABS:
if (mTabScrollView != null && mIncludeTabs) {
addView(mTabScrollView);
}
break;
}
mNavigationMode = mode;
requestLayout();
}
}
use of android.widget.Spinner in project android_frameworks_base by AOSPA.
the class PopupWindowVisibility method onCreate.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.popup_window_visibility);
mFrame = findViewById(R.id.frame);
mHide = (Button) findViewById(R.id.hide);
mHide.setOnClickListener(this);
mShow = (Button) findViewById(R.id.show);
mShow.setOnClickListener(this);
Spinner spinner = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, mStrings);
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerAdapter);
ArrayAdapter<String> autoAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_dropdown_item_1line, COUNTRIES);
AutoCompleteTextView textView = (AutoCompleteTextView) findViewById(R.id.auto);
textView.setAdapter(autoAdapter);
}
use of android.widget.Spinner in project android_frameworks_base by AOSPA.
the class ScrollingTabContainerView method createSpinner.
private Spinner createSpinner() {
final Spinner spinner = new Spinner(getContext(), null, com.android.internal.R.attr.actionDropDownStyle);
spinner.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT));
spinner.setOnItemClickListenerInt(this);
return spinner;
}
use of android.widget.Spinner in project android_frameworks_base by AOSPA.
the class BaseActivity method onCreate.
@CallSuper
@Override
public void onCreate(Bundle icicle) {
// Record the time when onCreate is invoked for metric.
mStartTime = new Date().getTime();
super.onCreate(icicle);
final Intent intent = getIntent();
addListenerForLaunchCompletion();
setContentView(mLayoutId);
mDrawer = DrawerController.create(this);
mState = getState(icicle);
Metrics.logActivityLaunch(this, mState, intent);
mRoots = DocumentsApplication.getRootsCache(this);
getContentResolver().registerContentObserver(RootsCache.sNotificationUri, false, mRootsCacheObserver);
mSearchManager = new SearchViewManager(this, icicle);
DocumentsToolbar toolbar = (DocumentsToolbar) findViewById(R.id.toolbar);
setActionBar(toolbar);
mNavigator = new NavigationView(mDrawer, toolbar, (Spinner) findViewById(R.id.stack), mState, this);
// Base classes must update result in their onCreate.
setResult(Activity.RESULT_CANCELED);
}
Aggregations