use of com.jaredrummler.materialspinner.MaterialSpinnerAdapter in project cythara by gstraube.
the class MainActivity method setTuning.
private void setTuning() {
final SharedPreferences preferences = getSharedPreferences(PREFS_FILE, MODE_PRIVATE);
tuningPosition = preferences.getInt(CURRENT_TUNING, 0);
int textColorDark = getResources().getColor(R.color.colorTextDark);
MaterialSpinner spinner = findViewById(R.id.tuning);
MaterialSpinnerAdapter<String> adapter = new MaterialSpinnerAdapter<>(this, Arrays.asList(getResources().getStringArray(R.array.tunings)));
if (isDarkModeEnabled) {
spinner.setTextColor(textColorDark);
spinner.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
spinner.setTextColor(textColorDark);
spinner.setArrowColor(textColorDark);
}
spinner.setAdapter(adapter);
spinner.setOnItemSelectedListener(this);
spinner.setSelectedIndex(tuningPosition);
}
Aggregations