balysv / material-ripple

Android L Ripple effect wrapper for Views
Apache License 2.0
2.36k stars 477 forks source link

programmatically added ripple has no effect #34

Open alosdev opened 9 years ago

alosdev commented 9 years ago

I'm using "1.0.6-SNAPSHOT" from sonatype, which works fine, from last october. Than i switched to the release version 1.0.1 and the programmatically added MaterialRippleLayout has no effect, when I click on the item itself. Do you have any hints?

balysv commented 9 years ago

Do not use any of the SNAPSHOTS, they're outdated.

Could you provide the code you used that doesn't work?

alosdev commented 9 years ago

MaterialRippleLayout.on(view).rippleColor(view.getResources().getColor(R.color.scout_grey_4)).create()

alosdev commented 9 years ago

@balysv do you have any idea?

balysv commented 9 years ago

Did you use compile 'com.balysv:material-ripple:1.0.1'?

alosdev commented 9 years ago

yes

Balys Valentukevicius notifications@github.com schrieb am Di., 24. März 2015 um 11:35 Uhr:

Did you use compile 'com.balysv:material-ripple:1.0.1'?

— Reply to this email directly or view it on GitHub https://github.com/balysv/material-ripple/issues/34#issuecomment-85443596 .

balysv commented 9 years ago

Provide the xml of the view or any modification that you do it before & after applying the ripple, thanks :)

alosdev commented 9 years ago

this is the item of a recyclerview, which adds the ripplelayout in the creation of the item:

<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView style="@style/card_layout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" app:cardBackgroundColor="@color/white" xmlns:app="http://schemas.android.com/apk/res-auto">

<RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content">

<View
    android:id="@+id/brand_color"
    android:layout_width="match_parent"
    android:layout_height="@dimen/default_gap"
    android:background="@color/scout_blue_11"/>

<de.is24.mobile.android.ui.view.LazyLoadingImageView
    android:id="@+id/picture"
    android:layout_width="match_parent"
    android:layout_height="@dimen/result_list_image_height_xl"
    android:layout_below="@+id/brand_color"/>

<TextView
    android:id="@+id/new_badge"
    style="@style/staggered_grid_view_item_text.new_badge"
    android:layout_below="@+id/picture"
    android:text="@string/label_new_badge"/>

<TextView
    android:id="@+id/criteria_info"
    style="@style/staggered_grid_view_item_text"
    android:layout_below="@+id/picture"
    android:layout_marginLeft="16dp"
    android:layout_marginTop="16dp"
    android:textSize="20sp"
    android:fontFamily="@string/font_family_medium"
    android:layout_toRightOf="@+id/new_badge"
    android:layout_toLeftOf="@+id/favorite_marker"
    android:textIsSelectable="false"
    tools:text="criteria"
    tools:ignore="UnusedAttribute"/>

<TextView
    android:id="@+id/location_info"
    style="@style/staggered_grid_view_item_text"
    android:layout_below="@+id/criteria_info"
    android:layout_marginLeft="16dp"
    android:layout_toLeftOf="@+id/favorite_marker"
    android:textIsSelectable="false"
    tools:text="location info"
    android:paddingBottom="16dp"/>

<ImageView
    android:id="@+id/favorite_marker"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/picture"
    android:layout_alignParentRight="true"
    android:layout_alignBottom="@id/location_info"
    android:contentDescription="@null"
    android:padding="16dp"
    android:scaleType="center"
    android:src="@drawable/ic_staroutline_in_list_active"/>

<ImageView
    android:id="@+id/via_badge"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/badge_premium"/>

<de.is24.mobile.android.ui.view.LazyLoadingImageView
    android:id="@+id/realtor_logo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="@dimen/half_gap"
    android:adjustViewBounds="true"
    android:maxHeight="@dimen/realtor_logo_height"
    android:maxWidth="@dimen/realtor_logo_max_width"
    android:minWidth="@dimen/realtor_logo_min_width"
    android:scaleType="fitEnd"/>

</android.support.v7.widget.CardView>

balysv commented 9 years ago

I'll have a look, I haven't tested it with RecyclerView

treylon commented 9 years ago

Any progress on this?

balysv commented 9 years ago

Sorry, had little time in the past months. Gonna have a look in the upcoming week.

balysv commented 9 years ago

Tested with RecyclerView and it works as expected except for #35 which I'm working on now.

Might be that your layout background overlays the ripples. Try:

MaterialRippleLayout.on(view)
    .rippleOverlay(true)
    .rippleHover(true)
    .rippleColor(color)
    .create()
aricneto commented 9 years ago

Had this problem and even after setting the overlay to true it still wasn't showing. I set rippleAlpha() to 0.2f and it started working, so it was probably working all the time and you just couldn't see.

JensSchmitt commented 9 years ago

thx very much, that solved it! combination of rippleOverlay, rippleHover and rippleAlpha

rvats011990 commented 6 years ago

Thanks @aricneto I forgot to set rippleAlpha(). Beautiful API....