Java 类android.animation.AnimatorInflater 实例源码

项目:Hitalk    文件:FloatingActionButton.java   
@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();
}
项目:XERUNG    文件:CircleIndicator.java   
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;
}
项目:XERUNG    文件:CircleIndicator.java   
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;
}
项目:Closet    文件:MainContainerActivity.java   
/**
 * 底部导航条进入动画
 */
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();
                }
            });
        }
    }
}
项目:simple-keyboard    文件:KeyPreviewDrawParams.java   
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;
}
项目:simple-keyboard    文件:KeyPreviewDrawParams.java   
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;
}
项目:Android-2017    文件:TimerActivity.java   
@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();


}
项目:buildAPKsSamples    文件:PropertyAnimations.java   
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();
        }
    });
}
项目:FindX    文件:CircleIndicator.java   
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;
}
项目:wallpaperboard    文件:WallpapersAdapter.java   
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);
}
项目:PresenterLite    文件:AnimatedImageView.java   
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();
    }
}
项目:AOSP-Kayboard-7.1.2    文件:KeyPreviewDrawParams.java   
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;
}
项目:AOSP-Kayboard-7.1.2    文件:KeyPreviewDrawParams.java   
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;
}
项目:RxZhiHu    文件:CircleIndicator.java   
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;
    }
项目:zapp    文件:ProgramInfoViewBase.java   
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);
}
项目:android_packages_apps_tv    文件:PinDialogFragment.java   
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);
    }
}
项目:android_packages_apps_tv    文件:ProgramGuide.java   
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;
}
项目:android_packages_apps_tv    文件:BlockScreenView.java   
@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);
        }
    });
}
项目:android_packages_apps_tv    文件:SideFragmentManager.java   
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);
}
项目:android_packages_apps_tv    文件:SideFragmentManager.java   
/**
 * Hide the side panel. This method just hide the panel and preserves the back
 * stack. If you want to empty the back stack, call {@link #hideAll}.
 */
public void hideSidePanel(boolean withAnimation) {
    mHandler.removeCallbacks(mHideAllRunnable);
    if (withAnimation) {
        Animator hideAnimator =
                AnimatorInflater.loadAnimator(mActivity, R.animator.side_panel_exit);
        hideAnimator.setTarget(mPanel);
        hideAnimator.start();
        hideAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mPanel.setVisibility(View.GONE);
            }
        });
    } else {
        mPanel.setVisibility(View.GONE);
    }
}
项目:StarWarsOpening    文件:OpeningActivity.java   
private void startIntroTextAnimation() {
    if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Animator introAnimator = AnimatorInflater.loadAnimator(this, R.animator.intro);
        introAnimator.setTarget(introTextView);
        introAnimator.start();
    } else {
        Keyframe kf0 = Keyframe.ofFloat(0f, 0);
        Keyframe kf1 = Keyframe.ofFloat(.2f, 1);
        Keyframe kf2 = Keyframe.ofFloat(.9f, 1);
        Keyframe kf3 = Keyframe.ofFloat(1f, 0);
        PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("alpha", kf0, kf1, kf2, kf3);
        ObjectAnimator alphaAnimator = ObjectAnimator.ofPropertyValuesHolder(introTextView, pvh);
        alphaAnimator.setInterpolator(new DecelerateInterpolator());
        alphaAnimator.setDuration(6000).setStartDelay(1000);
        alphaAnimator.start();
    }
}
项目:StarWarsOpening    文件:OpeningActivity.java   
private void startLogoAnimation() {
    if ( Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        Animator logoAnimator = AnimatorInflater.loadAnimator(this, R.animator.logo);
        logoAnimator.setTarget(logoView);
        logoAnimator.start();
    } else {
        AnimatorSet animatorSet = new AnimatorSet();
        PropertyValuesHolder pvh = PropertyValuesHolder.ofKeyframe("alpha",
                Keyframe.ofFloat(0f, 1),
                Keyframe.ofFloat(.5f, 1),
                Keyframe.ofFloat(1f, 0));
        ObjectAnimator alphaAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        pvh = PropertyValuesHolder.ofKeyframe("scaleX", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
        ObjectAnimator scaleXAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        pvh = PropertyValuesHolder.ofKeyframe("scaleY", Keyframe.ofFloat(0f, 2.75f), Keyframe.ofFloat(1f, .1f));
        ObjectAnimator scaleYAnimator = ObjectAnimator.ofPropertyValuesHolder(logoView, pvh);

        animatorSet.setInterpolator(new DecelerateInterpolator());
        animatorSet.setDuration(9000).setStartDelay(9000);
        animatorSet.playTogether(alphaAnimator, scaleXAnimator, scaleYAnimator);
        animatorSet.start();
    }
}
项目:PlayTogether    文件:RecorderButton.java   
public RecorderButton(Context context, AttributeSet attrs)
    {
        super(context, attrs);
        mBtnAnim = AnimatorInflater.loadAnimator(getContext(), R.animator.recorder_btn_press_anim);
        mBtnAnim.setTarget(this);
        mDialogManager = new RecorderDialogManager(context);
        mAudioManager = AudioManager.getInstance();
        this.setOnLongClickListener(new OnLongClickListener()
        {
            @Override
            public boolean onLongClick(View v)
            {
//              Log.e("TAG", "long click");
                mBtnAnim.start();
                isRecording = true;
                mAudioManager.prepareAudio();
                return false;
            }
        });
        mAudioManager.setAudioStateListener(this);
    }
项目:material-components-android    文件:MotionSpec.java   
/** Inflates an instance of MotionSpec from the given animator resource. */
@Nullable
public static MotionSpec createFromResource(Context context, @AnimatorRes int id) {
  try {
    Animator animator = AnimatorInflater.loadAnimator(context, id);
    if (animator instanceof AnimatorSet) {
      AnimatorSet set = (AnimatorSet) animator;
      return createSpecFromAnimators(set.getChildAnimations());
    } else if (animator != null) {
      List<Animator> animators = new ArrayList<>();
      animators.add(animator);
      return createSpecFromAnimators(animators);
    } else {
      return null;
    }
  } catch (Exception e) {
    Log.w(TAG, "Can't load animation resource ID #0x" + Integer.toHexString(id), e);
    return null;
  }
}
项目:View-Images-and-Animations    文件:CircleIndicator.java   
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;
}
项目:AyoSunny    文件:FloatingActionButton.java   
@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();
}
项目:Doctor    文件:FloatingActionButton.java   
@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();
}
项目:FastFoodFinder    文件:StoreFilterDialogFragment.java   
public TagViewHolder(View view) {
    itemView = view;
    ButterKnife.bind(this, view);
    tvTag.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Animator animator = AnimatorInflater.loadAnimator(getContext(), R.animator.zoom_in_out);
            animator.setTarget(itemView);
            animator.setDuration(100);
            animator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    Toast.makeText(getContext(), "Successfully", Toast.LENGTH_SHORT).show();
                }
            });
            animator.start();
            v.setSelected(!v.isSelected());
        }
    });
}
项目:QDNews    文件:ToolbarIndicator.java   
private void init(Context context, AttributeSet attrs) {
    setOrientation(LinearLayout.HORIZONTAL);
    setGravity(Gravity.CENTER);
    handleTypedArray(context, attrs);
    mAnimationOut = AnimatorInflater.loadAnimator(context, mAnimatorResId);
    if (mAnimatorReverseResId == -1) {
        mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorResId);
        mAnimationIn.setInterpolator(new ReverseInterpolator());
    } else {
        mAnimationIn = AnimatorInflater.loadAnimator(context, mAnimatorReverseResId);
    }

    setPadding(0, dip2px(TEXT_SIZE + 8), 0, 0);
    setBackgroundColor(0x00000000);

    textPaint = new TextPaint();
    textPaint.setColor(Color.WHITE);
    textPaint.setAntiAlias(true);
    textPaint.setTextSize(dip2px(TEXT_SIZE));
    textPaint.setTextAlign(Paint.Align.CENTER);
}
项目:quotograph    文件:LWQSettingsActivity.java   
void animateContainer(final View container, final boolean dismiss) {
    container.setVisibility(View.VISIBLE);
    Animator animator = dismiss ? AnimatorInflater.loadAnimator(this, R.animator.exit_to_left) :
            AnimatorInflater.loadAnimator(this, R.animator.enter_from_right);
    animator.setTarget(container);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (dismiss) {
                container.setVisibility(View.GONE);
                UIUtils.dismissKeyboard(LWQSettingsActivity.this);
            } else {
                UIUtils.revealKeyboard(container == addEditQuote ? editableQuote : editableQuery);
            }
        }
    });
    animator.start();
}
项目:BookMySkills    文件:FloatingActionButton.java   
@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();
}
项目:GifAssistant    文件:NavigationWelcomeActivity.java   
private void hideSkipAreaWhenScrolling(int state) {
    if (state == 1 && mMouseMoving) {
        mSkipArea.setVisibility(View.INVISIBLE);
    } else {
        if (mSkipArea.getVisibility() == View.VISIBLE) {
            return;             
        }
        if (mSkipButtonShow != null && mSkipButtonShow.isRunning()) {
            return;
        }
        mSkipButtonShow = (AnimatorSet) AnimatorInflater
                .loadAnimator(NavigationWelcomeActivity.this,
                        R.anim.nav_2_everything_show);
        mSkipArea.setVisibility(View.VISIBLE);
        mSkipButtonShow
                .setTarget(mSkipArea);
        mSkipButtonShow.start();
    }
}
项目:maketaobao    文件:CircleIndicator.java   
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;
}
项目:Pin-Number-Picker    文件:PinNumberPicker.java   
public 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);
    }
}
项目:gesture-framework    文件:FlyInAndLowerAnimator.java   
@Override
protected void registerAnimators() {
    mElevateAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.elevate);
    mElevateAnimator.addListener(this);
    mElevateAnimator.setTarget(mView);
    mElevateAnimator.setDuration(1);

    mFlyOutAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.fly_out_south);
    mFlyOutAnimator.addListener(this);
    mFlyOutAnimator.setTarget(mView);

    mFlyInAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.fly_in_north);
    mFlyInAnimator.addListener(this);
    mFlyInAnimator.setTarget(mView);

    mLowerAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.lower);
    mLowerAnimator.addListener(this);
    mLowerAnimator.setTarget(mView);

    mTeleportOutAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.teleport_north);
    mTeleportOutAnimator.addListener(this);
    mTeleportOutAnimator.setTarget(mView);
}
项目:gesture-framework    文件:FlipSelectAnimator.java   
@Override
protected void registerAnimators() {
    mElevateAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.elevate);
    mElevateAnimator.addListener(this);
    mElevateAnimator.setTarget(mView);
    mElevateAnimator.setDuration(500);

    mFlipLeftOutAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.flip_left_out);
    mFlipLeftOutAnimator.addListener(this);
    mFlipLeftOutAnimator.setTarget(mView);

    mFlipLeftInAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.flip_left_in);
    mFlipLeftInAnimator.addListener(this);
    mFlipLeftInAnimator.setTarget(mView);

    mLowerAnimator = AnimatorInflater.loadAnimator(mContext, R.animator.lower);
    mLowerAnimator.addListener(this);
    mLowerAnimator.setTarget(mView);
    mLowerAnimator.setDuration(500);
}
项目:easy-finance    文件:ListEntityFragment.java   
@Override
public void onResume() {
    super.onResume();
    addToDelete = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.add_to_delete);
    deleteToAdd = (AnimatorSet) AnimatorInflater.loadAnimator(getActivity(), R.animator.delete_to_add);
    viewCreateDeleteEntities = ButterKnife.findById(getActivity(), getViewCreateEntity());
    viewCreateDeleteEntities.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (hasPendencies()) {
                removeEntities();
            } else {
                openEntityForm(v);
            }
        }
    });

}
项目:honki_android    文件:PropertyAnimationActivity.java   
/** GridLayout のアニメーション */
private void doAnimationToGridLayout() {
    for (int i = 0, iL = mGridLayout.getChildCount(); i < iL; i++) {
        // 左上を基準として、距離を計算する。
        int vi = i % mGridLayout.getColumnCount();
        int hi = i / mGridLayout.getRowCount();
        int dist = vi + hi;

        // childを読み込み
        View childAt = mGridLayout.getChildAt(i);

        // アニメーション読み込み、設定
        Animator anim = (isShowingGridLayout)
                ? AnimatorInflater.loadAnimator(this, R.animator.activity_property_animation_grid_hide)
                : AnimatorInflater.loadAnimator(this, R.animator.activity_property_animation_grid_show);
        anim.setTarget(childAt);
        anim.setStartDelay(dist * 60);
        anim.start();
    }
    isShowingGridLayout = !isShowingGridLayout;
}
项目:honki_android    文件:PropertyAnimationActivity.java   
/** GridLayout のアニメーション */
private void doAnimationToGridLayout() {
    for (int i = 0, iL = mGridLayout.getChildCount(); i < iL; i++) {
        // 左上を基準として、距離を計算する。
        int vi = i % mGridLayout.getColumnCount();
        int hi = i / mGridLayout.getRowCount();
        int dist = vi + hi;

        // childを読み込み
        View childAt = mGridLayout.getChildAt(i);

        // アニメーション読み込み、設定
        Animator anim = (isShowingGridLayout)
                ? AnimatorInflater.loadAnimator(this, R.animator.activity_property_animation_grid_hide)
                : AnimatorInflater.loadAnimator(this, R.animator.activity_property_animation_grid_show);
        anim.setTarget(childAt);
        anim.setStartDelay(dist * 60);
        anim.start();
    }
    isShowingGridLayout = !isShowingGridLayout;
}
项目:dedecmsapp    文件:Topbar.java   
public Topbar(Context context, AttributeSet attrs) {
    super(context, attrs);

    // Styleables from XML
    TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.Topbar);

    if (a.hasValue(R.styleable.Topbar_title)) {
        mTitle = a.getString(R.styleable.Topbar_title);
    } else {
        mTitle = new String();
    }

    isShowBackButton = a.getBoolean(R.styleable.Topbar_showBackButton, true);
    ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.topbar, this);

    mShowAnimator = AnimatorInflater.loadAnimator(getContext(), R.animator.topbar_show);
    mShowAnimator.setTarget(this);
    mShowAnimator.addListener(mShowAnimatorListener);

    mHideAnimator = AnimatorInflater.loadAnimator(getContext(), R.animator.topbar_hide);
    mHideAnimator.setTarget(this);
    mHideAnimator.addListener(mHideAnimatorListener);
}