本文整理匯總了Java中android.animation.AnimatorInflater.loadStateListAnimator方法的典型用法代碼示例。如果您正苦於以下問題:Java AnimatorInflater.loadStateListAnimator方法的具體用法?Java AnimatorInflater.loadStateListAnimator怎麽用?Java AnimatorInflater.loadStateListAnimator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.animation.AnimatorInflater
的用法示例。
在下文中一共展示了AnimatorInflater.loadStateListAnimator方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
@SuppressLint("NewApi")
private void init(Context context, AttributeSet attributeSet) {
mVisible = true;
mColorNormal = getColor(R.color.material_blue_500);
mColorPressed = darkenColor(mColorNormal);
mColorRipple = lightenColor(mColorNormal);
mColorDisabled = getColor(android.R.color.darker_gray);
mType = TYPE_NORMAL;
mShadow = true;
mScrollThreshold = getResources().getDimensionPixelOffset(R.dimen.fab_scroll_threshold);
mShadowSize = getDimension(R.dimen.fab_shadow_size);
if (hasLollipopApi()) {
StateListAnimator stateListAnimator = AnimatorInflater.loadStateListAnimator(context,
R.animator.fab_press_elevation);
setStateListAnimator(stateListAnimator);
}
if (attributeSet != null) {
initAttributes(context, attributeSet);
}
updateBackground();
}
示例2: ViewHolder
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
setCardViewToFlat(card);
if (!Preferences.get(mContext).isShadowEnabled()) {
card.setCardElevation(0f);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StateListAnimator stateListAnimator = AnimatorInflater
.loadStateListAnimator(mContext, R.animator.card_lift_long);
card.setStateListAnimator(stateListAnimator);
}
card.setOnClickListener(this);
card.setOnLongClickListener(this);
favorite.setOnClickListener(this);
}
示例3: init
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
@SuppressLint("NewApi")
private void init(Context context, AttributeSet attributeSet) {
mVisible = true;
mColorNormal = getColor(R.color.material_blue_500);
mColorPressed = darkenColor(mColorNormal);
mColorRipple = lightenColor(mColorNormal);
mColorDisabled = getColor(android.R.color.darker_gray);
mType = TYPE_NORMAL;
mShadow = true;
mScrollThreshold = getResources().getDimensionPixelOffset(R.dimen.fab_scroll_threshold);
mShadowSize = getDimension(R.dimen.fab_shadow_size);
if (hasLollipopApi()) {
StateListAnimator stateListAnimator = AnimatorInflater.loadStateListAnimator(context,
R.anim.fab_press_elevation);
setStateListAnimator(stateListAnimator);
}
if (attributeSet != null) {
initAttributes(context, attributeSet);
}
updateBackground();
}
示例4: init
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
@SuppressLint("NewApi")
private void init(Context context, AttributeSet attributeSet) {
mVisible = true;
mColorNormal = getColor(R.color.material_blue_500);
mColorPressed = darkenColor(mColorNormal);
mColorRipple = lightenColor(mColorNormal);
mColorDisabled = getColor(android.R.color.darker_gray);
mType = TYPE_NORMAL;
mShadow = true;
mScrollThreshold = getResources().getDimensionPixelOffset(
R.dimen.fab_scroll_threshold);
mShadowSize = getDimension(R.dimen.fab_shadow_size);
if (hasLollipopApi()) {
StateListAnimator stateListAnimator = AnimatorInflater
.loadStateListAnimator(context, R.anim.fab_press_elevation);
setStateListAnimator(stateListAnimator);
}
if (attributeSet != null) {
initAttributes(context, attributeSet);
}
updateBackground();
}
示例5: FunnyButton
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
public FunnyButton(Context context) {
super(context);
setPreventCornerOverlap(false);
setUseCompatPadding(true);
setClickable(true);
if (Build.VERSION.SDK_INT >= 21){
stateListAnimator = AnimatorInflater
.loadStateListAnimator(context, R.anim.card_ripple_touch);
setStateListAnimator(stateListAnimator);
}
setForeground(ContextCompat.getDrawable(context, R.drawable.card_ripple));
textView = new TextView(context);
}
示例6: initView
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
private void initView(Context context)
{
inflater.inflate(R.layout.ms__button, this, true);
Resources res = getResources();
StateListAnimator sla = AnimatorInflater.loadStateListAnimator(context, R.animator.button_elevation);
setBackground(res.getDrawable(R.drawable.button_background));
setStateListAnimator(sla);
setOrientation(LinearLayout.HORIZONTAL);
setGravity(Gravity.CENTER);
setOnClickListener(null);
content = findViewById(R.id.ms__content);
buttonIcon = (ImageView)content.findViewById(R.id.ms__button_icon);
buttonIcon.setImageResource(mResource);
buttonIcon.setImageDrawable(mDrawable);
buttonText = (TextView)content.findViewById(R.id.ms__button_text);
buttonText.setText(mText);
buttonText.setTextColor(mTextColor);
buttonText.setTextSize(mTextSize);
if (mState)
{
buttonText.setTypeface(mTypface);
}
else
{ }
}
示例7: setStateListAnimatorFromAttrs
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
static void setStateListAnimatorFromAttrs(View view, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
final Context context = view.getContext();
final TypedArray a = context.obtainStyledAttributes(attrs, STATE_LIST_ANIM_ATTRS,
defStyleAttr, defStyleRes);
try {
if (a.hasValue(0)) {
StateListAnimator sla = AnimatorInflater.loadStateListAnimator(context,
a.getResourceId(0, 0));
view.setStateListAnimator(sla);
}
} finally {
a.recycle();
}
}
示例8: ViewHolder
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
if (mContext.getResources().getInteger(R.integer.categories_column_count) == 1) {
if (card.getLayoutParams() instanceof GridLayoutManager.LayoutParams) {
GridLayoutManager.LayoutParams params =
(GridLayoutManager.LayoutParams) card.getLayoutParams();
params.leftMargin = 0;
params.rightMargin = 0;
params.topMargin = 0;
params.bottomMargin = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
params.setMarginEnd(0);
}
}
} else {
setCardViewToFlat(card);
}
if (!Preferences.get(mContext).isShadowEnabled()) {
card.setCardElevation(0f);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StateListAnimator stateListAnimator = AnimatorInflater
.loadStateListAnimator(mContext, R.animator.card_lift_long);
card.setStateListAnimator(stateListAnimator);
}
card.setOnClickListener(this);
}
示例9: ViewHolder
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StateListAnimator stateListAnimator = AnimatorInflater
.loadStateListAnimator(mContext, R.animator.card_lift_long);
card.setStateListAnimator(stateListAnimator);
}
card.setOnClickListener(this);
}
示例10: setStateListAnimatorFromAttrs
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
static void setStateListAnimatorFromAttrs(View view, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
final Context context = view.getContext();
final TypedArray a = context.obtainStyledAttributes(attrs, STATE_LIST_ANIM_ATTRS,
defStyleAttr, defStyleRes);
try {
if (a.hasValue(0)) {
StateListAnimator sla = AnimatorInflater.loadStateListAnimator(context, a.getResourceId(0, 0));
view.setStateListAnimator(sla);
}
} finally {
a.recycle();
}
}
示例11: setupRaiflat
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public static void setupRaiflat(View view) {
StateListAnimator stateListAnimator
= AnimatorInflater.loadStateListAnimator(view.getContext(),
R.drawable.raiflatbutton_statelistanimator);
view.setStateListAnimator(stateListAnimator);
}
示例12: setStateListAnimatorFromAttrs
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
static void setStateListAnimatorFromAttrs(
View view, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
final Context context = view.getContext();
final TypedArray a =
context.obtainStyledAttributes(attrs, STATE_LIST_ANIM_ATTRS, defStyleAttr, defStyleRes);
try {
if (a.hasValue(0)) {
StateListAnimator sla =
AnimatorInflater.loadStateListAnimator(context, a.getResourceId(0, 0));
view.setStateListAnimator(sla);
}
} finally {
a.recycle();
}
}
示例13: initSearchBar
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
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));
}
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();
});
}
示例14: ViewHolder
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
ViewHolder(View itemView) {
super(itemView);
ButterKnife.bind(this, itemView);
if (mContext.getResources().getInteger(R.integer.latest_wallpapers_column_count) == 1) {
if (card.getLayoutParams() instanceof StaggeredGridLayoutManager.LayoutParams) {
StaggeredGridLayoutManager.LayoutParams params =
(StaggeredGridLayoutManager.LayoutParams) card.getLayoutParams();
params.leftMargin = 0;
params.rightMargin = 0;
params.topMargin = 0;
params.bottomMargin = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
params.setMarginEnd(0);
}
}
} else {
setCardViewToFlat(card);
}
if (!Preferences.get(mContext).isShadowEnabled()) {
card.setCardElevation(0f);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StateListAnimator stateListAnimator = AnimatorInflater
.loadStateListAnimator(mContext, R.animator.card_lift_long);
card.setStateListAnimator(stateListAnimator);
}
if (mContext.getResources().getBoolean(R.bool.enable_wallpaper_download)) {
download.setImageDrawable(DrawableHelper.getTintedDrawable(
mContext, R.drawable.ic_toolbar_download, Color.WHITE));
download.setOnClickListener(this);
}
apply.setImageDrawable(DrawableHelper.getTintedDrawable(
mContext, R.drawable.ic_toolbar_apply_options, Color.WHITE));
card.setOnClickListener(this);
favorite.setOnClickListener(this);
apply.setOnClickListener(this);
}
示例15: ViewHolder
import android.animation.AnimatorInflater; //導入方法依賴的package包/類
ViewHolder(View itemView) {
super(itemView);
String viewStyle = mContext.getResources().getString(
R.string.wallpaper_grid_preview_style);
Point ratio = ViewHelper.getWallpaperViewRatio(viewStyle);
image = itemView.findViewById(R.id.image);
image.setRatio(ratio.x, ratio.y);
card = itemView.findViewById(R.id.card);
if (CandyBarApplication.getConfiguration().getWallpapersGrid() == CandyBarApplication.GridStyle.FLAT) {
if (card.getLayoutParams() instanceof GridLayoutManager.LayoutParams) {
card.setRadius(0f);
card.setUseCompatPadding(false);
int margin = mContext.getResources().getDimensionPixelSize(R.dimen.card_margin);
GridLayoutManager.LayoutParams params = (GridLayoutManager.LayoutParams) card.getLayoutParams();
params.setMargins(0, 0, margin, margin);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
params.setMarginEnd(margin);
}
}
}
if (!Preferences.get(mContext).isCardShadowEnabled()) {
card.setCardElevation(0);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
StateListAnimator stateListAnimator = AnimatorInflater
.loadStateListAnimator(mContext, R.animator.card_lift);
card.setStateListAnimator(stateListAnimator);
}
if (mIsShowName) {
name = itemView.findViewById(R.id.name);
author = itemView.findViewById(R.id.author);
}
card.setOnClickListener(this);
card.setOnLongClickListener(this);
}