@Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { if (drawerItem instanceof AbstractDrawerItem && drawerItem.isEnabled()) { if (((AbstractDrawerItem) drawerItem).getSubItems() != null) { if (((AbstractDrawerItem) drawerItem).isExpanded()) { ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(ExpandableDrawerItem.this.arrowRotationAngleEnd).start(); } else { ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(ExpandableDrawerItem.this.arrowRotationAngleStart).start(); } } } return mOnDrawerItemClickListener != null && mOnDrawerItemClickListener.onItemClick(view, position, drawerItem); } };
@Override public boolean onItemClick(View view, int position, IDrawerItem drawerItem) { if (drawerItem instanceof AbstractDrawerItem && drawerItem.isEnabled()) { if (((AbstractDrawerItem) drawerItem).getSubItems() != null) { if (((AbstractDrawerItem) drawerItem).isExpanded()) { ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)).rotation(ExpandableBadgeDrawerItem.this.arrowRotationAngleEnd).start(); } else { ViewCompat.animate(view.findViewById(R.id.material_drawer_arrow)) .rotation(ExpandableBadgeDrawerItem.this.arrowRotationAngleStart) .start(); } } } return mOnDrawerItemClickListener != null && mOnDrawerItemClickListener.onItemClick(view, position, drawerItem); } };
@Override public boolean onClick(View v, IAdapter adapter, @NonNull SimpleSubExpandableItem item, int position) { if (item.getSubItems() != null) { if (!item.isExpanded()) { ViewCompat.animate(v.findViewById(R.id.material_drawer_icon)).rotation(180).start(); } else { ViewCompat.animate(v.findViewById(R.id.material_drawer_icon)).rotation(0).start(); } return mOnClickListener == null || mOnClickListener.onClick(v, adapter, item, position); } return mOnClickListener != null && mOnClickListener.onClick(v, adapter, item, position); } };
/** * helper method to reset the drawer content */ private void resetDrawerContent(Context ctx) { if (mDrawer != null) { mDrawer.resetDrawerContent(); } mAccountSwitcherArrow.clearAnimation(); ViewCompat.animate(mAccountSwitcherArrow).rotation(0).start(); //mAccountSwitcherArrow.setImageDrawable(new IconicsDrawable(ctx, MaterialDrawerFont.Icon.mdf_arrow_drop_down).sizeRes(R.dimen.material_drawer_account_header_dropdown).paddingRes(R.dimen.material_drawer_account_header_dropdown_padding).color(ColorHolder.color(mTextColor, ctx, R.attr.material_drawer_header_selection_text, R.color.material_drawer_header_selection_text))); }
/** * helper method to toggle the collection * * @param ctx */ protected void toggleSelectionList(Context ctx) { if (mDrawer != null) { //if we already show the list. reset everything instead if (mDrawer.switchedDrawerContent()) { resetDrawerContent(ctx); mSelectionListShown = false; } else { //build and set the drawer selection list buildDrawerSelectionList(); // update the arrow image within the drawer mAccountSwitcherArrow.clearAnimation(); ViewCompat.animate(mAccountSwitcherArrow).rotation(180).start(); //mAccountSwitcherArrow.setImageDrawable(new IconicsDrawable(ctx, MaterialDrawerFont.Icon.mdf_arrow_drop_up).sizeRes(R.dimen.material_drawer_account_header_dropdown).paddingRes(R.dimen.material_drawer_account_header_dropdown_padding).color(ColorHolder.color(mTextColor, ctx, R.attr.material_drawer_header_selection_text, R.color.material_drawer_header_selection_text))); mSelectionListShown = true; } } }
animator.translationZ(initialTranslationZ); animator.alpha(1.0f); animator.rotation(0); animator.scaleX(1.0f); animator.scaleY(1.0f);
public AnimatorExecutor rotation(float rotation) { animator.rotation(rotation); return this; }