List of usage examples for android.animation AnimatorInflater loadStateListAnimator
public static StateListAnimator loadStateListAnimator(Context context, int id) throws NotFoundException
From source file:org.opensilk.common.ui.widget.FloatingActionButton.java
protected void init() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { switch (mColor) { case COLOR_BLACK: setBackgroundResource(R.drawable.fab_ripple_black); break; case COLOR_WHITE: setBackgroundResource(R.drawable.fab_ripple_white); break; case COLOR_ACCENT: default:/*from w w w . j a v a2 s.c om*/ setBackgroundResource(R.drawable.fab_ripple_accent); break; } setStateListAnimator(AnimatorInflater.loadStateListAnimator(getContext(), R.animator.fab_elevation)); setElevation(getResources().getDimension(R.dimen.fab_elevation)); // setImageResource(mIcon); return; } else { setBackgroundCompat(createSelectableDrawable()); // setImageResource(mIcon); } }
From source file:com.dm.wallpaper.board.fragments.CollectionFragment.java
private void initSearchBar() { Drawable drawable = ConfigurationHelper.getNavigationIcon(getActivity(), WallpaperBoardApplication.getConfig().getNavigationIcon()); int color = ColorHelper.getAttributeColor(getActivity(), R.attr.search_bar_icon); if (drawable != null) { mNavigation.setImageDrawable(DrawableHelper.getTintedDrawable(drawable, color)); }// ww w . j a v a2 s .co m mNavigation.setOnClickListener(view -> { if (getActivity() instanceof WallpaperBoardActivity) { ((WallpaperBoardActivity) getActivity()).openDrawer(); } }); ImageView searchIcon = getActivity().findViewById(R.id.search); if (searchIcon != null) { searchIcon.setImageDrawable( DrawableHelper.getTintedDrawable(getActivity(), R.drawable.ic_toolbar_search, color)); } TextView searchBarTitle = getActivity().findViewById(R.id.search_bar_title); if (searchBarTitle != null) { if (WallpaperBoardApplication.getConfig().getAppLogoColor() != -1) { searchBarTitle.setTextColor(WallpaperBoardApplication.getConfig().getAppLogoColor()); } else { searchBarTitle.setTextColor(ColorHelper.setColorAlpha(color, 0.7f)); } } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { if (mSearchBar.getLayoutParams() instanceof CoordinatorLayout.LayoutParams) { CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) mSearchBar .getLayoutParams(); params.setMargins(params.leftMargin, params.topMargin + WindowHelper.getStatusBarHeight(getActivity()), params.leftMargin, params.bottomMargin); } StateListAnimator stateListAnimator = AnimatorInflater.loadStateListAnimator(getActivity(), R.animator.card_lift); mSearchBar.setStateListAnimator(stateListAnimator); } mSearchBar.setOnClickListener(view -> { Intent intent = new Intent(getActivity(), WallpaperBoardBrowserActivity.class); intent.putExtra(Extras.EXTRA_FRAGMENT_ID, Extras.ID_WALLPAPER_SEARCH); intent.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); getActivity().overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); }); mMenuSort.setImageDrawable( DrawableHelper.getTintedDrawable(getActivity(), R.drawable.ic_toolbar_sort, color)); mMenuSort.setOnClickListener(view -> { Popup.Builder(getActivity()).to(mMenuSort).list(PopupItem.getSortItems(getActivity(), true)) .callback((popup, position) -> { Preferences.get(getActivity()).setSortBy(popup.getItems().get(position).getType()); refreshWallpapers(); popup.dismiss(); }).show(); }); }