Smileyrating

SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.
Alternatives To Smileyrating
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Titanic2,425
6 years ago3March 22, 201710JavaScript
A set of animated icons + code to insert them into the webpages
Animocons1,448
7 years ago3JavaScript
Animated icons powered by the motion graphics library mo.js by Oleg Solomka. Inspiration comes from the Dribbble shot ["Like Animation"](https://dribbble.com/shots/2527200-Like-Animation) by Daryl Ginn.
Material Animated Switch1,136
3 years ago25Java
A material Switch with icon animations and color transitions
Smileyrating1,003
3 years ago1June 18, 20197apache-2.0Java
SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.
Bottom_navy_bar8772625 months ago20March 28, 202131apache-2.0Dart
A beautiful and animated bottom navigation
React Useanimations868963 months ago55December 22, 202120otherTypeScript
React-useanimations is a collection of free animated open source icons for React.js.
Androidiconanimator817
3 years ago63apache-2.0JavaScript
Android vector icon animation tool
Swirl763
292 years ago5July 29, 20204apache-2.0Java
Android's animated fingerprint icon provided in a simple, standalone library.
Hamburger React72814 months ago20April 05, 20223mitTypeScript
Animated hamburger menu icons for React (1.5 KB) 🍔
Sksplashview476
133 years ago4July 02, 20164mitObjective-C
Create custom animated splash views similar to the ones in the Twitter, Uber and Ping iOS app.
Alternatives To Smileyrating
Select To Compare


Alternative Project Comparisons
Readme

Smiley Rating

SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.

  • Drawn completely using android canvas
  • Inspired by Bill Labus

Demo

Integration

Integrating SmileyRating in your project is very simple.

Step 1:

Add this dependency in your project's build.gradle file which is in your app folder

compile 'com.github.sujithkanna:smileyrating:2.0.0'

add this to your dependencies.

Step 2:

Now place the SmileyRating in your layout.

Note: The height of the SmileyRating will be automatically adjusted according to the width of this component.
<com.hsalf.smileyrating.SmileyRating
        android:id="@+id/smile_rating"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

Set this SmileySelectedListener to get notified when user selects a smiley

By default the selected smiley will be NONE

smileyRating.setSmileySelectedListener(new SmileyRating.OnSmileySelectedListener() {
            @Override
            public void onSmileySelected(SmileyRating.Type type) {
                // You can compare it with rating Type
                if (SmileyRating.Type.GREAT == type) {
                    Log.i(TAG, "Wow, the user gave high rating");
                }
                // You can get the user rating too
                // rating will between 1 to 5
                int rating = type.getRating();
            }
        });

Get current selection

SmileyRating.Type smiley = smileyRating.getSelectedSmiley();
// You can compare it with rating Type
if (SmileyRating.Type.GREAT == type) {
    Log.i(TAG, "Great rating is given");
}
 // You can get the user rating too
 // rating will between 1 to 5, but -1 is none selected
 int rating = type.getRating();

You can set selected smiley without user interaction

Without animation

smileRating.setRating(SmileyRating.Type.GREAT);
// Or you can give rating as number
// Valid inputs are 1 to 5.
// Giving -1 will reset the rating. Equivalent to Type.NONE
smileRating.setRating(5);

OR

smileRating.setRating(SmileyRating.Type.GREAT, false);
smileRating.setRating(5, false);

The smiley will be selected with animation and the listeners will be triggered

With animation

smileRating.setRating(SmileyRating.Type.GREAT, true);
smileRating.setRating(5, true);

Smiley will be selected with animation and listeners will also be triggered(Only if the second param is true)

Disallow selection

smileRating.disallowSelection(true);

You can disallow user input by passing true to this. You can set the smiley only using this. This is useful when you just want to show the rating.

Styling

smileRating.setTitle(SmileyRating.Type.GREAT, "Awesome");
smileRating.setFaceColor(SmileyRating.Type.GREAT, Color.BLUE);
smileRating.setFaceBackgroundColor(SmileyRating.Type.GREAT, Color.RED);

These are the helper methods to change the color and title of the Smiley. NOTE: The color values must be int colors Color.RED or Color.parse("#fff") or ResourcesCompat.getColor(getResources(), R.color.your_color, null);, not int resources like R.color.primaryColor.

(Currently setting these things in xml will make things complex. So any pull request for this will not be accepted)

Working with RecyclerView

To avoid conflict with RecyclerView touch events, you have to add the following implementation when putting the SmileyRating in RecyclerView. For that you have to create an instance of SmileyActivityIndicator as global variable inside your Activity where you use your RecyclerView.

final SmileyActiveIndicator smileyActiveIndicator = new SmileyActiveIndicator();

Now you have to link the SmileyActiveIndicator to the RecyclerView. This will tell the RecyclerView whether it can scroll or not.

recyclerView.setLayoutManager(new LinearLayoutManager(this) {
    @Override
    public boolean canScrollVertically() {
        return !smileyActiveIndicator.isActive();
    }
});

Now bind your SmileyRating view to the mSmileyActiveIndicator you have created.

@Override
public void onBindViewHolder(@NonNull Holder holder, final int position) {
    SmileyRating rating = holder.smileyRating;
    mSmileyActiveIndicator.bind(rating);
    // your code here
}
Popular Icon Projects
Popular Animated Projects
Popular User Interface Components Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Java
Animation
Icon
Rating
Canvas
Animated
Vector Graphics