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

setRating not work in kotlin #59

Open aslami-dev opened 4 years ago

aslami-dev commented 4 years ago

I'm trying to setRating(SmileyRating.Type.GREAT.rating, true) in kotlin similar to your description but it not work for me, and always TERRIBLE is selected what is my mistake?

`    smileyRating.setFaceBackgroundColor(SmileyRating.Type.TERRIBLE, Color.RED)
    smileyRating.setFaceBackgroundColor(SmileyRating.Type.BAD, 0xFFFF8606.toInt())
    smileyRating.setFaceBackgroundColor(SmileyRating.Type.GREAT, 0xFF50DA30.toInt())
    smileyRating.setFaceBackgroundColor(SmileyRating.Type.OKAY, 0xFFF3C641.toInt())

    smileyRating.setRating(SmileyRating.Type.GREAT.rating, true)

    smileyRating.setTitle(SmileyRating.Type.TERRIBLE, "Worst pain")
    smileyRating.setTitle(SmileyRating.Type.BAD, "Very Severe")
    smileyRating.setTitle(SmileyRating.Type.OKAY, "Moderate")
    smileyRating.setTitle(SmileyRating.Type.GOOD, "Mild")
    smileyRating.setTitle(SmileyRating.Type.GREAT, "No Pain")

` also, I try and it not work

smileyRating.setRating(3, true)

mauricioguell-sagaci commented 4 years ago

Faced the same problem and solved by adding a little delay in the setRating method

rama-2402 commented 3 years ago

Faced the same problem and solved by adding a little delay in the setRating method

@mauricioguell-sagaci Can you please tell me what function you used for delaying? I've tried using Coroutines, Handler, runblocking, Timer, After the delay it sets the rating correct but the color on the faces are gone :(