-
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.
required min sdk version changed to 15,
you can now set custom layer type
- Loading branch information
Showing
17 changed files
with
242 additions
and
321 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
69 changes: 69 additions & 0 deletions
69
app/src/main/java/io/codetail/circualrevealsample/FragmentRevealExample.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,69 @@ | ||
package io.codetail.circualrevealsample; | ||
|
||
import android.animation.Animator; | ||
import android.graphics.Color; | ||
import android.os.Bundle; | ||
import android.support.annotation.Nullable; | ||
import android.support.v4.app.Fragment; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.view.ViewTreeObserver; | ||
import android.view.animation.AccelerateDecelerateInterpolator; | ||
import android.widget.FrameLayout; | ||
import android.widget.ImageView; | ||
|
||
import io.codetail.animation.ViewAnimationUtils; | ||
import io.codetail.widget.RevealFrameLayout; | ||
|
||
import static android.view.ViewGroup.LayoutParams.MATCH_PARENT; | ||
import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; | ||
|
||
public class FragmentRevealExample extends Fragment { | ||
|
||
private Animator mRevealAnimator; | ||
|
||
@Nullable | ||
@Override | ||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
final FrameLayout frameLayout = new RevealFrameLayout(getContext()); | ||
|
||
final FrameLayout content = new FrameLayout(getContext()); | ||
content.setBackgroundColor(Color.WHITE); | ||
content.setVisibility(View.INVISIBLE); | ||
|
||
frameLayout.addView(content, new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT)); | ||
|
||
final ImageView imageView = new ImageView(getContext()); | ||
imageView.setImageResource(R.drawable.example_raw_image); | ||
|
||
FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(MATCH_PARENT, WRAP_CONTENT); | ||
lp.topMargin = 16; | ||
lp.leftMargin = 16; | ||
lp.rightMargin = 16; | ||
lp.bottomMargin = 16; | ||
|
||
content.addView(imageView, lp); | ||
|
||
content.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | ||
@Override | ||
public boolean onPreDraw() { | ||
content.getViewTreeObserver().removeOnPreDrawListener(this); | ||
content.setVisibility(View.VISIBLE); | ||
|
||
// actually you need to set visibility before stating animation in listener | ||
|
||
mRevealAnimator = ViewAnimationUtils.createCircularReveal(content, 0, 0, 0, | ||
MainActivity.hypo(content.getWidth(), content.getHeight())); | ||
mRevealAnimator.setDuration(500); | ||
mRevealAnimator.setStartDelay(100); | ||
mRevealAnimator.setInterpolator(new AccelerateDecelerateInterpolator()); | ||
mRevealAnimator.start(); | ||
return true; | ||
} | ||
}); | ||
|
||
return frameLayout; | ||
} | ||
|
||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<stroke android:width="4dp" android:color="#fff" /> | ||
</shape> |
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
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 |
---|---|---|
@@ -1,17 +1,37 @@ | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'android-maven' | ||
apply plugin: 'com.github.dcendents.android-maven' | ||
|
||
android { | ||
compileSdkVersion 22 | ||
buildToolsVersion "22.0.1" | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.2" | ||
|
||
|
||
defaultConfig { | ||
minSdkVersion 9 | ||
targetSdkVersion 22 | ||
minSdkVersion 15 | ||
targetSdkVersion 23 | ||
} | ||
} | ||
|
||
dependencies { | ||
compile 'com.nineoldandroids:library:2.4.0' | ||
// build a jar with source files | ||
task sourcesJar(type: Jar) { | ||
from android.sourceSets.main.java.srcDirs | ||
classifier = 'sources' | ||
} | ||
|
||
task javadoc(type: Javadoc) { | ||
failOnError false | ||
source = android.sourceSets.main.java.sourceFiles | ||
classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) | ||
classpath += configurations.compile | ||
} | ||
|
||
// build a jar with javadoc | ||
task javadocJar(type: Jar, dependsOn: javadoc) { | ||
classifier = 'javadoc' | ||
from javadoc.destinationDir | ||
} | ||
|
||
artifacts { | ||
archives sourcesJar | ||
archives javadocJar | ||
} |
Oops, something went wrong.