Java Code Examples for android.graphics.drawable.AnimatedVectorDrawable#start()
The following examples show how to use
android.graphics.drawable.AnimatedVectorDrawable#start() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From AnimatedVectorMorphingTool with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 2
Source File: MainActivity.java From AnimatedVectorMorphingTool with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 3
Source File: MainActivity.java From AnimatedVectorMorphingTool with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 4
Source File: MainActivity.java From AnimatedVectorMorphingTool with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 5
Source File: OpenOnPhoneAnimationActivity.java From wear-os-samples with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_open_on_phone_animation); AmbientModeSupport.attach(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(); }
Example 6
Source File: HomeScreenActivity.java From BaldPhone with Apache License 2.0 | 5 votes |
@Override public void run() { final Drawable d = notificationsButton.getDrawable(); if (d instanceof AnimatedVectorDrawable) { final AnimatedVectorDrawable animatedVectorDrawable = (AnimatedVectorDrawable) d; animatedVectorDrawable.start(); final int minusSeconds = Math.min((int) (Math.max((notificationCount - NOTIFICATIONS_ALOT) * 0.5f, 0)), 7); handler.postDelayed(this, (10 - minusSeconds) * D.SECOND); } }
Example 7
Source File: DynamicHeaderListFragment.java From beauty-treatment-android-animations with Apache License 2.0 | 5 votes |
private void triggerAvatarStrokeTransformation(boolean appear) { // Scale thin line behind avatar int lineScaleX = appear ? 1 : 10; topHeaderDividerLine.animate().scaleX(lineScaleX).setDuration(200); // Animate avatar stroke vector path AnimatedVectorDrawable drawable = appear ? appearingImageStroke : disappearingImageStroke; imageStrokeVectorDrawable.setImageDrawable(drawable); drawable.start(); userAvatarStrokeVisible = appear; }
Example 8
Source File: ImagesActivity.java From wear-os-samples with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_images); AmbientModeSupport.attach(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); }
Example 9
Source File: AudioView.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
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(); } }
Example 10
Source File: AudioView.java From deltachat-android with GNU General Public License v3.0 | 5 votes |
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(); } }
Example 11
Source File: MainActivity.java From auid2 with Apache License 2.0 | 5 votes |
@Override public void onClick(View v) { final ImageView imageView = (ImageView) v; final AnimatedVectorDrawable avd = (AnimatedVectorDrawable) imageView.getDrawable(); avd.start(); }
Example 12
Source File: AudioView.java From Silence with GNU General Public License v3.0 | 5 votes |
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(); } }
Example 13
Source File: AudioView.java From Silence with GNU General Public License v3.0 | 5 votes |
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(); } }
Example 14
Source File: SplashActivity.java From Focus with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(SkinPreference.getInstance().getSkinName().equals("night")){ super.setTheme(R.style.AppTheme_Dark); }else { super.setTheme(R.style.AppTheme); } getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); //隐藏状态栏 setContentView(R.layout.activity_welcome); if (UserPreference.queryValueByKey(UserPreference.FIST_USE_NEW_COMER, "0").equals("0")){ sampleWelcomeScreen = new WelcomeHelper(this, NewComerActivity.class); sampleWelcomeScreen.forceShow(); }else { Intent intent = getIntent(); if (!isTaskRoot()) { finish(); return; } ImageView imageview= findViewById(R.id.imageView); AnimatedVectorDrawable animatedVectorDrawable = ((AnimatedVectorDrawable) imageview.getDrawable()); animatedVectorDrawable.start(); //跳转到 {@link MainActivity} new AppStartTask(new TaskListener() { @Override public void onFinish(String jsonString) { finish(); MainActivity.activityStart(SplashActivity.this); } }).execute(); } }
Example 15
Source File: TestViewActivity.java From KotlinMVPRxJava2Dagger2GreenDaoRetrofitDemo with Apache License 2.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.M) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_test_view); final WaterRefreshView waterRefreshView = (WaterRefreshView) findViewById(R.id.waterrefreshview); waterRefreshView.setOnRefreshListener(new WaterRefreshView.OnRefreshListener() { @Override public void onRefresh() { new Handler().postDelayed(new Runnable() { @Override public void run() { ToastUtils.showMessage("刷新成功"); waterRefreshView.refreshSuccess(); } }, 2000); } }); final SwipeLayout swipeLayout = (SwipeLayout) findViewById(R.id.swipe_edit_layout); swipeLayout.setOnMenuClickListener(new SwipeLayout.OnMenuClickListener() { @Override public void onMenuClick(View v) { transWaterRefreshView(waterRefreshView); ObjectAnimator alpha = ObjectAnimator.ofFloat(swipeLayout, "alpha", 1f, 0f); alpha.setDuration(500); alpha.setInterpolator(new DecelerateInterpolator()); alpha.start(); alpha.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); swipeLayout.setVisibility(View.GONE); } }); } }); // final SwipeLayout swipeLayout2 = (SwipeLayout) findViewById(R.id.swipe_edit_layout2); // swipeLayout2.setOnMenuClickListener(new SwipeLayout.OnMenuClickListener() { // @Override // public void onMenuClick(View v) { //// transWaterRefreshView(waterRefreshView); // ObjectAnimator alpha = ObjectAnimator.ofFloat(swipeLayout2, "translationX", 0,swipeLayout2.getWidth()); // alpha.setDuration(500); // alpha.setInterpolator(new DecelerateInterpolator()); // alpha.start(); // alpha.addListener(new AnimatorListenerAdapter() { // @Override // public void onAnimationEnd(Animator animation) { // super.onAnimationEnd(animation); // swipeLayout2.setVisibility(View.GONE); // } // }); // } // }); swipeLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { transY = swipeLayout.getHeight(); swipeLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); } }); ImageView iv_vector = (ImageView) findViewById(R.id.iv_test_view_vector_jrtt); AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) iv_vector.getDrawable(); drawable.start(); ImageView iv_tick = (ImageView) findViewById(R.id.iv_test_view_vector_tick); drawableTick = (AnimatedVectorDrawable) iv_tick.getDrawable(); drawableTick.start(); for (int i = 0; i < 5; i++) { TestFragment testFragment = new TestFragment(); Bundle bundle = new Bundle(); bundle.putString("pos", String.valueOf(i + 1)); testFragment.setArguments(bundle); mFragmentList.add(testFragment); } final BezierIndicatorView bezierIndicatorView = (BezierIndicatorView) findViewById(R.id.bezierIndicatorView); ViewPager viewPager = (ViewPager) findViewById(R.id.test_viewpager); viewPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager())); viewPager.setOnPageChangeListener(bezierIndicatorView); viewPager.setCurrentItem(0); bezierIndicatorView.setAdapter(viewPager.getAdapter()); }
Example 16
Source File: Animate.java From lock-screen with MIT License | 4 votes |
@TargetApi(Build.VERSION_CODES.M) public static void animate(AppCompatImageView view, AnimatedVectorDrawable scanFingerprint) { view.setImageDrawable(scanFingerprint); scanFingerprint.start(); }
Example 17
Source File: SpotlightView.java From Spotlight with Apache License 2.0 | 4 votes |
/** * Add arc above/below the circular target overlay. */ private void addArcAnimation(final Activity activity) { AppCompatImageView mImageView = new AppCompatImageView(activity); mImageView.setImageResource(R.drawable.ic_spotlight_arc); LayoutParams params = new LayoutParams(2 * (circleShape.getRadius() + extraPaddingForArc), 2 * (circleShape.getRadius() + extraPaddingForArc)); if (targetView.getPoint().y > getHeight() / 2) {//bottom if (targetView.getPoint().x > getWidth() / 2) {//Right params.rightMargin = getWidth() - targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc; params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc; params.gravity = Gravity.RIGHT | Gravity.BOTTOM; } else { params.leftMargin = targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc; params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc; params.gravity = Gravity.LEFT | Gravity.BOTTOM; } } else {//up mImageView.setRotation(180); //Reverse the view if (targetView.getPoint().x > getWidth() / 2) {//Right params.rightMargin = getWidth() - targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc; params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc; params.gravity = Gravity.RIGHT | Gravity.BOTTOM; } else { params.leftMargin = targetView.getPoint().x - circleShape.getRadius() - extraPaddingForArc; params.bottomMargin = getHeight() - targetView.getPoint().y - circleShape.getRadius() - extraPaddingForArc; params.gravity = Gravity.LEFT | Gravity.BOTTOM; } } mImageView.postInvalidate(); mImageView.setLayoutParams(params); addView(mImageView); PorterDuffColorFilter porterDuffColorFilter = new PorterDuffColorFilter(lineAndArcColor, PorterDuff.Mode.SRC_ATOP); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { AnimatedVectorDrawable avd = (AnimatedVectorDrawable) ContextCompat.getDrawable(activity, R.drawable.avd_spotlight_arc); avd.setColorFilter(porterDuffColorFilter); mImageView.setImageDrawable(avd); avd.start(); } else { AnimatedVectorDrawableCompat avdc = AnimatedVectorDrawableCompat.create(activity, R.drawable.avd_spotlight_arc); avdc.setColorFilter(porterDuffColorFilter); mImageView.setImageDrawable(avdc); avdc.start(); } new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { @Override public void run() { addPathAnimation(activity); } }, 400); }
Example 18
Source File: HomeActivity.java From android-proguards with Apache License 2.0 | 4 votes |
@Override public void onReceive(Context context, Intent intent) { ensurePostingProgressInflated(); switch (intent.getAction()) { case PostStoryService.BROADCAST_ACTION_SUCCESS: // success animation AnimatedVectorDrawable complete = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_upload_complete); if (complete != null) { fabPosting.setImageDrawable(complete); complete.start(); fabPosting.postDelayed(new Runnable() { @Override public void run() { fabPosting.setVisibility(View.GONE); } }, 2100); // length of R.drawable.avd_upload_complete } // actually add the story to the grid Story newStory = intent.getParcelableExtra(PostStoryService.EXTRA_NEW_STORY); adapter.addAndResort(Collections.singletonList(newStory)); break; case PostStoryService.BROADCAST_ACTION_FAILURE: // failure animation AnimatedVectorDrawable failed = (AnimatedVectorDrawable) getDrawable(R.drawable.avd_upload_error); if (failed != null) { fabPosting.setImageDrawable(failed); failed.start(); } // remove the upload progress 'fab' and reshow the regular one fabPosting.animate() .alpha(0f) .rotation(90f) .setStartDelay(2000L) // leave error on screen briefly .setDuration(300L) .setInterpolator(AnimUtils.getFastOutSlowInInterpolator(HomeActivity .this)) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { fabPosting.setVisibility(View.GONE); fabPosting.setAlpha(1f); fabPosting.setRotation(0f); } }); break; } unregisterPostStoryResultListener(); }
Example 19
Source File: SplashActivity.java From Focus with GNU General Public License v3.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(SkinPreference.getInstance().getSkinName().equals("night")){ super.setTheme(R.style.AppTheme_Dark); }else { super.setTheme(R.style.AppTheme); } getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); //隐藏状态栏 setContentView(R.layout.activity_welcome); if (UserPreference.queryValueByKey(UserPreference.FIST_USE_NEW_COMER, "0").equals("0")){ sampleWelcomeScreen = new WelcomeHelper(this, NewComerActivity.class); sampleWelcomeScreen.forceShow(); }else { Intent intent = getIntent(); if (!isTaskRoot()) { finish(); return; } ImageView imageview= findViewById(R.id.imageView); AnimatedVectorDrawable animatedVectorDrawable = ((AnimatedVectorDrawable) imageview.getDrawable()); animatedVectorDrawable.start(); //跳转到 {@link MainActivity} new AppStartTask(new TaskListener() { @Override public void onFinish(String jsonString) { finish(); MainActivity.activityStart(SplashActivity.this); } }).execute(); } }
Example 20
Source File: CheckinHolder.java From attendee-checkin with Apache License 2.0 | 4 votes |
public void animateCheckin() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { AnimatedVectorDrawable drawable = (AnimatedVectorDrawable) mCheckin.getDrawable(); drawable.start(); } }