java类android.graphics.drawable.AnimatedVectorDrawable的实例源码

MyIOFragment.java 文件源码 项目:iosched 阅读 20 收藏 0 点赞 0 评论 0
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mLoadingSwitcher = (ViewSwitcher) view.findViewById(R.id.loading_switcher);
    mLoadingView = (LottieAnimationView) view.findViewById(R.id.loading_anim);
    mRecyclerView = (RecyclerView) view.findViewById(android.R.id.list);
    mRecyclerView.addItemDecoration(new DividerDecoration(getContext()));
    mAdapter = new MyIOAdapter(getContext(), this);
    mRecyclerView.setAdapter(mAdapter);
    mRecyclerView.setLayoutManager(
            new StickyHeadersLinearLayoutManager<MyIOAdapter>(getContext()));
    mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
            mScrolled = true;
            recyclerView.removeOnScrollListener(this);
        }
    });
    View header = view.findViewById(R.id.header_anim);
    if (header instanceof ImageView) {
        AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(
                getContext(), R.drawable.avd_header_my_io);
        ((ImageView) header).setImageDrawable(avd);
        avd.start();
    }
}
SessionDetailFragment.java 文件源码 项目:iosched 阅读 30 收藏 0 点赞 0 评论 0
private void showInSchedule(boolean isInSchedule, boolean animate) {
    mAddScheduleFab.setChecked(isInSchedule);
    mAddScheduleFab.setContentDescription(getString(isInSchedule
            ? R.string.remove_from_schedule
            : R.string.add_to_schedule));
    if (!animate) return;

    AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(
            getContext(), isInSchedule ? R.drawable.avd_bookmark : R.drawable.avd_unbookmark);
    mAddScheduleFab.setImageDrawable(avd);
    ObjectAnimator backgroundColor = ObjectAnimator.ofArgb(
            mAddScheduleFab,
            UIUtils.BACKGROUND_TINT,
            isInSchedule ? Color.WHITE
                    : ContextCompat.getColor(getContext(), R.color.lightish_blue));
    backgroundColor.setDuration(400L);
    backgroundColor.setInterpolator(AnimationUtils.loadInterpolator(getContext(),
            android.R.interpolator.fast_out_slow_in));
    backgroundColor.start();
    avd.start();
}
FeedFragment.java 文件源码 项目:iosched 阅读 28 收藏 0 点赞 0 评论 0
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
        @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.feed_fragment, container, false);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.feed_recycler_view);
    mRecyclerView.setHasFixedSize(true);
    mFeedAdapter = new FeedAdapter(getContext());
    mRecyclerView.addItemDecoration(new DividerItemDecoration(getContext(), VERTICAL));
    mRecyclerView.setAdapter(mFeedAdapter);
    View header = view.findViewById(R.id.header_anim);
    if (header instanceof ImageView) {
        AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(
                getContext(), R.drawable.avd_header_feed);
        ((ImageView) header).setImageDrawable(avd);
        avd.start();
    }
    return view;
}
ControlsScreenView.java 文件源码 项目:Orpheus 阅读 19 收藏 0 点赞 0 评论 0
@TargetApi(21)
void setupDrawables21() {
    //add state transitions
    AnimatedStateListDrawable drawable = (AnimatedStateListDrawable) play.getDrawable();
    drawable.addTransition(R.id.pause_state, R.id.play_state, (AnimatedVectorDrawable)
            ContextCompat.getDrawable(getContext(), R.drawable.vector_pause_play_black_36dp), false);
    drawable.addTransition(R.id.play_state, R.id.pause_state, (AnimatedVectorDrawable)
            ContextCompat.getDrawable(getContext(), R.drawable.vector_play_pause_black_36dp), false);

    /*
    AnimatedStateListDrawable repeatDrawable = (AnimatedStateListDrawable) repeat.getDrawable();
    repeatDrawable.addTransition(R.id.repeat_off_state, R.id.repeat_on_state, (AnimatedVectorDrawable)
            ContextCompat.getDrawable(getContext(), R.drawable.vector_repeat_off_on_black_36dp), true);
    repeatDrawable.addTransition(R.id.repeat_on_state, R.id.repeat_one_state, (AnimatedVectorDrawable)
            ContextCompat.getDrawable(getContext(), R.drawable.vector_repeat_on_one_black_36dp), true);
    repeatDrawable.addTransition(R.id.repeat_one_state, R.id.repeat_off_state, (AnimatedVectorDrawable)
            ContextCompat.getDrawable(getContext(), R.drawable.vector_repeat_one_off_black_36dp), true);
    repeatDrawable.addTransition(R.id.repeat_off_state, R.id.repeat_one_state, (AnimatedVectorDrawable)
            ContextCompat.getDrawable(getContext(), R.drawable.vector_repeat_off_one_black_36dp), true);
            */
}
AudioView.java 文件源码 项目:PeSanKita-android 阅读 26 收藏 0 点赞 0 评论 0
private void togglePlayToPause() {
  controlToggle.displayQuick(pauseButton);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    AnimatedVectorDrawable playToPauseDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.play_to_pause_animation);
    pauseButton.setImageDrawable(playToPauseDrawable);
    playToPauseDrawable.start();
  }
}
AudioView.java 文件源码 项目:PeSanKita-android 阅读 27 收藏 0 点赞 0 评论 0
private void togglePauseToPlay() {
  controlToggle.displayQuick(playButton);

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    AnimatedVectorDrawable pauseToPlayDrawable = (AnimatedVectorDrawable)getContext().getDrawable(R.drawable.pause_to_play_animation);
    playButton.setImageDrawable(pauseToPlayDrawable);
    pauseToPlayDrawable.start();
  }
}
GameActivity.java 文件源码 项目:quidditchtimekeeper 阅读 25 收藏 0 点赞 0 评论 0
public void animatePlayPause(View w)
{
    if(game.clocks[game.activeTime].getMode().equals("timer") && !game.clocks[game.activeTime].isRunning() && game.clocks[game.activeTime].getTimeRemaining()==0)
    {
        //nicht starten
        AlertDialog.Builder builder = new AlertDialog.Builder(context);
        builder.setTitle("You can't start the timer because it is already 00:00.");

        builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {

                dialog.dismiss();

            } });

        AlertDialog alertDialog = builder.create();
        alertDialog.show();
    }
    else
    {
        toggleWatches();
        AnimatedVectorDrawable drawable = play ? playToPause : pauseToPlay;
        playPause[game.activeTime].setImageDrawable(drawable);
        drawable.start();
        play = !play;
    }
}
ImagesActivity.java 文件源码 项目:android-WearAccessibilityApp 阅读 26 收藏 0 点赞 0 评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_images);

    AmbientMode.attachAmbientSupport(this);

    // Used to repeat animation from the beginning.
    mAnimationCallback =
            new AnimationCallback() {
                @Override
                public void onAnimationEnd(Drawable drawable) {
                    super.onAnimationEnd(drawable);
                    ((AnimatedVectorDrawable) drawable).start();
                }
            };

    // Play 'swipe left' animation on loop.
    ImageView mSwipeLeftImage = findViewById(R.id.swipe_left_image);
    mAnimatedVectorDrawableSwipe = (AnimatedVectorDrawable) mSwipeLeftImage.getDrawable();
    mAnimatedVectorDrawableSwipe.start();
    mAnimatedVectorDrawableSwipe.registerAnimationCallback(mAnimationCallback);

    // Play 'tap' animation on loop.
    ImageView mTapImage = findViewById(R.id.tap_image);
    mAnimatedVectorDrawableTap = (AnimatedVectorDrawable) mTapImage.getDrawable();
    mAnimatedVectorDrawableTap.start();
    mAnimatedVectorDrawableTap.registerAnimationCallback(mAnimationCallback);
}
BottomSheetLib.java 文件源码 项目:Mire 阅读 19 收藏 0 点赞 0 评论 0
private void showClose()
{
       if (stateDismiss == DISMISS_CLOSE) 
    {
        return;
    }
       stateDismiss = DISMISS_CLOSE;

       final AnimatedVectorDrawable downToClose = (AnimatedVectorDrawable)ContextCompat.getDrawable(this, R.animator.avd_down_to_close);

    close.setImageDrawable(downToClose);
       downToClose.start();
   }
BottomSheetLib.java 文件源码 项目:Mire 阅读 22 收藏 0 点赞 0 评论 0
private void showDown()
{
       if (stateDismiss == DISMISS_DOWN)
    {
        return;
    }
       stateDismiss = DISMISS_DOWN;

       final AnimatedVectorDrawable closeToDown = (AnimatedVectorDrawable)ContextCompat.getDrawable(this, R.animator.avd_close_to_down);

    close.setImageDrawable(closeToDown);
       closeToDown.start();
   }


问题


面经


文章

微信
公众号

扫码关注公众号