-
Notifications
You must be signed in to change notification settings - Fork 387
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
122 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
app/src/main/java/io/codetail/circualrevealsample/Sample3Activity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package io.codetail.circualrevealsample; | ||
|
||
import android.graphics.Rect; | ||
import android.os.Build; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.view.ViewTreeObserver; | ||
import android.view.animation.AccelerateDecelerateInterpolator; | ||
|
||
import io.codetail.animation.SupportAnimator; | ||
import io.codetail.animation.ViewAnimationUtils; | ||
|
||
public class Sample3Activity extends AppCompatActivity | ||
implements ViewTreeObserver.OnGlobalLayoutListener{ | ||
|
||
private CardViewPlus mContentView; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_sample_3); | ||
|
||
mContentView = (CardViewPlus) findViewById(R.id.content); | ||
|
||
getViewTreeObserver().addOnGlobalLayoutListener(this); | ||
} | ||
|
||
protected View getRootView(){ | ||
return mContentView; | ||
} | ||
|
||
protected ViewTreeObserver getViewTreeObserver(){ | ||
return getRootView().getViewTreeObserver(); | ||
} | ||
|
||
protected void startRevealTransition(){ | ||
final Rect bounds = new Rect(); | ||
getRootView().getHitRect(bounds); | ||
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(getRootView(), | ||
bounds.right, bounds.bottom, 0, Sample2Activity.hypo(bounds.height(), bounds.width())); | ||
animator.setDuration(1000); | ||
animator.setInterpolator(new AccelerateDecelerateInterpolator()); | ||
animator.start(); | ||
} | ||
|
||
@Override | ||
public void onGlobalLayout() { | ||
if(Build.VERSION.SDK_INT >= 16) { | ||
getViewTreeObserver().removeOnGlobalLayoutListener(this); | ||
}else{ | ||
getViewTreeObserver().removeGlobalOnLayoutListener(this); | ||
} | ||
|
||
startRevealTransition(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<io.codetail.widget.RevealFrameLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<io.codetail.circualrevealsample.CardViewPlus | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:id="@+id/content" | ||
style="@style/CardView" | ||
app:cardElevation="2dp" | ||
app:cardPreventCornerOverlap="false" | ||
app:cardUseCompatPadding="true" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:layout_gravity="center_horizontal"> | ||
|
||
<io.codetail.circualrevealsample.CardViewPlus | ||
app:cardBackgroundColor="?colorPrimary" | ||
android:layout_width="match_parent" | ||
android:layout_height="112dp" /> | ||
|
||
<io.codetail.circualrevealsample.CardViewPlus | ||
android:layout_width="300dp" | ||
android:layout_height="200dp" | ||
android:layout_marginTop="146dp" | ||
android:layout_gravity="center_horizontal" | ||
/> | ||
|
||
<io.codetail.circualrevealsample.CardViewPlus | ||
android:layout_width="300dp" | ||
android:layout_height="200dp" | ||
android:layout_marginTop="354dp" | ||
android:layout_gravity="center_horizontal" | ||
/> | ||
|
||
<android.support.design.widget.FloatingActionButton | ||
android:layout_height="wrap_content" | ||
android:layout_width="wrap_content" | ||
android:layout_gravity="right" | ||
android:layout_marginRight="16dp" | ||
android:layout_marginTop="86dp" | ||
/> | ||
|
||
</io.codetail.circualrevealsample.CardViewPlus> | ||
|
||
</io.codetail.widget.RevealFrameLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters