本文整理匯總了Java中android.animation.AnimatorInflater類的典型用法代碼示例。如果您正苦於以下問題:Java AnimatorInflater類的具體用法?Java AnimatorInflater怎麽用?Java AnimatorInflater使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AnimatorInflater類屬於android.animation包,在下文中一共展示了AnimatorInflater類的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: checkIndicatorConfig
import android.animation.AnimatorInflater; //導入依賴的package包/類
private void checkIndicatorConfig(Context context) {
mIndicatorWidth = (mIndicatorWidth < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorWidth;
mIndicatorHeight =
(mIndicatorHeight < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorHeight;
mIndicatorMargin =
(mIndicatorMargin < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorMargin;
mAnimatorResId = (mAnimatorResId == 0) ? R.animator.scale_with_alpha : mAnimatorResId;
mAnimationOut = AnimatorInflater.loadAnimator(context, mAnimatorResId);
if (mAnimatorReverseResId == 0) {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorResId);
mAnimationIn.setInterpolator(new ReverseInterpolator());
} else {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorReverseResId);
}
mIndicatorBackgroundResId = (mIndicatorBackgroundResId == 0) ? R.drawable.white_radius
: mIndicatorBackgroundResId;
mIndicatorUnselectedBackgroundResId =
(mIndicatorUnselectedBackgroundResId == 0) ? mIndicatorBackgroundResId
: mIndicatorUnselectedBackgroundResId;
}
示例3: enterBottomBar
import android.animation.AnimatorInflater; //導入依賴的package包/類
/**
* 底部導航條進入動畫
*/
public void enterBottomBar() {
String tab1 = HomeFragment.class.getSimpleName();
String tab2 = SquareFragment.class.getSimpleName();
String tab3 = MineFragment.class.getSimpleName();
String currentTab = getCurrentFragment() != null ? getCurrentFragment().getClass().getSimpleName() : "";
if (tab1.equals(currentTab) || tab2.equals(currentTab) || tab3.equals(currentTab)) {
if (mBnvNavigation != null) {
mBnvNavigation.post(new Runnable() {
@Override
public void run() {
Animator enterAnimator = AnimatorInflater.loadAnimator(MainContainerActivity.this, R.animator.bottom_enter);
enterAnimator.setTarget(mBnvNavigation);
enterAnimator.start();
}
});
}
}
}
示例4: createShowUpAnimator
import android.animation.AnimatorInflater; //導入依賴的package包/類
public Animator createShowUpAnimator(final View target) {
if (mHasCustomAnimationParams) {
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_X, mShowUpStartXScale,
KEY_PREVIEW_SHOW_UP_END_SCALE);
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_Y, mShowUpStartYScale,
KEY_PREVIEW_SHOW_UP_END_SCALE);
final AnimatorSet showUpAnimator = new AnimatorSet();
showUpAnimator.play(scaleXAnimator).with(scaleYAnimator);
showUpAnimator.setDuration(mShowUpDuration);
showUpAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
return showUpAnimator;
}
final Animator animator = AnimatorInflater.loadAnimator(
target.getContext(), mShowUpAnimatorResId);
animator.setTarget(target);
animator.setInterpolator(DECELERATE_INTERPOLATOR);
return animator;
}
示例5: createDismissAnimator
import android.animation.AnimatorInflater; //導入依賴的package包/類
public Animator createDismissAnimator(final View target) {
if (mHasCustomAnimationParams) {
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_X, mDismissEndXScale);
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
target, View.SCALE_Y, mDismissEndYScale);
final AnimatorSet dismissAnimator = new AnimatorSet();
dismissAnimator.play(scaleXAnimator).with(scaleYAnimator);
final int dismissDuration = Math.min(mDismissDuration, mLingerTimeout);
dismissAnimator.setDuration(dismissDuration);
dismissAnimator.setInterpolator(ACCELERATE_INTERPOLATOR);
return dismissAnimator;
}
final Animator animator = AnimatorInflater.loadAnimator(
target.getContext(), mDismissAnimatorResId);
animator.setTarget(target);
animator.setInterpolator(ACCELERATE_INTERPOLATOR);
return animator;
}
示例6: onCreate
import android.animation.AnimatorInflater; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_timer);
tvHour = (TextView) findViewById(R.id.tvHour);
tvSeparator = (TextView) findViewById(R.id.tvSeparator);
tvMinute = (TextView) findViewById(R.id.tvMinute);
tvHour.setText(getHour());
tvMinute.setText(getMinute());
// animacion en el separador de horas
set = (AnimatorSet) AnimatorInflater.loadAnimator(this, R.animator.ticker_tick);
set.setTarget(tvSeparator);
set.start();
}
示例7: setupAnimation
import android.animation.AnimatorInflater; //導入依賴的package包/類
private void setupAnimation(View view, final Animator animation, final int animationID) {
view.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// If the button is checked, load the animation from the given resource
// id instead of using the passed-in animation parameter. See the xml files
// for the details on those animations.
if (mCheckBox.isChecked()) {
Animator anim = AnimatorInflater.loadAnimator(PropertyAnimations.this, animationID);
anim.setTarget(v);
anim.start();
return;
}
animation.start();
}
});
}
示例8: 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);
}
示例9: beginAnimation
import android.animation.AnimatorInflater; //導入依賴的package包/類
private void beginAnimation() {
if (animId > 0) {
anim = AnimationUtils.loadAnimation(getContext(), animId);
startAnimation(anim);
}
if (animatorId > 0) {
animator = AnimatorInflater.loadAnimator(getContext(), animatorId);
animator.setTarget(this);
animator.start();
}
Drawable drawable = getDrawable();
if (drawable instanceof Animatable2) {
if (callback != null) {
((Animatable2) drawable).registerAnimationCallback(callback);
}
((Animatable2) drawable).start();
}
}
示例10: checkIndicatorConfig
import android.animation.AnimatorInflater; //導入依賴的package包/類
private void checkIndicatorConfig(Context context) {
mIndicatorWidth = (mIndicatorWidth < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorWidth;
mIndicatorHeight =
(mIndicatorHeight < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorHeight;
mIndicatorMargin =
(mIndicatorMargin < 0) ? dip2px(DEFAULT_INDICATOR_WIDTH) : mIndicatorMargin;
mAnimatorResId = (mAnimatorResId == 0) ? R.animator.scale_with_alpha : mAnimatorResId;
mAnimationOut = AnimatorInflater.loadAnimator(context, mAnimatorResId);
if (mAnimatorReverseResId == 0) {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorResId);
mAnimationIn.setInterpolator(new ReverseInterpolator());
} else {
mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorReverseResId);
}
mIndicatorBackgroundResId = (mIndicatorBackgroundResId == 0) ? R.drawable.white_radius
: mIndicatorBackgroundResId;
mIndicatorUnselectedBackgroundResId =
(mIndicatorUnselectedBackgroundResId == 0) ? mIndicatorBackgroundResId
: mIndicatorUnselectedBackgroundResId;
}
示例11: ProgramInfoViewBase
import android.animation.AnimatorInflater; //導入依賴的package包/類
public ProgramInfoViewBase(Context context, AttributeSet attrs) {
super(context, attrs);
setOrientation(LinearLayout.VERTICAL);
setGravity(Gravity.CENTER_VERTICAL);
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//noinspection ConstantConditions
inflater.inflate(getViewId(), this, true);
ButterKnife.bind(this, this);
showProgressAnimator = (ObjectAnimator) AnimatorInflater.loadAnimator(context,
R.animator.view_program_info_show_progress);
showProgressAnimator.setTarget(progressBarView);
}
示例12: loadResources
import android.animation.AnimatorInflater; //導入依賴的package包/類
static void loadResources(Context context) {
if (sFocusedNumberEnterAnimator == null) {
TypedValue outValue = new TypedValue();
context.getResources().getValue(
R.dimen.pin_alpha_for_focused_number, outValue, true);
sAlphaForFocusedNumber = outValue.getFloat();
context.getResources().getValue(
R.dimen.pin_alpha_for_adjacent_number, outValue, true);
sAlphaForAdjacentNumber = outValue.getFloat();
sFocusedNumberEnterAnimator = AnimatorInflater.loadAnimator(context,
R.animator.pin_focused_number_enter);
sFocusedNumberExitAnimator = AnimatorInflater.loadAnimator(context,
R.animator.pin_focused_number_exit);
sAdjacentNumberEnterAnimator = AnimatorInflater.loadAnimator(context,
R.animator.pin_adjacent_number_enter);
sAdjacentNumberExitAnimator = AnimatorInflater.loadAnimator(context,
R.animator.pin_adjacent_number_exit);
}
}
示例13: createAnimator
import android.animation.AnimatorInflater; //導入依賴的package包/類
private Animator createAnimator(int sidePanelAnimResId, int sidePanelGridAnimResId,
int tableAnimResId) {
List<Animator> animatorList = new ArrayList<>();
Animator sidePanelAnimator = AnimatorInflater.loadAnimator(mActivity, sidePanelAnimResId);
sidePanelAnimator.setTarget(mSidePanel);
animatorList.add(sidePanelAnimator);
if (sidePanelGridAnimResId != 0) {
Animator sidePanelGridAnimator = AnimatorInflater.loadAnimator(mActivity,
sidePanelGridAnimResId);
sidePanelGridAnimator.setTarget(mSidePanelGridView);
sidePanelGridAnimator.addListener(
new HardwareLayerAnimatorListenerAdapter(mSidePanelGridView));
animatorList.add(sidePanelGridAnimator);
}
Animator tableAnimator = AnimatorInflater.loadAnimator(mActivity, tableAnimResId);
tableAnimator.setTarget(mTable);
tableAnimator.addListener(new HardwareLayerAnimatorListenerAdapter(mTable));
animatorList.add(tableAnimator);
AnimatorSet set = new AnimatorSet();
set.playTogether(animatorList);
return set;
}
示例14: onFinishInflate
import android.animation.AnimatorInflater; //導入依賴的package包/類
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mContainerView = findViewById(R.id.block_screen_container);
mImageContainer = findViewById(R.id.image_container);
mNormalImageView = (ImageView) findViewById(R.id.block_screen_icon);
mShrunkenImageView = (ImageView) findViewById(R.id.block_screen_shrunken_icon);
mSpace = findViewById(R.id.space);
mTextView = (TextView) findViewById(R.id.block_screen_text);
mFadeIn = AnimatorInflater.loadAnimator(getContext(),
R.animator.tvview_block_screen_fade_in);
mFadeIn.setTarget(mContainerView);
mFadeOut = AnimatorInflater.loadAnimator(getContext(),
R.animator.tvview_block_screen_fade_out);
mFadeOut.setTarget(mContainerView);
mFadeOut.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mContainerView.setVisibility(GONE);
mContainerView.setAlpha(1f);
}
});
}
示例15: SideFragmentManager
import android.animation.AnimatorInflater; //導入依賴的package包/類
public SideFragmentManager(Activity activity, Runnable preShowRunnable,
Runnable postHideRunnable) {
mActivity = activity;
mFragmentManager = mActivity.getFragmentManager();
mPreShowRunnable = preShowRunnable;
mPostHideRunnable = postHideRunnable;
mPanel = mActivity.findViewById(R.id.side_panel);
mShowAnimator = AnimatorInflater.loadAnimator(mActivity, R.animator.side_panel_enter);
mShowAnimator.setTarget(mPanel);
mHideAnimator = AnimatorInflater.loadAnimator(mActivity, R.animator.side_panel_exit);
mHideAnimator.setTarget(mPanel);
mHideAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
// Animation is still in running state at this point.
hideAllInternal();
}
});
mShowDurationMillis = mActivity.getResources().getInteger(
R.integer.side_panel_show_duration);
}