Search in sources :

Example 1 with DefaultNoAnimator

use of me.yokeyword.fragmentation.anim.DefaultNoAnimator in project Fragmentation by YoKeyword.

the class HomeFragment method onMenuItemClick.

@Override
public boolean onMenuItemClick(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.action_anim:
            final PopupMenu popupMenu = new PopupMenu(_mActivity, mToolbar, GravityCompat.END);
            popupMenu.inflate(R.menu.home_pop);
            popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {

                @Override
                public boolean onMenuItemClick(MenuItem item) {
                    switch(item.getItemId()) {
                        case R.id.action_anim_veritical:
                            _mActivity.setFragmentAnimator(new DefaultVerticalAnimator());
                            Toast.makeText(_mActivity, "设置全局动画成功! 竖向", Toast.LENGTH_SHORT).show();
                            break;
                        case R.id.action_anim_horizontal:
                            _mActivity.setFragmentAnimator(new DefaultHorizontalAnimator());
                            Toast.makeText(_mActivity, "设置全局动画成功! 横向", Toast.LENGTH_SHORT).show();
                            break;
                        case R.id.action_anim_none:
                            _mActivity.setFragmentAnimator(new DefaultNoAnimator());
                            Toast.makeText(_mActivity, "设置全局动画成功! 无", Toast.LENGTH_SHORT).show();
                            break;
                    }
                    popupMenu.dismiss();
                    return true;
                }
            });
            popupMenu.show();
            break;
    }
    return true;
}
Also used : DefaultVerticalAnimator(me.yokeyword.fragmentation.anim.DefaultVerticalAnimator) DefaultHorizontalAnimator(me.yokeyword.fragmentation.anim.DefaultHorizontalAnimator) MenuItem(android.view.MenuItem) DefaultNoAnimator(me.yokeyword.fragmentation.anim.DefaultNoAnimator) PopupMenu(android.support.v7.widget.PopupMenu)

Aggregations

PopupMenu (android.support.v7.widget.PopupMenu)1 MenuItem (android.view.MenuItem)1 DefaultHorizontalAnimator (me.yokeyword.fragmentation.anim.DefaultHorizontalAnimator)1 DefaultNoAnimator (me.yokeyword.fragmentation.anim.DefaultNoAnimator)1 DefaultVerticalAnimator (me.yokeyword.fragmentation.anim.DefaultVerticalAnimator)1