A rating toggle for Android which switches between 3 rating levels: positive, neutral, and negative.

Overview

Android Arsenal

SimpleRatingView

A rating toggle for Android which switches between 3 rating levels: positive, neutral, and negative.

simpleratingview

Usage

Since, SimpleRatingView is pushed to the Maven Central repository, all you have to do is to add the following line to your dependencies.

dependencies {
    compile 'com.github.xiprox.simpleratingview:library:+'
}

Once you have the library added as a dependency to your project, you can start with including the view in your layout:

<tr.xip.widget.simpleratingview.SimpleRatingView xmlns:srv="http://schemas.android.com/apk/res-auto"
    android:id="@+id/simple_rating_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

You can also customize SimpleRatingView by telling it to display the icons you want, in the color you want. The following xml attributes will allow you to set the icons for different rating levels.

    srv:srv_positiveIcon="@drawable/rating_positive"
    srv:srv_neutralIcon="@drawable/rating_neutral"
    srv:srv_negativeIcon="@drawable/rating_negative"

As for a custom color, you'll need to insert the following attribute:

    srv:srv_iconColor="@color/my_rating_icon_color"

On the Java side, all you have to do is catching rating changes from the view:

mSimpleRatingView = (SimpleRatingView) findViewById(R.id.simple_rating_view);
mSimpleRatingView.setOnRatingChangedListener(new SimpleRatingView.OnRatingChangeListener() {
    @Override
    public void onRatingChanged(SimpleRatingView.Rating ratingType) {
        switch (ratingType) {
            case POSITIVE:
                // Do something
                break;
            case NEUTRAL:
                // Do something
                break;
            case NEGATIVE:
                // Do something
                break;
        }
    }
});

Of course, you can directly set the rating too.

setSelectedRating(Rating rating)

And lastly, all customization can be applied programmatically too:

setIconColor(int color)
setIconColor(Resources res, int color) // Set the icon color to a color resource
setPositiveIconResource(int res)
setPositiveIconDrawable(Drawable drawable)
setNeutralIconResource(int res)
setNeutralIconDrawable(Drawable drawable)
setNegativeIconResource(int res)
setNegativeIconDrawable(Drawable drawable)

Sample App

Get it on Google Play

License

Copyright (C) 2014 Ihsan Isik

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
Nab-challenge - Take home challenge from NAB in partnership with Positive Thinking Company

nab-challenge Take home challenge from NAB in partnership with Positive Thinking

Lynx is an Android library created to show a custom view with all the information Android logcat is printing, different traces of different levels will be rendererd to show from log messages to your application exceptions. You can filter this traces, share your logcat to other apps, configure the max number of traces to show or the sampling rate used by the library.
A backport of the Android 4.2 GlowPadView that works on the SDK on API levels 4+

GlowPadBackport A backport of the Android 4.2 GlowPadView that works on the SDK on API levels 4+. It is heavily based upon Google's own internal imple

Geography quiz application with three levels of test

Geography quiz application with three levels of test GeoQuiz has been created to challenge yourself by your knowledge of geography. When the user inst

Easy creation and management of toggle buttons on Android from the Material Design spec.
Easy creation and management of toggle buttons on Android from the Material Design spec.

ToggleButtonLayout Easy creation and management of toggle buttons from the Material Design spec. Read more about ToggleButtonLayout in our blog post.

Feature toggle library for Android
Feature toggle library for Android

FeatureToggle Feature toggle library for Android. Overview FeatureToggle library allows to configure features of Android application in runtime using

Animated dark mode toggle button with Android & Pure Java. ☕

Dark-Toggle-Button Animated dark mode toggle button for Android Java. ☕ converted from kotlin to Java 201 lines: DarkToggleButton.java Android Demo In

ToggleIconView is a collection library of animated two-stage toggle icons for Android.
ToggleIconView is a collection library of animated two-stage toggle icons for Android.

ToggleIconView ToggleIconView is a collection library of animated two-stage toggle icons for Android. Installation JitPack repository // Project level

❤️ A heart-shaped toggle switch component built using Jetpack Compose
❤️ A heart-shaped toggle switch component built using Jetpack Compose

heart-switch A heart-shaped toggle switch component built using Jetpack Compose. Inspired by Tore Bernhoft's I heart toggle Dribbble shot and Anatoliy

This is an Online Book App in which user can read and add their books on favourites fragment and also give rating on it.
This is an Online Book App in which user can read and add their books on favourites fragment and also give rating on it.

BookHub-AndroidApp BookHub Basic Android App Based on the concept of Fragment, Navigation Drawer, Database (Room), Internet Access, etc. See the app o

A custom view for rating which easy to make and use, but function is excellent
A custom view for rating which easy to make and use, but function is excellent

QRatingView A custom view for rating which easy to make and use, but function is excellent Effect Picture Properties declare-styleable name="QRat

RatingRequest library is a simple android dialog for request rating and review.
RatingRequest library is a simple android dialog for request rating and review.

Rating Request RatingRequest library is a simple android dialog for request rating and review. ##Usage Add below line in app build.gradle dependencies

 A simple Emoji Rating Bar library for Android completely written in Kotlin.
A simple Emoji Rating Bar library for Android completely written in Kotlin.

EmojiRatingBar A simple Emoji Rating Bar library for Android completely written in Kotlin. 🛠 Installation Add the JitPack repository to your build.gr

A rating scale android library
A rating scale android library

RatingScale A rating scale android library A customizable rating scale supporting a 1-10 scale. Usage In your layout.xml ?xml version="1.0" encod

Simple star rating system bars, a view similar to the ones seen on Google Playstore. ⭐🌟✨
Simple star rating system bars, a view similar to the ones seen on Google Playstore. ⭐🌟✨

RatingReviews RatingReviews (Rating and Reviews) is a widget and layout that adds a "Rating & Reviews" bar to your app, similar to the ones seen on Go

This library allows to use customized Rating Dialog inside applications.
This library allows to use customized Rating Dialog inside applications.

Android Material App Rating This library allows to use customized Rating Dialog inside applications. Download compile 'com.stepstone.apprating:app-rat

Compose-Ratingbar-library - A simple implementation for rating bar in Jetpack Compose

Compose-Ratingbar-library - A simple implementation for rating bar in Jetpack Compose

This is a simple application through which I connected Students, Courses and Teachers in an a beautiful way. The main purpose of this project is the connection between the Objects.
This is a simple application through which I connected Students, Courses and Teachers in an a beautiful way. The main purpose of this project is the connection between the Objects.

UniversityApp This is a simple application through which I connected Students, Courses and Teachers in an a beautiful way. The main purpose of this pr

FragmentTransactionExtended is a library which provide us a set of custom animations between fragments.

FragmentTransactionExtended FragmentTransactionExtended is a library which provide us a set of custom animations between fragments. FragmentTransactio

Comments
  • Rating view is throwing error on gradle build

    Rating view is throwing error on gradle build

    Error:A problem occurred configuring project ':app'.

    Could not resolve all dependencies for configuration ':app:_debugCompile'. Could not resolve com.github.xiprox.simpleratingview:library:+. Required by: FoodieClient:app:unspecified > Failed to list versions for com.github.xiprox.simpleratingview:library. > Unable to load Maven meta-data from https://jcenter.bintray.com/com/github/xiprox/simpleratingview/library/maven-metadata.xml. > Could not GET 'https://jcenter.bintray.com/com/github/xiprox/simpleratingview/library/maven-metadata.xml'. > peer not authenticated > Failed to list versions for com.github.xiprox.simpleratingview:library. > Unable to load Maven meta-data from https://jitpack.io/com/github/xiprox/simpleratingview/library/maven-metadata.xml. > Could not GET 'https://jitpack.io/com/github/xiprox/simpleratingview/library/maven-metadata.xml'. > peer not authenticated

    opened by lokeshsuhas 4
  • [r] Code refactoring

    [r] Code refactoring

    • Reduce the multiple calls of notifyIconChanged().
    • Write setIconDrawable(..) which is called inside set...IconDrawable(...) methods.
    • Call set...IconDrawable(...) from inside set...IconResource(...) to reduce the amount of assignments.
    opened by duchuyctlk 1
  • setIconColor is not working

    setIconColor is not working

    I am trying to change the icon color to blue if the status is neutral but it stuck at the default color, What have I done wrong? This is my code:

    ratingBookStars.setOnRatingChangedListener(new SimpleRatingView.OnRatingChangeListener() { @Override public void onRatingChanged(SimpleRatingView.Rating ratingType) { switch (ratingType) { case POSITIVE: stars = 3; break; case NEUTRAL: stars = 2; ratingBookStars.setIconColor(Color.BLUE); break; case NEGATIVE: stars = 1; break; } } });

    Thanks, Haim.

    bug 
    opened by chaimleu 1
Releases(v1.1.0)
Owner
İhsan Işık
Mobile Developer
İhsan Işık
A simple Emoji Rating Bar library for Android completely written in Kotlin.

EmojiRatingBar A simple Emoji Rating Bar library for Android completely written in Kotlin. ?? Installation Add the JitPack repository to your build.gr

Unaisul Hadi 41 Aug 26, 2022
A rating scale android library

RatingScale A rating scale android library A customizable rating scale supporting a 1-10 scale. Usage In your layout.xml <?xml version="1.0" encod

Tilak Sharma 3 Mar 26, 2022
This library allows to use customized Rating Dialog inside applications.

Android Material App Rating This library allows to use customized Rating Dialog inside applications. Download compile 'com.stepstone.apprating:app-rat

StepStone Tech 476 Nov 11, 2022
A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.

A RatingBar library for android, you can customize size, spacing, color and image easily, and support right to left.

dqq 300 Aug 29, 2021
AndroidRate is a library to help you promote your Android app by prompting users to rate the app after using it for a few days.

AndroidRate AndroidRate is a library to help you promote your Android app by prompting users to rate the app after using it for a few days. Project ba

 Vorlonsoft LLC 129 Nov 24, 2022
Flexible switch is a responsive switch with some nice features which developers can use for making awesome switches on android platform.

flexible-switch It is a responsive switch in android, it can resize itself according to its size. It's recommended to use it with ConstraintLayout to

Coders Route 5 Dec 20, 2022
SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon.

Smiley Rating SmileyRating is a simple rating bar for android. It displays animated smileys as rating icon. Drawn completely using android canvas Insp

Sujith Niraikulathan 1.1k Dec 22, 2022
Loop Habit Tracker, a mobile app for creating and maintaining long-term positive habits

Loop is a mobile app that helps you create and maintain good habits, allowing you to achieve your long-term goals. Detailed graphs and statistics show you how your habits improved over time.

Alinson S. Xavier 5.8k Jan 7, 2023
Android Library for Custom Switches.

Android Library for Custom Switches.

Angad Singh 376 Jan 4, 2023
Quiz-Application - A quiz application which uses opentdb api to get quiz of different levels like Easy Hard and Medium

Quiz-Application A quiz application which uses opentdb api to get quiz of differ

Pranat Praveer 2 Jan 25, 2022