use of fr.neamar.lolgamedata.adapter.RoleAdapter in project teamward-client by Neamar.
the class CounterChampionsActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_counter_champions);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
assert getSupportActionBar() != null;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(false);
// Setup spinner
Spinner spinner = (Spinner) findViewById(R.id.spinner);
spinner.setAdapter(new RoleAdapter(toolbar.getContext(), ROLES));
final Account account = (Account) getIntent().getSerializableExtra("account");
final SharedPreferences prefs = getPreferences(MODE_PRIVATE);
spinner.setSelection(prefs.getInt("lastUsedPosition", 2));
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
currentFragment = CounterChampionsFragment.newInstance(ROLES[position], account);
getSupportFragmentManager().beginTransaction().replace(R.id.container, currentFragment).commitAllowingStateLoss();
prefs.edit().putInt("lastUsedPosition", position).apply();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
}
Aggregations