Example To Usage Animator Of Circularreveal

Posted on

A instance to utilisation Animator of CircularReveal, exhibit on TextView as well as ImageView.

package com.example.eric.androidcircularreveal;  import android.animation.Animator; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.ViewAnimationUtils; import android.view.animation.AccelerateDecelerateInterpolator; import android.widget.ImageView; import android.widget.TextView;  populace shape MainActivity extends Activity {      @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setContentView(R.layout.activity_main);          TextView textView = (TextView)findViewById(R.id.textView);         ImageView imageView1 = (ImageView) findViewById(R.id.imageView1);         ImageView imageView2 = (ImageView) findViewById(R.id.imageView2);          textView.setOnClickListener(viewOnClickListener);         imageView1.setOnClickListener(viewOnClickListener);         imageView2.setOnClickListener(viewOnClickListener);     }      /*     Animator createCircularReveal(View view, int centerX,     int centerY, float startRadius, float endRadius)     */     View.OnClickListener viewOnClickListener = novel View.OnClickListener(){         @Override         populace void onClick(View v) {              Animator animatorCircularReveal = ViewAnimationUtils.createCircularReveal(                     v,                     0,                     0,                     0,                     (float) Math.hypot(v.getWidth(), v.getHeight()));             animatorCircularReveal.setInterpolator(new AccelerateDecelerateInterpolator());              animatorCircularReveal.start();          }     };  }  

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     android:paddingBottom="@dimen/activity_vertical_margin"     android:paddingLeft="@dimen/activity_horizontal_margin"     android:paddingRight="@dimen/activity_horizontal_margin"     android:paddingTop="@dimen/activity_vertical_margin"     tools:context=".MainActivity">      <TextView         android:id="@+id/title"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center_horizontal"         android:autoLink="web"         android:text="https://rootandroid.org//"         android:textStyle="bold" />      <TextView         android:id="@+id/textView"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:textStyle="bold"         android:textSize="30dp"         android:text="Animator CircularReveal example" />      <ImageView         android:id="@+id/imageView1"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:src="@mipmap/ic_launcher" />     <ImageView         android:id="@+id/imageView2"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_gravity="center_horizontal"         android:src="@mipmap/ic_launcher" />  </LinearLayout>