Search in sources :

Example 76 with Spinner

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));
}
Also used : Spinner(android.widget.Spinner) CheckBox(android.widget.CheckBox) CheckedTextView(android.widget.CheckedTextView) RadioButton(android.widget.RadioButton) Checkable(android.widget.Checkable)

Example 77 with Spinner

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();
    }
}
Also used : Spinner(android.widget.Spinner) LinearLayout(android.widget.LinearLayout)

Example 78 with Spinner

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);
}
Also used : Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Example 79 with Spinner

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;
}
Also used : Spinner(android.widget.Spinner) LinearLayout(android.widget.LinearLayout)

Example 80 with 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);
}
Also used : Spinner(android.widget.Spinner) Intent(android.content.Intent) Date(java.util.Date) CallSuper(android.support.annotation.CallSuper)

Aggregations

Spinner (android.widget.Spinner)160 View (android.view.View)70 AdapterView (android.widget.AdapterView)58 TextView (android.widget.TextView)51 ArrayAdapter (android.widget.ArrayAdapter)50 LinearLayout (android.widget.LinearLayout)29 EditText (android.widget.EditText)20 Intent (android.content.Intent)19 Button (android.widget.Button)19 RecyclerView (android.support.v7.widget.RecyclerView)18 CompoundButton (android.widget.CompoundButton)16 ViewGroup (android.view.ViewGroup)13 ImageView (android.widget.ImageView)13 DialogInterface (android.content.DialogInterface)12 CheckBox (android.widget.CheckBox)11 ListView (android.widget.ListView)11 ArrayList (java.util.ArrayList)11 AutoCompleteTextView (android.widget.AutoCompleteTextView)9 AlertDialog (android.app.AlertDialog)7 LayoutInflater (android.view.LayoutInflater)7