sujithkanna / SmileyRating

SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.
Apache License 2.0
1.07k stars 183 forks source link

smileyrating on a recyclerview when disallowSelection(true) #65

Open ghost opened 3 years ago

ghost commented 3 years ago

Hi

Thank you for a magnificent component!
I saw the code you posted regarding working with RecyclerView but from my understanding it's related to touch events conflicts and this is irrelevant in my case, please see code below.

I have a fragment with a scrollview containing 6 smiley rating component and I have a recyclerview with a scrollview containing 6 smiley rating component. On both I have the following code (for simplicity, the example shows 2 components):

srRater1.disallowSelection(true);
srRater2.disallowSelection(true);
srRater1.setRating(dataSet.get(0).getRate1(), true); //dataSet.get(0).getRate1() = 4
srRater2.setRating(dataSet.get(0).getRate2(), true);

With the fragment/scrollview everything is working as expected but with the recyclerview/scrollview, the debugger shows the correct smiley selected but the actual selected smiley is 0. image

Am I missing something? Thanks

ghost commented 3 years ago

The problem seems to be with mInflationDone which is false or in other words, the view thinks it's still not inflated. When not inside a recyclerview, this is true hence working.

rama-2402 commented 3 years ago

The problem seems to be with mInflationDone which is false or in other words, the view thinks it's still not inflated. When not inside a recyclerview, this is true hence working.

Hi i'm having the same issue. The smileyrating is always at 0. Btw how to fix this inside the recycler view?