sujithkanna / SmileyRating

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

SmileyRating Not Work in a Adapter #2

Closed TuxRneR closed 7 years ago

TuxRneR commented 7 years ago

How i implement this in Adapter?

sujithkanna commented 7 years ago

@HackJoues What kind of adapter you are using?? A list adapter or RecyclerView adapter?? and what you trying to acheive, can you explain?? So that I can help you imlpement the smiley rating according to your use case.

TuxRneR commented 7 years ago

public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position) Is a RecyclerView, Im declared the SmileyRating Like that:

SmileRating smileRating = (SmileRating) findViewById(R.id.smile_rating);

What is teh min SDK to implement this?

TuxRneR commented 7 years ago

Im Trying to set the labels for each smile, and the function. but is this the log of error: AndroidRuntime: FATAL EXCEPTION: main java.lang.NullPointerException at demo.dev.lat.mov.a.b$13.onClick(Unknown Source) at android.view.View.performClick(View.java:4084) at android.view.View$PerformClick.run(View.java:16966) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4745) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method)

I need Implement this in a Dialog in RecylcerView: final Dialog dialog = new Dialog(mAct); dialog.setContentView(R.layout.dialog_rating); dialog.setTitle("Rating this item:"); dialog.setCancelable(true); //there are a lot of settings, for dialog, check them all out! SmileRating smileRating = (SmileRating) mAct.findViewById(R.id.smile_rating); //now that the dialog is set up, it's time to show it dialog.show();

TuxRneR commented 7 years ago

Work Fine! I miss the implements method x3 . Sorry! Only one doubt, i can edit the label of each smile?

sujithkanna commented 7 years ago

Currently no options to edit, I will update the apis to edit titles and will let you know :)

sujithkanna commented 7 years ago

The dynamic naming API had been implemented in this commit a5ecd069f8b3b1309de40c73dc950838e1ef4a91 Please check the updated README.md file for changes and descriptions. Update the version number you using.

TuxRneR commented 7 years ago

Thanks for the update, only question in this issue. When the SmileRating bar is created, by default the Smile okay is selected, Suppose the user wants to select that smile, but since it is already selected does not record the event that gets the value of the selection. They could corroborate this. Thank you

sujithkanna commented 7 years ago

Thank you for your suggestion, I will make the event to be fired even if it is already selected. Thanks for using my rating bar :)

TuxRneR commented 7 years ago

Of anything, I hope it is the update soon, it is a bar that I will use in my app. I loved it.

sujithkanna commented 7 years ago

I have updated the APIs and its documents also, What you needed is in this https://github.com/sujithkanna/SmileyRating#set-this-smileyselectionlistener-to-get-notified-when-user-selects-a-smiley and Thank you very much. I hope you use it in your applications. Watch to get more updates with more UI changes :)

TuxRneR commented 7 years ago

Thanks, its a very work! i hope you can make a download manager files of http, like the browsers for Android. Thanks!

ghost commented 7 years ago

I follow the 3 steps in the usage part and I see the smilies in the designer preview. I did the following in an adapter: RatingViewHolder(View itemView) { super(itemView); srRating = (SmileRating) itemView.findViewById(R.id.smile_rating); srRating.setIndicator(true); //<< srRating is not null and this line works }

@Override public void onBindViewHolder(final RatingViewHolder holder, int position) { Rating theRating = RatingList.get(position); holder.srRating.setSelectedSmile(5,true); << fails* }

Please advice, it seems that this is working for everyone so I wonder if I miss something