Search in sources :

Example 86 with Spinner

use of android.widget.Spinner in project RecyclerViewItemAnimators by gabrielemariotti.

the class AnimationListActivity method setupSpinner.

private void setupSpinner() {
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.adapters, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    spinner.setAdapter(adapter);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
            switch(position) {
                case 0:
                    AlphaAnimatorAdapter animatorAdapter = new AlphaAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(animatorAdapter);
                    break;
                case 1:
                    SlideInLeftAnimatorAdapter slideInLeftAnimationRecyclerViewAdapter = new SlideInLeftAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInLeftAnimationRecyclerViewAdapter);
                    break;
                case 2:
                    SlideInRightAnimatorAdapter slideInRightAnimatorAdapter = new SlideInRightAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInRightAnimatorAdapter);
                    break;
                case 3:
                    SlideInBottomAnimatorAdapter slideInBottomAnimatorAdapter = new SlideInBottomAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(slideInBottomAnimatorAdapter);
                    break;
                case 4:
                    ScaleInAnimatorAdapter scaleInRecyclerViewAnimationAdapter = new ScaleInAnimatorAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(scaleInRecyclerViewAnimationAdapter);
                    break;
                case 5:
                    SwingBottomInAnimationAdapter swingBottomInAnimationAdapter = new SwingBottomInAnimationAdapter(mAdapter, mRecyclerView);
                    mRecyclerView.setAdapter(swingBottomInAnimationAdapter);
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
}
Also used : Spinner(android.widget.Spinner) SwingBottomInAnimationAdapter(it.gmariotti.recyclerview.adapter.SwingBottomInAnimationAdapter) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) SlideInBottomAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInBottomAnimatorAdapter) ScaleInAnimatorAdapter(it.gmariotti.recyclerview.adapter.ScaleInAnimatorAdapter) SlideInLeftAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInLeftAnimatorAdapter) AlphaAnimatorAdapter(it.gmariotti.recyclerview.adapter.AlphaAnimatorAdapter) AdapterView(android.widget.AdapterView) SlideInRightAnimatorAdapter(it.gmariotti.recyclerview.adapter.SlideInRightAnimatorAdapter)

Example 87 with Spinner

use of android.widget.Spinner in project RecyclerViewItemAnimators by gabrielemariotti.

the class GridActivity method setupSpinner.

private void setupSpinner() {
    Spinner spinner = (Spinner) findViewById(R.id.spinner);
    // Create an ArrayAdapter using the string array and a default spinner layout
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.animators, android.R.layout.simple_spinner_item);
    // Specify the layout to use when the list of choices appears
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    // Apply the adapter to the spinner
    spinner.setAdapter(adapter);
    spinner.setSelection(1);
    spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int position, long l) {
            switch(position) {
                case 0:
                    mRecyclerView.setItemAnimator(new SlideInOutLeftItemAnimator(mRecyclerView));
                    break;
                case 1:
                    mRecyclerView.setItemAnimator(new SlideInOutRightItemAnimator(mRecyclerView));
                    break;
                case 2:
                    mRecyclerView.setItemAnimator(new SlideInOutTopItemAnimator(mRecyclerView));
                    break;
                case 3:
                    mRecyclerView.setItemAnimator(new SlideInOutBottomItemAnimator(mRecyclerView));
                    break;
                case 4:
                    mRecyclerView.setItemAnimator(new ScaleInOutItemAnimator(mRecyclerView));
                    break;
                case 5:
                    mRecyclerView.setItemAnimator(new SlideScaleInOutRightItemAnimator(mRecyclerView));
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
}
Also used : Spinner(android.widget.Spinner) SlideInOutTopItemAnimator(it.gmariotti.recyclerview.itemanimator.SlideInOutTopItemAnimator) SlideInOutRightItemAnimator(it.gmariotti.recyclerview.itemanimator.SlideInOutRightItemAnimator) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) AdapterView(android.widget.AdapterView) SlideInOutLeftItemAnimator(it.gmariotti.recyclerview.itemanimator.SlideInOutLeftItemAnimator) ScaleInOutItemAnimator(it.gmariotti.recyclerview.itemanimator.ScaleInOutItemAnimator) SlideScaleInOutRightItemAnimator(it.gmariotti.recyclerview.itemanimator.SlideScaleInOutRightItemAnimator) AdapterView(android.widget.AdapterView) SlideInOutBottomItemAnimator(it.gmariotti.recyclerview.itemanimator.SlideInOutBottomItemAnimator)

Example 88 with Spinner

use of android.widget.Spinner in project EventBus by greenrobot.

the class TestSetupActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_setuptests);
    Spinner spinnerRun = (Spinner) findViewById(R.id.spinnerTestToRun);
    spinnerRun.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> adapter, View v, int pos, long lng) {
            int eventsVisibility = pos == 0 ? View.VISIBLE : View.GONE;
            findViewById(R.id.relativeLayoutForEvents).setVisibility(eventsVisibility);
            findViewById(R.id.spinnerThread).setVisibility(eventsVisibility);
        }

        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });
}
Also used : Spinner(android.widget.Spinner) AdapterView(android.widget.AdapterView) View(android.view.View) AdapterView(android.widget.AdapterView)

Example 89 with Spinner

use of android.widget.Spinner in project standup-timer by jwood.

the class ConfigureStandupTimer method onClick.

public void onClick(View v) {
    Intent i = new Intent(this, StandupTimer.class);
    meetingLength = getMeetingLengthFromUI();
    i.putExtra("meetingLength", meetingLength);
    TextView t = (TextView) findViewById(R.id.num_participants);
    numParticipants = parseNumberOfParticipants(t);
    i.putExtra("numParticipants", numParticipants);
    Spinner teamNameSpinner = (Spinner) findViewById(R.id.team_names);
    teamNamesPos = teamNameSpinner.getSelectedItemPosition();
    i.putExtra("teamName", (String) teamNameSpinner.getSelectedItem());
    if (numParticipants < 1 || (Prefs.allowUnlimitedParticipants(this) == false && numParticipants > 20)) {
        showInvalidNumberOfParticipantsDialog();
    } else {
        saveState();
        startTimer(i);
    }
}
Also used : Spinner(android.widget.Spinner) Intent(android.content.Intent) TextView(android.widget.TextView)

Example 90 with Spinner

use of android.widget.Spinner in project standup-timer by jwood.

the class ConfigureStandupTimer method initializeTeamNamesSpinner.

private void initializeTeamNamesSpinner() {
    Spinner s = (Spinner) findViewById(R.id.team_names);
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, Team.findAllTeamNames(this));
    adapter.add(" [No Team] ");
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    s.setAdapter(adapter);
    s.setSelection(teamNamesPos);
}
Also used : Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter)

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