The lib can make the ActivityOptions animations use in Android api3.1+

Overview

ActivityOptionsICS


本项目停止维护

=========== f you are thinking on customizing the animation of Activity transition then probably you would look for ActivityOptions.However ActivityOptions class introduced in Android 4.1 (Jelly bean). ActivityOptionsICS can make it use in 3.1+. The library provided some methods which can help you to customize the Activity Animation.

Screenshot

Please waiting for loading...

ActivityOptionsCompatICS

  1. public static ActivityOptionsCompatICS makeCustomAnimation(Context context,int enterResId, int exitResId)

This method allows to pass custom animation and when the Atyctivi is launched, it gets rendered accordingly. Here you can pass animation for transitioning out Activity as well as for transitioning in Activity

  1. public static ActivityOptionsCompatICS makeScaleUpAnimation(View source, int startX, int startY, int width, int height)

This method scales up the Activity from the initial size to its final representational size. It can be used to scale up the activity from the view which has launched this activity.

  1. public static ActivityOptionsCompatICSmakeThumbnailScaleUpAnimation(View source, Bitmap thumbnail, int startX, int startY)

In this animation, a thumbnail of the activity scales up to the final size of the activity.

  1. public static ActivityOptionsCompatICS makeSceneTransitionAnimation(Activity activity, View view, sharedElement,int sharedElementId)

This method carries the position of one shared element to the started Activity.The position of sharedElement will be used as the epicenter for the exit Transition.

  1. public static ActivityOptionsCompatICS makeSceneTransitionAnimation(Activity activity, Pair<View, Integer>... sharedElements)

This method carries the position of multiple shared elements to the started Activity. The position of the first element in sharedElements will be used as the epicenter for the exit Transition. The position of the associated shared element in the launched Activity will be the epicenter of its entering Transition.

ActivityCompatICS

  1. public static void startActivity(Activity activity, Intent intent, Bundle bundle)

TransitionCompat

  1. TransitionCompat.startTransition(this, R.layout.activity_target);
  2. TransitionCompat.finishAfterTransition(this);

How to use

If you want use this library, you only have to download this project, import it into your workspace and add the project as a library in your android project settings.

In MainActivity

makeCustomAnimation

   public void customAnim() {
    		ActivityOptionsCompatICS options = ActivityOptionsCompatICS.makeCustomAnimation(this,
    				R.anim.slide_bottom_in, R.anim.slide_bottom_out);
    		ActivityCompatICS.startActivity(MainActivity.this, intent, options.toBundle());
    	}

makeScaleUpAnimation

public void scaleUpAnim(View view) {
		ActivityOptionsCompatICS options = ActivityOptionsCompatICS.makeScaleUpAnimation(view,
				 0, 0, //拉伸开始的坐标
	             view.getMeasuredWidth(), view.getMeasuredHeight());//初始的宽高
		ActivityCompatICS.startActivity(MainActivity.this, intent, options.toBundle());
	}

makeThumbnailScaleUpAnimation

public void thumbNailScaleAnim(ImageView view) {
		view.setDrawingCacheEnabled(true);
		 Bitmap bitmap = view.getDrawingCache();
		  ActivityOptionsCompatICS options = ActivityOptionsCompatICS.makeThumbnailScaleUpAnimation(
		    view, bitmap, 0, 0);
		  // Request the activity be started, using the custom animation options.
		  ActivityCompatICS.startActivity(MainActivity.this, intent, options.toBundle());
		  //view.setDrawingCacheEnabled(false);
	}

makeSceneTransitionAnimation

screenTransitAnimByPair(
				Pair.create((View)orginalImageView, R.id.target_imageView),
				Pair.create((View)orginalTextView, R.id.target_textView),
				Pair.create((View)chromeIView, R.id.target_chrome_imageView));   

public void screenTransitAnimByPair(Pair<View, Integer>... views) {
		isSceneAnim = true;
		ActivityOptionsCompatICS options = ActivityOptionsCompatICS.makeSceneTransitionAnimation(
				MainActivity.this, views);
		ActivityCompatICS.startActivity(MainActivity.this, intent, options.toBundle());
	}

##In TargetActivity 1.make translucentTheme in style.xml

<style name="TranslucentTheme" parent="AppBaseTheme">
    <item name="android:windowIsTranslucent">true</item>
</style

2.set targetActivity's theme in manifest.xml

<activity   
	android:name="com.example.activityoptionsjbtest.TargetActivity"   
	android:theme="@style/TranslucentTheme" />     

3.start transition in targetActivity

public class TargetActivity extends Activity{

    @Override
    protected void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.activity_target);

	    TransitionCompat.startTransition(this, R.layout.activity_target);
    }
    
    @Override
    public void onBackPressed() {
	    //super.onBackPressed();
	    TransitionCompat.finishAfterTransition(this); 
    }
}  

Developed By

Kale [email protected]

You might also like...
Android library to create complex multi-state animations.
Android library to create complex multi-state animations.

MultiStateAnimation Android library to create complex multi-state animations. Overview A class that allows for complex multi-state animations using An

Circle based animations for Android (min. API 11)
Circle based animations for Android (min. API 11)

CircularTools Circle based animations for Android (min. API 11) Currently implemented: Circular reveal Circular transform Radial reaction Reveal:YouTu

Lightweight Android library for cool activity transition animations

Bungee min SDK 16 (Android Jellybean 4.1) written in Java A lightweight, easy-to-use Android library that provides awesome activity transition animati

Repository for android animations Rx wrapper

RxAnimations RxAnimations is a library with the main goal to make android animations more solid and cohesive. Download compile 'oxim.digital:rxanim:

AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)
AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)

AXrLottie (Android) Renders animations and vectors exported in the bodymovin JSON format. (Using rLottie)

A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.
A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix.

SuperForwardView About A lightweight android library that allows to you create custom fast forward/rewind animations like on Netflix. GIF Design Credi

Add Animatable Material Components in Android Jetpack Compose.  Create jetpack compose animations painless.
Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animations painless.

AnimatableCompose Add Animatable Material Components in Android Jetpack Compose. Create jetpack compose animation painless. What you can create from M

Android Animation Easing Functions. Let's make animation more real!
Android Animation Easing Functions. Let's make animation more real!

Android Easing Functions This project is originally from my another project, AndroidViewAnimation, which is an animation collection, to help you make

Road Runner is a library for android which allow you to make your own loading animation using a SVG image
Road Runner is a library for android which allow you to make your own loading animation using a SVG image

Road Runner Road Runner is a library for android which allow you to make your own loading animation using a SVG image Sample video View in Youtube Dem

Comments
  • 出发的Activity的onStop没有被回调

    出发的Activity的onStop没有被回调

    demo代码里,从Activity A跳转到Activity B, A的onPause调用了,然后是B的onCreate onResume等被回调,然后按理说下面就是A的onStop被回调,但是A的onStop确实没有被回调。这个生命周期的bug要解啊。其他的Activtiy切换动画都没有影响到生命周期的回调。

    opened by tedzyc 0
  • Dynamic loading image

    Dynamic loading image

    Hi! I am not able to start the sceneTransition when i have to set the imageview Bitmap from resource with SetImageResource or from bitmap with SetBitmapImage. The activity starts but without the animation

    opened by FunnyDevs 0
  • logic problem

    logic problem

    I find it use target view to do transition animation. How to change the content of the target view? don't want the target ImageView only can show the image which was set the layout file.

    opened by kainbro 1
Chandrasekar Kuppusamy 799 Nov 14, 2022
A Simple Todo app design in Flutter to keep track of your task on daily basis. Its build on BLoC Pattern. You can add a project, labels, and due-date to your task also you can sort your task on the basis of project, label, and dates

WhatTodo Life can feel overwhelming. But it doesn’t have to. A Simple To-do app design in flutter to keep track of your task on daily basis. You can a

Burhanuddin Rashid 1k Jan 1, 2023
An android project presenting some transitions you can use between activities

ActivityTransition An android project presenting some transitions you can use between activities #Integration Add the anim folder to your Android proj

null 260 Nov 29, 2022
It's a cool animation which can use in splash or somewhere else.

What's Particle ? It's a cool animation which can use in splash or anywhere else. Demo Article 手摸手教你用Canvas实现简单粒子动画 Attributes name format description

巴掌 1.4k Dec 12, 2022
Actions for android animations. Inspired by libgdx scene2d actions.

Android Animations Actions Actions for android animations. Inspired by libgdx scene2d actions. The main goal of this project is making creating of com

dtx12 137 Nov 29, 2022
[] An Android library which allows developers to easily add animations to ListView items

DEPRECATED ListViewAnimations is deprecated in favor of new RecyclerView solutions. No new development will be taking place, but the existing versions

Niek Haarman 5.6k Dec 30, 2022
Render After Effects animations natively on Android and iOS, Web, and React Native

Lottie for Android, iOS, React Native, Web, and Windows Lottie is a mobile library for Android and iOS that parses Adobe After Effects animations expo

Airbnb 33.5k Jan 4, 2023
Android Transition animations explanation with examples.

UNMAINTAINED No maintainance is intended. The content is still valid as a reference but it won't contain the latest new stuff Android Transition Frame

Luis G. Valle 13.6k Dec 28, 2022
An Android library which provides simple Item animations to RecyclerView items

RecyclerViewItemAnimators Library Travis master: This repo provides: Appearance animations Simple animators for the item views Quick start You can now

Gabriele Mariotti 3.1k Dec 16, 2022
Library containing common animations needed for transforming ViewPager scrolling for Android v13+.

ViewPagerTransforms Library containing common animations needed for transforming ViewPager scrolling on Android v13+. This library is a rewrite of the

Ian Thomas 2.5k Dec 29, 2022