A customizable view with a cool animation when double tap it and a simple listener.
You can see a Sample Project here and learn more on the Wiki.
<douglasspgyn.com.github.doubletapview.DoubleTapView
android:id="@+id/doubleTapView"
android:layout_width="200dp"
android:layout_height="200dp"
app:animatedViewAnimation="@anim/bounce_in_out"
app:animatedViewBackground="@drawable/round_background_view"
app:animatedViewBackgroundColor="@color/colorPrimary"
app:animatedViewDrawable="@drawable/ic_android"
app:animatedViewDrawableColor="@color/colorAccent"
app:animatedViewMeasure="100dp"
app:backgroundScaleType="centerInside" />
doubleTapView.setAnimatedViewAnimation(R.anim.bounce_in_out);
doubleTapView.setAnimatedViewBackground(R.drawable.round_background_view);
doubleTapView.setAnimatedViewBackgroundColor(R.color.colorPrimary);
doubleTapView.setAnimatedViewDrawable(R.drawable.ic_android);
doubleTapView.setAnimatedViewDrawableColor(R.color.colorAccent);
doubleTapView.setAnimatedViewMeasure(100);
doubleTapView.enableDoubleTap();
doubleTapView.disableDoubleTap();
doubleTapView.isDoubleTapEnabled()
doubleTapView.setOnDoubleTapEventListener(new DoubleTapView.onDoubleTapEventListener() {
@Override
public void onDoubleTap() {
Toast.makeText(context, "Double Tap Callback", Toast.LENGTH_SHORT).show();
}
});
doubleTapView.removeOnDoubleTapEventListener();
doubleTapView.getDoubleTapEventListener();
Picasso.with(this).load("http://i.imgur.com/DvpvklR.png").into(doubleTapView.getBackgroundImageView());
You just need to add the Maven Jitpack repository on Project Gradle:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
and the library dependence on Module Gradle:
dependencies {
compile 'com.github.douglasspgyn:DoubleTapView:0.6.0'
}