use of com.jaredrummler.materialspinner.MaterialSpinner in project BaseRecyclerViewAdapterHelper by CymChad.
the class AnimationUseActivity method initMenu.
private void initMenu() {
MaterialSpinner spinner = (MaterialSpinner) findViewById(R.id.spinner);
spinner.setItems("AlphaIn", "ScaleIn", "SlideInBottom", "SlideInLeft", "SlideInRight", "Custom");
spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
@Override
public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
switch(position) {
case 0:
mAnimationAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN);
break;
case 1:
mAnimationAdapter.openLoadAnimation(BaseQuickAdapter.SCALEIN);
break;
case 2:
mAnimationAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_BOTTOM);
break;
case 3:
mAnimationAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_LEFT);
break;
case 4:
mAnimationAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
break;
case 5:
mAnimationAdapter.openLoadAnimation(new CustomAnimation());
break;
default:
break;
}
mRecyclerView.setAdapter(mAnimationAdapter);
}
});
SwitchButton switchButton = (SwitchButton) findViewById(R.id.switch_button);
switchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
if (isChecked) {
mAnimationAdapter.isFirstOnly(true);
} else {
mAnimationAdapter.isFirstOnly(false);
}
mAnimationAdapter.notifyDataSetChanged();
}
});
}
use of com.jaredrummler.materialspinner.MaterialSpinner 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);
}
use of com.jaredrummler.materialspinner.MaterialSpinner in project BaseRecyclerViewAdapterHelper by CymChad.
the class AnimationUseActivity method initMenu.
private void initMenu() {
MaterialSpinner spinner = findViewById(R.id.spinner);
spinner.setItems("AlphaIn", "ScaleIn", "SlideInBottom", "SlideInLeft", "SlideInRight", "Custom1", "Custom2");
spinner.setOnItemSelectedListener(new MaterialSpinner.OnItemSelectedListener<String>() {
@Override
public void onItemSelected(MaterialSpinner view, int position, long id, String item) {
switch(position) {
case 0:
mAnimationAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.AlphaIn);
break;
case 1:
mAnimationAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.ScaleIn);
break;
case 2:
mAnimationAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInBottom);
break;
case 3:
mAnimationAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInLeft);
break;
case 4:
mAnimationAdapter.setAnimationWithDefault(BaseQuickAdapter.AnimationType.SlideInRight);
break;
case 5:
mAnimationAdapter.setAdapterAnimation(new CustomAnimation1());
break;
case 6:
mAnimationAdapter.setAdapterAnimation(new CustomAnimation2());
break;
default:
break;
}
mRecyclerView.setAdapter(mAnimationAdapter);
}
});
// init firstOnly state
mAnimationAdapter.setAnimationFirstOnly(false);
SwitchButton switchButton = findViewById(R.id.switch_button);
switchButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(final CompoundButton buttonView, final boolean isChecked) {
if (isChecked) {
mAnimationAdapter.setAnimationFirstOnly(true);
} else {
mAnimationAdapter.setAnimationFirstOnly(false);
}
mAnimationAdapter.notifyDataSetChanged();
}
});
}
Aggregations