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) {
}
});
}
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) {
}
});
}
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) {
}
});
}
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);
}
}
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);
}
Aggregations