{"id":27291038,"url":"https://github.com/sujithkanna/smileyrating","last_synced_at":"2025-05-15T20:03:00.755Z","repository":{"id":45359182,"uuid":"80049669","full_name":"sujithkanna/SmileyRating","owner":"sujithkanna","description":"SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.","archived":false,"fork":false,"pushed_at":"2021-01-04T08:26:52.000Z","size":2580,"stargazers_count":1089,"open_issues_count":22,"forks_count":186,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-05-12T15:55:40.810Z","etag":null,"topics":["android","canvas","morphing-animations","rating","smiley","vector-graphics"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sujithkanna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-25T19:31:17.000Z","updated_at":"2025-04-20T16:55:51.000Z","dependencies_parsed_at":"2022-07-13T21:34:30.763Z","dependency_job_id":null,"html_url":"https://github.com/sujithkanna/SmileyRating","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujithkanna%2FSmileyRating","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujithkanna%2FSmileyRating/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujithkanna%2FSmileyRating/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sujithkanna%2FSmileyRating/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sujithkanna","download_url":"https://codeload.github.com/sujithkanna/SmileyRating/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254414493,"owners_count":22067271,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","canvas","morphing-animations","rating","smiley","vector-graphics"],"created_at":"2025-04-11T21:55:55.066Z","updated_at":"2025-05-15T20:02:59.240Z","avatar_url":"https://github.com/sujithkanna.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Smiley Rating\nSmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.\n  - Drawn completely using android canvas\n  - Inspired by [Bill Labus](https://dribbble.com/shots/2790473-Feedback)\n\n## Demo\n\n \u003cimg src=\"https://raw.githubusercontent.com/sujithkanna/SmileyRating/master/app/src/main/assets/demo.gif\" alt=\"\" data-canonical-src=\"https://gyazo.com/eb5c5741b6a9a16c692170a41a49c858.png\" width=\"575\" height=\"205\" /\u003e\n\n## Integration\nIntegrating SmileyRating in your project is very simple.\n### Step 1:\nAdd this dependency in your project's build.gradle file which is in your app folder\n```groovy\ncompile 'com.github.sujithkanna:smileyrating:2.0.0'\n```\nadd this to your dependencies.\n## Step 2:\nNow place the SmileyRating in your layout.\n###### *Note: The height of the SmileyRating will be automatically adjusted according to the width of this component.*\n```xml\n\u003ccom.hsalf.smileyrating.SmileyRating\n        android:id=\"@+id/smile_rating\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\" /\u003e\n```\n### Set this SmileySelectedListener to get notified when user selects a smiley\n*By default the selected smiley will be NONE*\n```java\nsmileyRating.setSmileySelectedListener(new SmileyRating.OnSmileySelectedListener() {\n            @Override\n            public void onSmileySelected(SmileyRating.Type type) {\n                // You can compare it with rating Type\n                if (SmileyRating.Type.GREAT == type) {\n                    Log.i(TAG, \"Wow, the user gave high rating\");\n                }\n                // You can get the user rating too\n                // rating will between 1 to 5\n                int rating = type.getRating();\n            }\n        });\n ```\n\n### Get current selection\n```java\nSmileyRating.Type smiley = smileyRating.getSelectedSmiley();\n// You can compare it with rating Type\nif (SmileyRating.Type.GREAT == type) {\n    Log.i(TAG, \"Great rating is given\");\n}\n // You can get the user rating too\n // rating will between 1 to 5, but -1 is none selected\n int rating = type.getRating();\n ```\n\n### You can set selected smiley without user interaction\n#### Without animation\n```java\nsmileRating.setRating(SmileyRating.Type.GREAT);\n// Or you can give rating as number\n// Valid inputs are 1 to 5.\n// Giving -1 will reset the rating. Equivalent to Type.NONE\nsmileRating.setRating(5);\n```\n#### OR\n```java\nsmileRating.setRating(SmileyRating.Type.GREAT, false);\nsmileRating.setRating(5, false);\n```\n*The smiley will be selected with animation and the listeners will be triggered*\n#### With animation\n```java\nsmileRating.setRating(SmileyRating.Type.GREAT, true);\nsmileRating.setRating(5, true);\n```\nSmiley will be selected with animation and listeners will also be triggered(Only if the second param is true)\n\n#### Disallow selection\n```java\nsmileRating.disallowSelection(true);\n```\n\nYou can disallow user input by passing true to this. You can set the smiley only using [this](https://github.com/sujithkanna/SmileyRating/tree/develop#you-can-set-selected-smiley-without-user-interaction). This is useful when you just want to show the rating.\n\n#### Styling\n```java\nsmileRating.setTitle(SmileyRating.Type.GREAT, \"Awesome\");\nsmileRating.setFaceColor(SmileyRating.Type.GREAT, Color.BLUE);\nsmileRating.setFaceBackgroundColor(SmileyRating.Type.GREAT, Color.RED);\n```\n\nThese are the helper methods to change the color and title of the Smiley.\n**_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```.\n##### (Currently setting these things in xml will make things complex. So any pull request for this will not be accepted)\n\n#### Working with RecyclerView\nTo avoid conflict with RecyclerView touch events, you have to add the following implementation when putting the SmileyRating in RecyclerView.\nFor that you have to create an instance of SmileyActivityIndicator as global variable inside your Activity where you use your RecyclerView.\n\n```java\nfinal SmileyActiveIndicator smileyActiveIndicator = new SmileyActiveIndicator();\n```\n\nNow you have to link the ```SmileyActiveIndicator``` to the RecyclerView. This will tell the RecyclerView whether it can scroll or not.\n\n```java\nrecyclerView.setLayoutManager(new LinearLayoutManager(this) {\n    @Override\n    public boolean canScrollVertically() {\n        return !smileyActiveIndicator.isActive();\n    }\n});\n```\nNow bind your SmileyRating view to the ```mSmileyActiveIndicator``` you have created.\n\n```java\n@Override\npublic void onBindViewHolder(@NonNull Holder holder, final int position) {\n    SmileyRating rating = holder.smileyRating;\n    mSmileyActiveIndicator.bind(rating);\n    // your code here\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujithkanna%2Fsmileyrating","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsujithkanna%2Fsmileyrating","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsujithkanna%2Fsmileyrating/lists"}