All Projects → sujithkanna → Smileyrating

sujithkanna / Smileyrating

Licence: apache-2.0
SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Smileyrating

Pixelfarm
From Vectors to (sub) Pixels, C# 2D Rendering Library
Stars: ✭ 120 (-88.44%)
Mutual labels:  vector-graphics, canvas
Picasso
Picasso is a high quality 2D vector graphic rendering library. It support path , matrix , gradient , pattern , image and truetype font.
Stars: ✭ 205 (-80.25%)
Mutual labels:  vector-graphics, canvas
Zrender
A lightweight graphic library providing 2d draw for Apache ECharts
Stars: ✭ 5,122 (+393.45%)
Mutual labels:  vector-graphics, canvas
Luckysheet
Luckysheet is an online spreadsheet like excel that is powerful, simple to configure, and completely open source.
Stars: ✭ 9,772 (+841.43%)
Mutual labels:  canvas
Blog
在这里写一些工作中遇到的前端,后端以及运维的问题
Stars: ✭ 974 (-6.17%)
Mutual labels:  canvas
Chaos In Javascript
I was always intrigued to see how math is so beautiful. Thanks to JavaScript for giving me the power to program my curiosity and explore the beauty of chaos in math.
Stars: ✭ 38 (-96.34%)
Mutual labels:  canvas
Drawing Board
在线画板,基于 Canvas 和 JavaScript 的画图工具。
Stars: ✭ 44 (-95.76%)
Mutual labels:  canvas
Canvas Img Process
html5 canvas image process ( 3*3 kernel ) canvas卷积核测试 canvas图片后期
Stars: ✭ 31 (-97.01%)
Mutual labels:  canvas
Ng Bootstrap
Angular powered Bootstrap
Stars: ✭ 7,872 (+658.38%)
Mutual labels:  rating
Emotion Ratings
😠 😞 😑 😊 😍 This plugin allows you to create ratings using emojis
Stars: ✭ 37 (-96.44%)
Mutual labels:  rating
Bootstrap Star Rating
A simple yet powerful JQuery star rating plugin with fractional rating support.
Stars: ✭ 985 (-5.11%)
Mutual labels:  rating
Canvas
Canvas Drawing Android Library
Stars: ✭ 35 (-96.63%)
Mutual labels:  canvas
Poster
A beautiful canvas poster
Stars: ✭ 40 (-96.15%)
Mutual labels:  canvas
Ec Devtools
ec-devtools是支持canvas库 ( easycanvas , https://github.com/chenzhuo1992/easycanvas ) 的chrome调试工具,能对canvas的元素的样式、物理属性等进行修改,达到所见即所得的效果,提高调试效率
Stars: ✭ 35 (-96.63%)
Mutual labels:  canvas
Color.js
Extract colors from an image (0.75 KB) 🎨
Stars: ✭ 42 (-95.95%)
Mutual labels:  canvas
Ngvas
An Angular2/Angular4 library for HTML Canvas.
Stars: ✭ 31 (-97.01%)
Mutual labels:  canvas
Cnblogs
💘🍦🙈 残梦a博客园样式,本博客的样式一直在更新中,还会不断优化页面的加载速度,坚持每周都会更新自己的博客内容,坚持自己选择计算机的道路 -> https://www.cnblogs.com/sunhang32
Stars: ✭ 41 (-96.05%)
Mutual labels:  canvas
Sharpmath
A small .NET math library.
Stars: ✭ 36 (-96.53%)
Mutual labels:  canvas
Wxdraw
几何画图(微信小程序)
Stars: ✭ 36 (-96.53%)
Mutual labels:  canvas
Movie
Personalized real-time movie recommendation system
Stars: ✭ 37 (-96.44%)
Mutual labels:  rating

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
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].