Git Product home page Git Product logo

ratingbar's Introduction

RatingBar Slack Status

A lightweight RatingBar widget that makes it easier to customize the look of the children ratings views, compared to the default RatingBar.

NOTE: This currently only allows use of stock RatingBar functions but not underlying AbsSeekBar functions.

NOTE2: Min SDK allowed is SDK 14. This restriction is defined by the Androidx AppCompat library.

Usage

Gradle:

maven { url "https://www.jitpack.io" }

Add to dependencies

compile 'com.github.fuzz-productions:RatingBar:1.0.6'
  • Include the selected state drawable icn_rating_start_green in your project.

  • Include the unselected state drawable icn_rating_start_grey in your project.

  • Include in layout:

<com.fuzzproductions.ratingbar.RatingBar
    android:id="@+id/rating_bar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    app:minAllowedStars="1"
    app:numStars="7"
    app:starSize="20dp"
    app:rating="3"
    app:starMargin="10dp"
    app:isIndicator="false"
    app:emptyDrawable="@drawable/icn_rating_star_green"
    app:filledDrawable="@drawable/icn_rating_star_grey"
    />

Customizations

Set the height and width of the stars with setStarSizeInDp(int dp). Omitting this method call will result in the use of default 30dp value.

Change the number of stars to choose from with setMax(int count) corresponds to .

Change the minimum stars allowed to be selected setMinimumSelectionAllowed(int minCount)

ratingbar's People

Contributors

aherbel avatar akperkins avatar cliabhach avatar kfuchs avatar kirillmakarov avatar raigex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ratingbar's Issues

[Feature] Draw Stars Directly To Canvas

Current implementation uses individual ImageView to draw the stars. A more efficient approach would be to draw them using the canvas directly. This would also be beneficial on lists and places where we may use multiple of these.

And to draw an custom drawables to canvas directly too, if you dont want to draw stars.

README should show off use of drawable attributes

This concerns the line Include the selected state drawable icn_rating_start_green in your project.

I think it would make sense here to instead show the use of this drawable in the sample xml, something like the following:

app:emptyDrawable="@drawable/icn_rating_star_green"
app:filledDrawable="@drawable/icn_rating_star_grey"

Throw IllegalArgumentException if invalid parameters are set

The following situations should not be supported in v1:

  • StarSize is not specified or equal to 0 and any of the following are true
    1. Empty drawable and filled drawable are different sizes
    2. Empty drawable and filled drawable are both size 0
    3. Empty drawable is not a square
    4. Filled drawable is not a square

N.B. arbitrary rectangles may be supported in a future release

StepSize precision issue

REMINDER TO SELF:

currently setting a rating bar with a stepsize of .1 returns a mod of .09999

TODO:
make step size mod a tolerance based one, so if mod is within 10 - 20% of stepSize just set mod to 0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.