當前位置: 首頁>>代碼示例>>Java>>正文


Java AnimatorInflater.loadStateListAnimator方法代碼示例

本文整理匯總了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();
}
 
開發者ID:zuoweitan,項目名稱:Hitalk,代碼行數:22,代碼來源:FloatingActionButton.java

示例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);
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:20,代碼來源:WallpapersAdapter.java

示例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();
}
 
開發者ID:cowthan,項目名稱:AyoSunny,代碼行數:22,代碼來源:FloatingActionButton.java

示例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();
}
 
開發者ID:himanshuagarwal77225,項目名稱:BookMySkills,代碼行數:23,代碼來源:FloatingActionButton.java

示例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);
}
 
開發者ID:PHELAT,項目名稱:Fun,代碼行數:14,代碼來源:FunnyButton.java

示例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
	{ }
}
 
開發者ID:MSay2,項目名稱:Mire,代碼行數:31,代碼來源:ButtonIcon.java

示例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();
  }
}
 
開發者ID:commonsguy,項目名稱:cwac-crossport,代碼行數:16,代碼來源:ViewUtilsLollipop.java

示例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);
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:34,代碼來源:CategoriesAdapter.java

示例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);
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:11,代碼來源:WallpaperDetailsCategoryAdapter.java

示例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();
    }
}
 
開發者ID:VyacheslavShmakin,項目名稱:GpCollapsingToolbar,代碼行數:14,代碼來源:ViewUtilsLollipop.java

示例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);
}
 
開發者ID:rubensousa,項目名稱:RaiflatButton,代碼行數:8,代碼來源:RaiflatUtils.java

示例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();
  }
}
 
開發者ID:material-components,項目名稱:material-components-android,代碼行數:16,代碼來源:ViewUtilsLollipop.java

示例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();
    });
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:69,代碼來源:CollectionFragment.java

示例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);
}
 
開發者ID:danimahardhika,項目名稱:wallpaperboard,代碼行數:45,代碼來源:LatestAdapter.java

示例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);
}
 
開發者ID:danimahardhika,項目名稱:candybar-library,代碼行數:43,代碼來源:WallpapersAdapter.java


注:本文中的android.animation.AnimatorInflater.loadStateListAnimator方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。