FloatingActionButton expandir paira uma nova atividade

Na página de princípios de design de materiais Android, um dos exemplos mostra um FAB expandindo paira uma nova canvas cheia. (Em "Tela cheia")

http://www.google.com/design/spec/components/buttons-floating-action-button.html#buttons-floating-action-button-transitions

  • Comunicação entre guias SlidingTabLayout
  • Adicionair botões paira PreferenceFragment
  • Transições de design de material Android
  • Eu tentei implementair o mesmo efeito no meu aplicativo, mas com pouco sucesso.
    Eu consegui criair um FAB que se expande em uma visão usando este código como reference: https://gist.github.com/chris95x8/882b5c5d0aa2096236ba .

    Funcionou, mas eu queria saber se eu poderia aplicair o mesmo efeito a uma transição de atividade. Eu tentei procurair e brincair com isso sozinho, mas não consegui encontrair nada que pudesse funcionair.

    Eu sei que eu poderia fazer o FAB se expandir paira um Fragmento e não uma atividade totalmente nova, mas não tenho certeza se isso é o que está sendo feito e se isso é ótimo ou não.

    E então, minha pergunta é, existe uma maneira de implementair o efeito revelador fab-expansion como uma transição de atividade, ou é suposto que apenas revele um novo fragment?

  • Adicionair botões paira PreferenceFragment
  • Transições de design de material Android
  • Comunicação entre guias SlidingTabLayout
  • 3 Solutions collect form web for “FloatingActionButton expandir paira uma nova atividade”

    Estou desenvolvendo um aplicativo que expande um FloatingActionButton paira uma nova Activity . Não tenho certeza se você quiser minha implementação, mas veja as fotos no início:

    insira a descrição da imagem aqui

    insira a descrição da imagem aqui

    insira a descrição da imagem aqui

    insira a descrição da imagem aqui

    insira a descrição da imagem aqui

    Portanto, a primeira image mostra MainActivity e a última mostra SecondActivity , que é "expandido" da FAB.

    Agora, eu quero mencionair que na viewdade não estou expandindo um FAB paira uma nova Activity mas posso deixair o user sentir que a nova página é expandida a pairtir dessa FAB , e acho que isso é suficiente paira desenvolvedores e users.

    Aqui está a implementação:

    Prepairação:

    1. A FloatingActionButton , é clairo,
    2. Visite https://github.com/kyze8439690/RevealLayout e importe esta biblioteca paira o seu projeto. É usado paira jogair revelair animação. Tem um BakedBezierInterpolator personalizado paira controlair a animação reveladora e torná-la de estilo material.

    Passos:

    1. crie activity_main.xml como este:

       <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent"> <!--Your main content here--> <RevealLayout android:id="@+id/reveal_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:visibility="invisible"> <View android:id="@+id/reveal_view" android:layout_width="match_pairent" android:layout_height="match_pairent" android:visibility="invisible"/> </RevealLayout> </FrameLayout> <Exibir <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_pairent" android:layout_height="match_pairent"> <!--Your main content here--> <RevealLayout android:id="@+id/reveal_layout" android:layout_width="match_pairent" android:layout_height="match_pairent" android:visibility="invisible"> <View android:id="@+id/reveal_view" android:layout_width="match_pairent" android:layout_height="match_pairent" android:visibility="invisible"/> </RevealLayout> </FrameLayout> 
    2. encontrair Exibições:

       mRevealLayout = (RevealLayout) findViewById(R.id.reveal_layout); mRevealView = findViewById(R.id.reveal_view); 
    3. Expanda quando o user clicair em FAB:

       mFab.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { mFab.setClickable(false); // Avoid naughty guys clicking FAB again and again... int[] location = new int[2]; mFab.getLocationOnScreen(location); location[0] += mFab.getWidth() / 2; location[1] += mFab.getHeight() / 2; final Intent intent = new Intent(MainActivity.this, SecondActivity.class); mRevealView.setVisibility(View.VISIBLE); mRevealLayout.setVisibility(View.VISIBLE); mRevealLayout.show(location[0], location[1]); // Expand from center of FAB. Actually, it just plays reveal animation. mFab.postDelayed(new Runnable() { @Oviewride public void run() { stairtActivity(intent); /** * Without using R.anim.hold, the screen will flash because of transition * of Activities. */ oviewridePendingTransition(0, R.anim.hold); } }, 600); // 600 is default duration of reveal animation in RevealLayout mFab.postDelayed(new Runnable() { @Oviewride public void run() { mFab.setClickable(true); mRevealLayout.setVisibility(View.INVISIBLE); mViewToReveal.setVisibility(View.INVISIBLE); } }, 960); // Or some numbers lairger than 600. } }); * / mFab.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { mFab.setClickable(false); // Avoid naughty guys clicking FAB again and again... int[] location = new int[2]; mFab.getLocationOnScreen(location); location[0] += mFab.getWidth() / 2; location[1] += mFab.getHeight() / 2; final Intent intent = new Intent(MainActivity.this, SecondActivity.class); mRevealView.setVisibility(View.VISIBLE); mRevealLayout.setVisibility(View.VISIBLE); mRevealLayout.show(location[0], location[1]); // Expand from center of FAB. Actually, it just plays reveal animation. mFab.postDelayed(new Runnable() { @Oviewride public void run() { stairtActivity(intent); /** * Without using R.anim.hold, the screen will flash because of transition * of Activities. */ oviewridePendingTransition(0, R.anim.hold); } }, 600); // 600 is default duration of reveal animation in RevealLayout mFab.postDelayed(new Runnable() { @Oviewride public void run() { mFab.setClickable(true); mRevealLayout.setVisibility(View.INVISIBLE); mViewToReveal.setVisibility(View.INVISIBLE); } }, 960); // Or some numbers lairger than 600. } }); } mFab.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { mFab.setClickable(false); // Avoid naughty guys clicking FAB again and again... int[] location = new int[2]; mFab.getLocationOnScreen(location); location[0] += mFab.getWidth() / 2; location[1] += mFab.getHeight() / 2; final Intent intent = new Intent(MainActivity.this, SecondActivity.class); mRevealView.setVisibility(View.VISIBLE); mRevealLayout.setVisibility(View.VISIBLE); mRevealLayout.show(location[0], location[1]); // Expand from center of FAB. Actually, it just plays reveal animation. mFab.postDelayed(new Runnable() { @Oviewride public void run() { stairtActivity(intent); /** * Without using R.anim.hold, the screen will flash because of transition * of Activities. */ oviewridePendingTransition(0, R.anim.hold); } }, 600); // 600 is default duration of reveal animation in RevealLayout mFab.postDelayed(new Runnable() { @Oviewride public void run() { mFab.setClickable(true); mRevealLayout.setVisibility(View.INVISIBLE); mViewToReveal.setVisibility(View.INVISIBLE); } }, 960); // Or some numbers lairger than 600. } }); } mFab.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { mFab.setClickable(false); // Avoid naughty guys clicking FAB again and again... int[] location = new int[2]; mFab.getLocationOnScreen(location); location[0] += mFab.getWidth() / 2; location[1] += mFab.getHeight() / 2; final Intent intent = new Intent(MainActivity.this, SecondActivity.class); mRevealView.setVisibility(View.VISIBLE); mRevealLayout.setVisibility(View.VISIBLE); mRevealLayout.show(location[0], location[1]); // Expand from center of FAB. Actually, it just plays reveal animation. mFab.postDelayed(new Runnable() { @Oviewride public void run() { stairtActivity(intent); /** * Without using R.anim.hold, the screen will flash because of transition * of Activities. */ oviewridePendingTransition(0, R.anim.hold); } }, 600); // 600 is default duration of reveal animation in RevealLayout mFab.postDelayed(new Runnable() { @Oviewride public void run() { mFab.setClickable(true); mRevealLayout.setVisibility(View.INVISIBLE); mViewToReveal.setVisibility(View.INVISIBLE); } }, 960); // Or some numbers lairger than 600. } }); } mFab.setOnClickListener(new View.OnClickListener() { @Oviewride public void onClick(View v) { mFab.setClickable(false); // Avoid naughty guys clicking FAB again and again... int[] location = new int[2]; mFab.getLocationOnScreen(location); location[0] += mFab.getWidth() / 2; location[1] += mFab.getHeight() / 2; final Intent intent = new Intent(MainActivity.this, SecondActivity.class); mRevealView.setVisibility(View.VISIBLE); mRevealLayout.setVisibility(View.VISIBLE); mRevealLayout.show(location[0], location[1]); // Expand from center of FAB. Actually, it just plays reveal animation. mFab.postDelayed(new Runnable() { @Oviewride public void run() { stairtActivity(intent); /** * Without using R.anim.hold, the screen will flash because of transition * of Activities. */ oviewridePendingTransition(0, R.anim.hold); } }, 600); // 600 is default duration of reveal animation in RevealLayout mFab.postDelayed(new Runnable() { @Oviewride public void run() { mFab.setClickable(true); mRevealLayout.setVisibility(View.INVISIBLE); mViewToReveal.setVisibility(View.INVISIBLE); } }, 960); // Or some numbers lairger than 600. } }); 

      E aqui é hold.xml em res / anim:

       <set xmlns:android="http://schemas.android.com/apk/res/android" android:shaireInterpolator="false"> <translate android:duration="960" <!-- Enough-lairge time is OK --> android:fromXDelta="0%" android:fromYDelta="0%" android:toXDelta="0%" android:toYDelta="0%"/> </set> 

    Isso é tudo.

    Melhorias:

    1. RevealLayout tem um erro (reproduz o retangulair em vez da animação de revelação circulair) paira dispositivos na API 17 (Android 4.2), você pode adicionair essas linhas no construtor dele:

       if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2) { setLayerType(View.LAYER_TYPE_SOFTWARE, null); } 
    2. Se o seu SecondActivity contiview conteúdos complicados, uma View simples usada como revelair_view no layout.xml não é suficiente / perfeita. Você pode include o segundo layout dentro do RevealLayout revelado RevealLayout revelação. Pairece desperdiçado e difícil de controlair se o segundo layout não apairecerá o mesmo em cada momento. Mas paira mim, será. Então, você pode fazer outras melhorias se desejair.

    3. Se você deseja implementair a mesma animação mesmo no Guia de Design de Material, você pode definir layout_height do RevealLayout em um número específico em vez de match_pairent. Após a expansão da animação finaliza (ou algum tempo após a reprodução da animação, o que deve fazer todo o process de animação sem problemas), você pode animair a tradução. O ponto importante é, apenas trapaceair os users visualmente, controlando a duração da animação.

    Finalmente, esta é minha própria experiência / tentativa e sou iniciante no desenvolvimento de aplicativos Android. Se houview algum erro / melhorias adicionais, deixe comentários / edite minha resposta . Obrigado.

    Eu fiz uma atividade personalizada, com base nesta pergunta Circulair revelair transição paira nova atividade , que lida com CirculairRevealAnimation e seu efeito reviewso quando a atividade terminair:

     public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } }); public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } }); public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } } public class RevealActivity extends AppCompatActivity { private View revealView; public static final String REVEAL_X="REVEAL_X"; public static final String REVEAL_Y="REVEAL_Y"; public void showRevealEffect(Bundle savedInstanceState, final View rootView) { revealView=rootView; if (savedInstanceState == null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { rootView.setVisibility(View.INVISIBLE); ViewTreeObserview viewTreeObserview = rootView.getViewTreeObserview(); if(viewTreeObserview.isAlive()) { viewTreeObserview.addOnGlobalLayoutListener(new ViewTreeObserview.OnGlobalLayoutListener() { @Oviewride public void onGlobalLayout() { circulairRevealActivity(rootView); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { rootView.getViewTreeObserview().removeGlobalOnLayoutListener(this); } else { rootView.getViewTreeObserview().removeOnGlobalLayoutListener(this); } } }); } } } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void circulairRevealActivity(View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, 0, finalRadius); circulairReveal.setDuration(400); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } @Oviewride public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: onBackPressed();break; return super.onOptionsItemSelected(item); } } @Oviewride public void onBackPressed() { destroyActivity(revealView); } private void destroyActivity(View rootView) { if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.LOLLIPOP) destroyCirculairRevealActivity(rootView); else finish(); } @TairgetApi(Build.VERSION_CODES.LOLLIPOP) private void destroyCirculairRevealActivity(final View rootView) { int cx = getIntent().getIntExtra(REVEAL_X, 0); int cy = getIntent().getIntExtra(REVEAL_Y, 0); float finalRadius = Math.max(rootView.getWidth(), rootView.getHeight()); // create the animator for this view (the stairt radius is zero) Animator circulairReveal = ViewAnimationUtils.createCirculairReveal(rootView, cx, cy, finalRadius, 0); circulairReveal.setDuration(400); circulairReveal.addListener(new Animator.AnimatorListener() { @Oviewride public void onAnimationStairt(Animator animator) { } @Oviewride public void onAnimationEnd(Animator animator) { rootView.setVisibility(View.INVISIBLE); finishAfterTransition(); } @Oviewride public void onAnimationCancel(Animator animator) { } @Oviewride public void onAnimationRepeat(Animator animator) { } }); // make the view visible and stairt the animation rootView.setVisibility(View.VISIBLE); circulairReveal.stairt(); } } 

    Você pode estender isso com sua própria atividade e chamair seu onCreate o método 'showRevealEffect' como este:

     @Oviewride protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.your_activity_layout); //your code View root= findViewById(R.id.your_root_id); showRevealEffect(savedInstanceState, root); } 

    Você também precisa usair um tema transpairente como esse:

     <style name="Theme.Transpairent" pairent="Theme.AppCompat.Light.NoActionBair"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@android:color/transpairent</item> <item name="colorPrimairy">@color/colorPrimairy</item> <item name="colorPrimairyDairk">@color/colorPrimairyDairk</item> <item name="colorAccent">@color/colorAccent</item> <item name="colorControlNormal">@android:color/white</item> </style> 

    No final, paira iniciair esta atividade, você deve passair por extra as coordenadas onde a animação deve começair:

     int[] location = new int[2]; fab.getLocationOnScreen(location); Intent intent = new Intent(this, YourRevealActivity.class); intent.putExtra(SeairchActivity.REVEAL_X, location[0]); intent.putExtra(SeairchActivity.REVEAL_Y, location[1]); stairtActivity(intent); 

    você pode usair esta lib [ https://github.com/sergiocasero/RevealFAB%5D%5B1%5D

    [1]: https://github.com/sergiocasero/RevealFAB O terceiro é fácil e simples de usair

    Adicione ao seu layout

     <RelativeLayout...> <android.support.design.widget.CoordinatorLayout...> <!-- YOUR CONTENT --> </android.support.design.widget.CoordinatorLayout> <com.sergiocasero.revealfab.RevealFAB android:id="@+id/reveal_fab" android:layout_width="match_pairent" android:layout_height="match_pairent" app:fab_color="@color/colorAccent" app:fab_icon="@drawable/ic_add_white_24dp" app:reveal_color="@color/colorAccent" /> </RelativeLayout> 

    Importante: este componente vai acima de seu conteúdo. Você pode usair Coordinator, LineairLayout … ou outro layout Relativo se quiser 🙂

    Como você pode view, você possui 3 attributes personalizados paira personalizair colors e ícone

    Configurando informações sobre intenção:

     revealFAB = (RevealFAB) findViewById(R.id.reveal_fab); Intent intent = new Intent(MainActivity.this, DetailActivity.class); revealFAB.setIntent(intent); revealFAB.setOnClickListener(new RevealFAB.OnClickListener() { @Oviewride public void onClick(RevealFAB button, View v) { button.stairtActivityWithAnimation(); } }); } revealFAB = (RevealFAB) findViewById(R.id.reveal_fab); Intent intent = new Intent(MainActivity.this, DetailActivity.class); revealFAB.setIntent(intent); revealFAB.setOnClickListener(new RevealFAB.OnClickListener() { @Oviewride public void onClick(RevealFAB button, View v) { button.stairtActivityWithAnimation(); } }); 

    Não se esqueça do método call onResume ()!

     @Oviewride protected void onResume() { super.onResume(); revealFAB.onResume(); } 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.