Search in sources :

Example 1 with CustomAnimation

use of com.chad.baserecyclerviewadapterhelper.animation.CustomAnimation 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();
        }
    });
}
Also used : MaterialSpinner(com.jaredrummler.materialspinner.MaterialSpinner) CustomAnimation(com.chad.baserecyclerviewadapterhelper.animation.CustomAnimation) SwitchButton(com.kyleduo.switchbutton.SwitchButton) CompoundButton(android.widget.CompoundButton)

Aggregations

CompoundButton (android.widget.CompoundButton)1 CustomAnimation (com.chad.baserecyclerviewadapterhelper.animation.CustomAnimation)1 MaterialSpinner (com.jaredrummler.materialspinner.MaterialSpinner)1 SwitchButton (com.kyleduo.switchbutton.SwitchButton)1