An android activity animation like gewara with reveal effect.
depends on Ozodrukh's animation util for CircularReveal animation for 2.3+ version
For a working implementation, have a look at the app module
-
Include the library as local library project.
-
You need to send RevealActivityAnimationHelper with intent as putextra and remove default transition animation of activity.
startActivity(new Intent(MainActivity.this, DetailActivity.class) .putExtra(RevealActivityAnimationHelper.KEY_REVEAL_ACTIVITY_HELPER, new RevealActivityAnimationHelper(sourceView, imageUrl))); overridePendingTransition(0, 0);
-
For the target activity, in your onCreate method you need to receive bundle and set the transparent theme, build animation with RevealActivityAnimationHelper.onActivityCreate.
if (getIntent().getExtras() != null) { mHelper = (RevealActivityAnimationHelper) getIntent().getSerializableExtra(RevealActivityAnimationHelper.KEY_REVEAL_ACTIVITY_HELPER); if (mHelper != null) { setTheme(R.style.AppThemeTransparentActivity); } } super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); if (mHelper != null) { RevealFrameLayout rootView = (RevealFrameLayout) findViewById(R.id.root_layout); mHelper.onActivityCreate(rootView, (ImageView) rootView.findViewById(R.id.targetView), null); }
After you have to create special root layout to show in behind current Circular Reveal animated view. The root layout have to be RevealFrameLayout. To make the full screem be clipped, please make sure this root layout has only one viewgroup. For example:
<com.angelocyj.library.circularReveal.widget.RevealFrameLayout
android:id="@+id/root_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<ImageView
android:id="@+id/targetView"
android:layout_width="120dp"
android:layout_height="180dp"
android:layout_marginTop="100dp"
android:layout_marginLeft="10dp"
android:scaleType="centerCrop"
android:src="@drawable/d1"/>
<TextView
android:text="@string/hello_world"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"/>
</FrameLayout>
</com.angelocyj.library.circularReveal.widget.RevealFrameLayout>