微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

项目:Quadro    文件ExploreActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_explore);
    iv = (ImageView) findViewById(R.id.search);
    text = (EditText) findViewById(R.id.text);
    searchToBar = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_search_to_bar);
    barToSearch = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.anim_bar_to_search);
    interp = AnimationUtils.loadInterpolator(this,android.R.interpolator.linear_out_slow_in);
    duration = getResources().getInteger(R.integer.duration_bar);
    // iv is sized to hold the search+bar so when only showing the search icon,translate the
    // whole view left by half the difference to keep it centered
    offset = -71f * (int) getResources().getdisplayMetrics().scaledDensity;
    iv.setTranslationX(offset);
    iv.setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            animate();
        }
    });
}
项目:android-WearaccessibilityApp    文件OpenOnPhoneAnimationActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_open_on_phone_animation);

    AmbientMode.attachAmbientSupport(this);

    mAnimationCallback =
            new AnimationCallback() {
                @Override
                public void onAnimationEnd(Drawable drawable) {
                    super.onAnimationEnd(drawable);
                    // Go back to main Dialogs screen after animation.
                    finish();
                }
            };

    // Play 'swipe left' animation only once.
    ImageView phoneImage = findViewById(R.id.open_on_phone_animation_image);
    mAnimatedVectorDrawablePhone = (AnimatedVectorDrawable) phoneImage.getDrawable();
    mAnimatedVectorDrawablePhone.registeranimationCallback(mAnimationCallback);
    mAnimatedVectorDrawablePhone.start();
}
项目:betterHotels    文件NoHotelsActivity.java   
@TargetApi(Build.VERSION_CODES.M)
private void initUi() {
    initializetoolbar();

    final AnimatedVectorDrawable avd2 = (AnimatedVectorDrawable) tvButton.getBackground();

    tvButton.setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            tvButton.setText("Loading...");
            avd2.start();
        }
    });

    avd2.registeranimationCallback(new Animatable2.AnimationCallback() {
        @Override
        public void onAnimationEnd(Drawable drawable) {
            tvButton.setText("Try Again");
        }
    });

}
项目:iosched-reader    文件SocialFragment.java   
@TargetApi(21)
private void setuplogoAnim() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final ImageView iv = (ImageView) getActivity().findViewById(R.id.io_logo);
        final AnimatedVectorDrawable logoAnim =
                (AnimatedVectorDrawable) getActivity().getDrawable(
                        R.drawable.io_logo_social_anim);
        iv.setimageDrawable(logoAnim);
        logoAnim.start();
        iv.setonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                logoAnim.start();
            }
        });
    }
}
项目:UdacityAndroidBasicsNanodegree    文件HabitAdapter.java   
@Override
public void onBindViewHolder(final HabitViewHolder holder,int position) {

    final Habit habit = habits.get(position);

    holder.habitName.setText(habit.name);
    holder.count.setText(String.format(Locale.getDefault(),"%d",habit.timesCompleted));
    holder.timesPerDay.setText(context.getString(R.string.times_per_day,habit.timesPerDay));

    holder.doneButton.setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((AnimatedVectorDrawable) holder.doneButton.getDrawable()).start();
            dbHelper.incrementHabit(habit.name);
            Storage.incrementHabit(context,habit.name);
        }
    });
}
项目:android-samples    文件MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    ImageView mFabView = (ImageView) findViewById(R.id.fab_view);

    // animate head to leaf
    final AnimatedVectorDrawable faceAVD = (AnimatedVectorDrawable) ContextCompat.getDrawable(this,R.drawable.face_avd);
    mFabView.setimageDrawable(faceAVD);

    findViewById(R.id.animate_btn).setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            faceAVD.start();
        }
    });
}
项目:smconf-android    文件SocialFragment.java   
@TargetApi(21)
private void setuplogoAnim() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final ImageView iv = (ImageView) getActivity().findViewById(R.id.io_logo);
        final AnimatedVectorDrawable logoAnim =
                (AnimatedVectorDrawable) getActivity().getDrawable(
                        R.drawable.io_logo_social_anim);
        iv.setimageDrawable(logoAnim);
        logoAnim.start();
        iv.setonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                logoAnim.start();
            }
        });
    }
}
项目:Floating-Navigation-View    文件FloatingNavigationView.java   
private void startOpenAnimations() {

        // Icon
        AnimatedVectorDrawable menuIcon = (AnimatedVectorDrawable) ContextCompat.getDrawable(getContext(),R.drawable.ic_menu_animated);
        mFabView.setimageDrawable(menuIcon);
        menuIcon.start();

        // Reveal
        int centerX = mFabRect.centerX();
        int centerY = mFabRect.centerY();
        float starTradius = getMinRadius();
        float endRadius = getMaxRadius();
        Animator reveal = ViewAnimationUtils
                .createCircularReveal(mNavigationView,centerX,centerY,starTradius,endRadius);

        // Fade in
        mNavigationMenuView.setAlpha(0);
        Animator fade = ObjectAnimator.ofFloat(mNavigationMenuView,View.ALPHA,1);

        // Animations
        AnimatorSet set = new AnimatorSet();
        set.playSequentially(reveal,fade);
        set.start();
    }
项目:materialup    文件RecyclerFragment.java   
public void checkEmptyOrConnection() {
    if (!Utils.hasInternet(getActivity())) {
        if (getAdapter().getItemCount() == 0) {
            mEmpty.setVisibility(View.GONE);
            mEmptyImage.setVisibility(View.VISIBLE);
            if (UI.isLollipop()) {
                final AnimatedVectorDrawable avd =
                        (AnimatedVectorDrawable) ContextCompat.getDrawable(getActivity(),R.drawable.avd_no_connection);
                mEmptyImage.setimageDrawable(avd);
                avd.start();
            } else {
                mEmptyImage.setimageResource(R.drawable.no_connection);
            }
        } else {
            Toast.makeText(getActivity(),R.string.check_network,Toast.LENGTH_SHORT).show();
        }
    }
}
项目:TrekAdvisor    文件MovableMarker.java   
/**
 * The {@code mRounded} drawable is just the end state of the {@code mStaticToDynamic}
 * {@link AnimatedVectorDrawable}.
 * The {@code mStatic} drawable is the end state of the {@code mDynamicToStatic}
 * {@link AnimatedVectorDrawable}. <br>
 *
 */
public MovableMarker(Context context,boolean staticForm,MarkerGson.Marker marker) {
    super(context);

    mRounded = (AnimatedVectorDrawable) context.getDrawable(R.drawable.avd_marker_rounded);
    mStatic = context.getDrawable(R.drawable.vd_marker_location_rounded);
    mStaticToDynamic = (AnimatedVectorDrawable) context.getDrawable(R.drawable.avd_marker_location_rounded);
    mDynamicToStatic = (AnimatedVectorDrawable) context.getDrawable(R.drawable.avd_marker_rounded_location);

    /* Keep a reference on the model object */
    mMarker = marker;

    /* Init the drawable */
    if (staticForm) {
        initStatic();
    } else {
        initRounded();
    }
}
项目:Amumu    文件HomeActivity.java   
private void checkConnectivity() {
    final ConnectivityManager connectivityManager
            = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
    connected = activeNetworkInfo != null && activeNetworkInfo.isConnected();
    if (!connected) {
        loading.setVisibility(View.GONE);
        if (noConnection == null) {
            final ViewStub stub = (ViewStub) findViewById(R.id.stub_no_connection);
            noConnection = (ImageView) stub.inflate();
        }
        final AnimatedVectorDrawable avd =
                (AnimatedVectorDrawable) getDrawable(R.drawable.avd_no_connection);
        noConnection.setimageDrawable(avd);
        avd.start();

        connectivityManager.registerNetworkCallback(
                new NetworkRequest.Builder()
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(),connectivityCallback);
        monitoringConnectivity = true;
    }
}
项目:2015-Google-I-O-app    文件SocialFragment.java   
@TargetApi(21)
private void setuplogoAnim() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final ImageView iv = (ImageView) getActivity().findViewById(R.id.io_logo);
        final AnimatedVectorDrawable logoAnim =
                (AnimatedVectorDrawable) getActivity().getDrawable(
                        R.drawable.io_logo_social_anim);
        iv.setimageDrawable(logoAnim);
        logoAnim.start();
        iv.setonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                logoAnim.start();
            }
        });
    }
}
项目:android-proguards    文件HomeActivity.java   
void revealPostingProgress() {
    Animator reveal = ViewAnimationUtils.createCircularReveal(fabPosting,(int) fabPosting.getPivotX(),(int) fabPosting.getPivotY(),0f,fabPosting.getWidth() / 2)
            .setDuration(600L);
    reveal.setInterpolator(Animutils.getFastOutLinearInInterpolator(this));
    reveal.start();
    AnimatedVectorDrawable uploading =
            (AnimatedVectorDrawable) getDrawable(R.drawable.avd_uploading);
    if (uploading != null) {
        fabPosting.setimageDrawable(uploading);
        uploading.start();
    }
}
项目:android-proguards    文件HomeActivity.java   
private void checkConnectivity() {
    final ConnectivityManager connectivityManager
            = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
    connected = activeNetworkInfo != null && activeNetworkInfo.isConnected();
    if (!connected) {
        loading.setVisibility(View.GONE);
        if (noConnection == null) {
            final ViewStub stub = (ViewStub) findViewById(R.id.stub_no_connection);
            noConnection = (ImageView) stub.inflate();
        }
        final AnimatedVectorDrawable avd =
                (AnimatedVectorDrawable) getDrawable(R.drawable.avd_no_connection);
        if (noConnection != null && avd != null) {
            noConnection.setimageDrawable(avd);
            avd.start();
        }

        connectivityManager.registerNetworkCallback(
                new NetworkRequest.Builder()
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(),connectivityCallback);
        monitoringConnectivity = true;
    }
}
项目:OldDriver-master    文件HomeActivity.java   
private void checkConnectivity() {
    final ConnectivityManager connectivityManager
            = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    final NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
    connected = activeNetworkInfo != null && activeNetworkInfo.isConnected();
    if (!connected) {
        loading.setVisibility(View.GONE);
        if (noConnection == null) {
            final ViewStub stub = (ViewStub) findViewById(R.id.stub_no_connection);
            noConnection = (ImageView) stub.inflate();
        }
        final AnimatedVectorDrawable avd =
                (AnimatedVectorDrawable) getDrawable(R.drawable.avd_no_connection);
        noConnection.setimageDrawable(avd);
        avd.start();

        connectivityManager.registerNetworkCallback(
                new NetworkRequest.Builder()
                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET).build(),connectivityCallback);
        monitoringConnectivity = true;
    }
}
项目:Reactive-Popular-Movies    文件MovieDetailsActivity.java   
@Override
public void showFavoriteMovie() {
    if (!isFavorite) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

            AnimatedVectorDrawable emptyHeart = (AnimatedVectorDrawable)
                    emptyHeartConstantState.newDrawable();
            fab.setimageDrawable(emptyHeart);
            emptyHeart.start();

        } else {
            fab.setimageResource(R.drawable.heart_fill);
        }
        isFavorite = true;
    }
}
项目:Reactive-Popular-Movies    文件MovieDetailsActivity.java   
@Override
public void showNonFavoriteMovie() {
    if (isFavorite) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {

            AnimatedVectorDrawable fullHeart = (AnimatedVectorDrawable)
                    fullHeartConstantState.newDrawable();
            fab.setimageDrawable(fullHeart);
            fullHeart.start();

        } else {
            fab.setimageResource(R.drawable.fab_heart_empty);
        }
        isFavorite = false;
    }
}
项目:FMTech    文件SocialFragment.java   
@TargetApi(21)
private void setuplogoAnim() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final ImageView iv = (ImageView) getActivity().findViewById(R.id.io_logo);
        final AnimatedVectorDrawable logoAnim =
                (AnimatedVectorDrawable) getActivity().getDrawable(
                        R.drawable.io_logo_social_anim);
        iv.setimageDrawable(logoAnim);
        logoAnim.start();
        iv.setonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                logoAnim.start();
            }
        });
    }
}
项目:multi-seek-bar    文件AnimatedPinDrawable.java   
public AnimatedPinDrawable(Context context) {
    super();
    Drawable collapsed = context.getDrawable(R.drawable.pin_collapsed);
    Drawable expanded = context.getDrawable(R.drawable.pin_expanded);
    AnimatedVectorDrawable expanding = (AnimatedVectorDrawable) context
        .getDrawable(R.drawable.pin_collapsed_to_expanded_animation);
    AnimatedVectorDrawable collapsing = (AnimatedVectorDrawable) context
        .getDrawable(R.drawable.pin_expanded_to_collapsed_animation);

    addState(STATE_SET_pressed,expanded,STATE_EXPANDED_ID);
    addState(STATE_SET_UNpressed,collapsed,STATE_COLLAPSED_ID);
    addTransition(STATE_COLLAPSED_ID,STATE_EXPANDED_ID,expanding,false);
    addTransition(STATE_EXPANDED_ID,STATE_COLLAPSED_ID,collapsing,false);

    paint.setColor(Color.BLUE);
    paint.setTextSize(24f);
    paint.setTextAlign(Paint.Align.CENTER);
    paint.setAntiAlias(true);
    duration = context.getResources().getInteger(android.R.integer.config_mediumAnimTime);
}
项目:Decor    文件SearchAnimateDecorator.java   
@Override
protected void apply(ImageView view,TypedArray typedArray) {
    boolean shouldAnimate = typedArray.getBoolean(R.styleable.SearchAnimateDecorator_decorAnimateSearch,false);
    if(!shouldAnimate) return;

    mIv = view;
    mSearchToBar = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_search_to_bar);
    mBarToSearch = (AnimatedVectorDrawable) view.getContext().getResources().getDrawable(R.drawable.anim_bar_to_search);
    mInterp = AnimationUtils.loadInterpolator(view.getContext(),android.R.interpolator.linear_out_slow_in);
    mDuration = view.getContext().getResources().getInteger(R.integer.duration_bar);
    // iv is sized to hold the search+bar so when only showing the search icon,translate the
    // whole view left by half the difference to keep it centered
    mOffset = -71f * (int) view.getContext().getResources().getdisplayMetrics().scaledDensity;
    view.setTranslationX(mOffset);
    view.setonClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            animate(v);
        }
    });
}
项目:JJCamera    文件SocialFragment.java   
@TargetApi(21)
private void setuplogoAnim() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        final ImageView iv = (ImageView) getActivity().findViewById(R.id.io_logo);
        final AnimatedVectorDrawable logoAnim =
                (AnimatedVectorDrawable) getActivity().getDrawable(
                        R.drawable.io_logo_social_anim);
        iv.setimageDrawable(logoAnim);
        logoAnim.start();
        iv.setonClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                logoAnim.start();
            }
        });
    }
}
项目:plaid    文件HomeActivity.java   
void revealPostingProgress() {
    Animator reveal = ViewAnimationUtils.createCircularReveal(fabPosting,fabPosting.getWidth() / 2)
            .setDuration(600L);
    reveal.setInterpolator(Animutils.getFastOutLinearInInterpolator(this));
    reveal.start();
    AnimatedVectorDrawable uploading =
            (AnimatedVectorDrawable) getDrawable(R.drawable.avd_uploading);
    if (uploading != null) {
        fabPosting.setimageDrawable(uploading);
        uploading.start();
    }
}
项目:AnimatedVectorMorphingTool    文件MainActivity.java   
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 */
private void launchAnimBackup(){
    if(!backuproundtripFirstLaunched) {
        if (backuproundtrip.getLevel() == 1) {
            //then reverse
            backuproundtrip.setLevel(0);
        } else {
            //then reverse
            backuproundtrip.setLevel(1);
        }
    }else{
        backuproundtripFirstLaunched=false;
    }
    //find the current AnimatedVectorDrawable displayed
    currentBackupDrawable = (AnimatedVectorDrawable) backuproundtrip.getCurrent();
    //start the animation
    currentBackupDrawable.start();
}
项目:AnimatedVectorMorphingTool    文件MainActivity.java   
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 * As the levellist solution (ahead) has a bug,I do it in a simple way
 */
private void launchAnimBackup() {
    //initialize
    if (backuproundtripFirstLaunched) {
        reverse = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_Box_black_24dp_reverse,getTheme());
        initial = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_Box_black_24dp,getTheme());
        //if you want to avoid the color bug (animation not played on color at the second time)
        //comment that line (ok it's memory consumption)
        backuproundtripFirstLaunched=false;
    }
    //set the drawable depending on the direction (reverse or not)
    if (reverseState) {
        //then reverse
        imageView2.setimageDrawable(reverse);
    } else {
        //then reverse
        imageView2.setimageDrawable(initial);
    }
    reverseState=!reverseState;
    //launch the animation
    ((AnimatedVectorDrawable) imageView2.getDrawable()).start();
}
项目:appcutt    文件PhotoDetailActivity.java   
@OnClick(R.id.fab)
void onClickFab() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        Drawable drawable = fab.getDrawable();
        if (drawable instanceof AnimatedVectorDrawable) {
            if (((AnimatedVectorDrawable) drawable).isRunning()) return;

            int drawableResId = fab.isSelected() ? R.drawable.ic_pause_to_play : R.drawable.ic_play_to_pause;
            fab.setimageResource(drawableResId);

            drawable = fab.getDrawable();
            ((AnimatedVectorDrawable) drawable).start();
        }
    }

    if (fab.isSelected()) {
        imgPreview.pause();
    } else {
        imgPreview.resume();
    }

    fab.setSelected(!fab.isSelected());
}
项目:iosched    文件MyIOFragment.java   
@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();
    }
}
项目:iosched    文件SessionDetailFragment.java   
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();
}
项目:iosched    文件FeedFragment.java   
@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;
}
项目:Orpheus    文件ControlsScreenView.java   
@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,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,R.drawable.vector_repeat_off_on_black_36dp),true);
    repeatDrawable.addTransition(R.id.repeat_on_state,R.id.repeat_one_state,R.drawable.vector_repeat_on_one_black_36dp),true);
    repeatDrawable.addTransition(R.id.repeat_one_state,R.id.repeat_off_state,R.drawable.vector_repeat_one_off_black_36dp),true);
    repeatDrawable.addTransition(R.id.repeat_off_state,R.drawable.vector_repeat_off_one_black_36dp),true);
            */
}
项目:PeSanKita-android    文件AudioView.java   
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();
  }
}
项目:PeSanKita-android    文件AudioView.java   
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();
  }
}
项目:quidditchtimekeeper    文件GameActivity.java   
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;
    }
}
项目:android-WearaccessibilityApp    文件ImagesActivity.java   
@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);
}
项目:Mire    文件BottomSheetLib.java   
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();
   }
项目:Mire    文件BottomSheetLib.java   
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();
   }

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。