traex / rippleeffect Goto Github PK
View Code? Open in Web Editor NEWImplementation of Ripple effect from Material Design for Android API 9+
License: MIT License
Implementation of Ripple effect from Material Design for Android API 9+
License: MIT License
I tried to add RippleView
a rounded background but Ripple Effect is not clipped to that bounds. I also tried clipChildren
.
I am using this Library in listview.
Since my custom listview has button, so I attached onclickListener in getView() method.
But when I click a button inside listview, it both take effect on Button click listener & list item click listener.
I tried to attach click listener in getView() method( ex)view.setOnClickListener...) instead of list item click listener, but it doesn't work.
plz fix this issue :(
As title says, consider prefixing the attributes in the attrs.xml file, such that they don't clash with other libraries. In my Xamarin.Android port I am using rv
infront of all of them. It might not be super unique traex
or something similar could also be used.
Thanks :)
Can you please look at my code and advice me on how to add the ripple affect to my Navigation Drawer List. I tried everything and it did not work!.
https://github.com/VideoFly/VideoFly
Hi, your RippleEffect library is so awesome. I would like to thank you so much.
But I have a trouble: I use ripple effect on a button, then when user presses on this button, my app will start new activity. The problem here is the ripple effect has not finished yet, but my app is already navigated to new activity. How can i resolve this issue? Thanks.
this two attributes are not working
app:rv_rippleDuration="1200"
app:rv_color="#d3d3d3"
ripple effect should complete first then action should be called. But here action is get called as soon as button is clicked. User cannot experience animation.
I had a recyler view in which i had item.setOnClickListener for each element and the OnClickListener is not working with this library
I am currently using the new Navigation View support library that Android released, and with it I want the menu drawers to have a ripple effect.
So I tried enclosing the new Navigation View widget support for Android with your RippleEffect. But if gives me an invalid argument error.
<com.andexert.library.RippleView>
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
rv_centered="true">
<android.support.design.widget.NavigationView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
app:paddingStart="@dimen/spacing_none"
app:paddingEnd="@dimen/spacing_none"
app:itemTextColor="@color/drawer_color"
app:menu="@menu/menu_navigation_drawer"
app:headerLayout="@layout/header_navigation_drawer"
android:focusable="false"/>
</com.andexert.library.RippleView>
Is this currently supported or not? If not, are there any workarounds to apply Ripple Effect to the menu drawers of the Navigation View?
I hope clicked RippleEffect View Effect finish change it background color equals effect color.
Option for hover mode would be nice! Great lib btw :)
Hi, first of all, I would like to say thanks for this lib (it is my favourite amongst other ripple libraries).
However, I was wondering; is there any chance that you could add ripple event listeners (e.g. onRippleAnimationComplete), or custom onClick listeners, so that we wouldn't need to use delayed execution to display ripple first and then execute our code?
Also, will there be any methods like "rippleStop" to stop ripple display?
can you remove ic_launcher in library because its use unwanted memory.
I am using RippleView to show ripple animations and setting a clicklistener as well as a longclicklistener.
The animations work for both cases but the longclicklistener is always fired twice. (I am opening an alert dialog which pops up twice)
Any help will be appreciated.
I tried this and it works fine, but I can not find out the way to make it show animation on long click. Is that it does not support or I do it in wrong way?
can not build succeed in andoid gradle tool 1.2.2
Unfortunately I cant find setRippleColor() method in build from gradle com.github.traex.rippleeffect:library:1.2.4
Hi,
I use a FloatingActionButton Library [1] and wanted to use the ripple on this.
However the effect is stopped rectangular around the button which looks kind of messy.
What I mean, the button is round graphically but the ripple continues to the button's edges which are straight.
It would be nice to define a maximum radius to which the ripple will continue instead of the view bounds.
Do you get what I mean? If not I try to add a screencast.
Regards,
David
I have added a custom onItemTouchListener for reacting to touch events,that works well but ripple effect is all gone.Is there some sort of conflict between these two??I am pretty new to android so please dont mind if i am missing something really easy
Hello!
First of all congrats for the library. I wanna know if there is any way of waiting until the ripple animation ends to then send the click event to the child view.
I am asking it because I am trying to use it in a RecyclerView but it isn't possible to see it till the end.
Cheers,
java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@2d5d2d1f
at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1282)
at android.graphics.Canvas.drawBitmap(Canvas.java:1416)
at com.andexert.library.RippleView.getCircleBitmap(RippleView.java:318) ...
Hello,
I have question: can you change part of a library code:
private void sendClickEvent(final Boolean isLongClick)
{
if (getParent() instanceof ListView)
{
final int position = ((ListView) getParent()).getPositionForView(this);
final long id = ((ListView) getParent()).getItemIdAtPosition(position);
if (isLongClick)
{
if (((ListView) getParent()).getOnItemLongClickListener() != null)
((ListView) getParent()).getOnItemLongClickListener().onItemLongClick(((ListView) getParent()), this, position, id);
}
else
{
if (((ListView) getParent()).getOnItemClickListener() != null)
((ListView) getParent()).getOnItemClickListener().onItemClick(((ListView) getParent()), this, position, id);
}
}
}
Current code don't work good with GridView, RippleView steals touch events, so onItemClick is not fired, but if you change parent casting to AbsListView
http://developer.android.com/reference/android/widget/AbsListView.html
your library will be automatically supported by GridView, Carousel and other list based widget containers.
How can I add ripple effect on Menu Item? Please provide an example.
How can I disable the ripple effect when the button is also disabled, and enable it back when button is enabled?
Hi
Is anybody having problems setting OnClick listeners?
I tried with the sample too, using standard way, using Butterknife. I tried to set the listener on the RippleView, or on the inner ImageView. I can't get the click fired.
Thank you
I love this library. Can't see anywhere else to leave feedback though - Is there a way to do the ripple inverse? I'm thinking it would look nice with a circle button being turned off! (Btw, you have a a custom Action Bar - or does this work for regular Action Bar buttons?)
I used the same code as you used . Only difference is i used listview in place of recyclerview.
I applied ripple widget to the list item that i inflated. I kept that ripple widget com.andexert.library.RippleView as parent(same as you did) in row_view.xml. By doing this ripples are applied well but on click listener of list view stopped working. Please help me how to resolve this
hi
is it possible to use it on eclipse ?
I'm curious why you are extending RelativeLayout rather than FrameLayout. The I believe FrameLayout is supposed to be more efficient.
How we can use this with SherlockActionBar & SherlockActivity & Fragment ?
please reply ASAP...
waiting for +ve response...
How can i make this work for buttons on android.support.v7.widget.Toolbar?
Add rv_rippleDelayClick attribute for waiting of finish animation for calling performClick() action
can i use this lib for buttons
Hi!
Please, update version to achieve setRippleColor func, and it would be useful to have possibility to disable RippleView (state without ripple effect after touch)
Hi, I'm setting a onRippleCompleted listener for a view in a recycler view and it works beautifully with a normal click.
The problem is that the view also has a onCreateContextMenuListener. And when the long click fires, showing the context menu, the ripple also completes.
Is there a way to cancel the ripple on a long click?
Draw function is not called when view is not visible. It may cause problems
Imagine following scenario:
1.Ripple starts
2.View becomes not visible (moved outside screen,visiblity changed,its parent visiblity change)
3.draw is not called -> timer is not updated. Ripple stops.
4.After some time view becomse visible, and the ripple continues
This may seem like a rare scenario but it happend few times in our project. We fixed it by
making timer update outside draw
Hi,
i tried to add this method to RippleView class:
public void startRippleEffect() {
this.x = getMeasuredWidth() / 2;
this.y = getMeasuredHeight() / 2;
this.animationRunning = true;
invalidate();
}
it works with me but at first, the user have to click the view at least one time :(
what is the solution?
Basically what I'm doing is extending RelativeLayout to create a new custom "ViewGroup" and inflating the layout that has the ripple view on it.
When I click on the compound view the click is not received by the compound view but by the RippleView so there is no way to catch the event unless I declare a android:OnClick property on the RippleView and handle it on the activity that has the custom ViewGroup.
Hi, I've noticed some poor performace if the project use the NineOldsAndroid library. Anyone can test?
Android Studio has problems rendering a layout where RippleView is present.
You should avoid that by using View.isInEditMode()
in your init
method.
Your init should look like:
private void init(final Context context, final AttributeSet attrs)
{
if (!isInEditMode()) {
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.color.rippelColor));
rippleType = typedArray.getInt(R.styleable.RippleView_rv_type, 0);
[...]
this.setDrawingCacheEnabled(true);
}
}
Since you don't need to show anything in the preview window it is enough to just do nothing when in edit mode.
Hi I want to have reveal effect similar to when we touch on corner on RippleView present in this lib.
But I want to manually trigger that ripple instead of user's touch. Could you guys add a function to trigger it ?
I tried following but it didn't work.
// Obtain MotionEvent object
long downTime = SystemClock.uptimeMillis();
long eventTime = SystemClock.uptimeMillis() + 100;
float x = (rippleLayout.getLeft() + rippleLayout.getRight())/2;
float y = (rippleLayout.getTop() + rippleLayout.getBottom())/2;
// List of meta states found here: developer.android.com/reference/android/view/KeyEvent.html#getMetaState()
int metaState = 0;
MotionEvent motionEvent = MotionEvent.obtain(
downTime,
eventTime,
MotionEvent.ACTION_DOWN,
x,
y,
metaState
);
// Dispatch touch event to view
rippleLayout.dispatchTouchEvent(motionEvent);
rippleLayout.onTouchEvent(motionEvent);
Hi Robin,
Just wanted to let you know I have ported this to Xamarin.Android: https://github.com/Cheesebaron/RippleEffect
Copyright remains and you have been thanked in the README as well. Look it through and tell me if I missed some of the copyright as Visual Studio might have eaten some of the comments.
Thanks 👍
Hey there!
First of all before mentioning the error....Nice job there! Really simple finally something available on an version less than 12 :P
Anyway...I tried to implement the ripple:rv_type="doubleRipple" but I got this :
12-23 17:52:35.795 5456-5456/com.jusp E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.jusp, PID: 5456
java.lang.RuntimeException: Canvas: trying to use a recycled bitmap android.graphics.Bitmap@4025008
at android.graphics.Canvas.throwIfCannotDraw(Canvas.java:1225)
at android.graphics.Canvas.drawBitmap(Canvas.java:1359)
at com.jusp.gui.tablet.RippleView.getCircleBitmap(RippleView.java:255)
at com.jusp.gui.tablet.RippleView.draw(RippleView.java:165)
at android.view.View.updateDisplayListIfDirty(View.java:14048)
at android.view.View.getDisplayList(View.java:14071)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
at android.view.View.updateDisplayListIfDirty(View.java:14008)
at android.view.View.getDisplayList(View.java:14071)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
at android.view.View.updateDisplayListIfDirty(View.java:14008)
at android.view.View.getDisplayList(View.java:14071)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
at android.view.View.updateDisplayListIfDirty(View.java:14008)
at android.view.View.getDisplayList(View.java:14071)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
at android.view.View.updateDisplayListIfDirty(View.java:14008)
at android.view.View.getDisplayList(View.java:14071)
at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3388)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3367)
at android.view.View.updateDisplayListIfDirty(View.java:14008)
at android.view.View.getDisplayList(View.java:14071)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:266)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:272)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:311)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2492)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2337)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1968)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Does anyone know what would cause that?
Thanx :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.