{"id":13644199,"url":"https://github.com/xiprox/SimpleRatingView","last_synced_at":"2025-04-21T07:30:27.702Z","repository":{"id":23753034,"uuid":"27127245","full_name":"xiprox/SimpleRatingView","owner":"xiprox","description":"A rating toggle for Android which switches between 3 rating levels: positive, neutral, and negative.","archived":false,"fork":false,"pushed_at":"2017-03-23T13:43:42.000Z","size":196,"stargazers_count":163,"open_issues_count":0,"forks_count":27,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-11-09T16:44:00.981Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"niqdev/packtpub-crawler","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xiprox.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-25T13:34:23.000Z","updated_at":"2024-05-29T18:30:22.000Z","dependencies_parsed_at":"2022-08-21T22:40:11.708Z","dependency_job_id":null,"html_url":"https://github.com/xiprox/SimpleRatingView","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FSimpleRatingView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FSimpleRatingView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FSimpleRatingView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xiprox%2FSimpleRatingView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xiprox","download_url":"https://codeload.github.com/xiprox/SimpleRatingView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250014526,"owners_count":21360967,"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":[],"created_at":"2024-08-02T01:01:59.007Z","updated_at":"2025-04-21T07:30:27.137Z","avatar_url":"https://github.com/xiprox.png","language":"Java","readme":"[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-SimpleRatingView-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/1189)\n\nSimpleRatingView\n================\n\nA rating toggle for Android which switches between 3 rating levels: positive, neutral, and negative.\n\n![simpleratingview](https://cloud.githubusercontent.com/assets/2550945/5184090/c143e70e-74b4-11e4-8bfa-a7ec17416d05.gif)\n\n# Usage\nSince, SimpleRatingView is pushed to the Maven Central repository, all you have to do is to add the following line to your dependencies.\n\n```\ndependencies {\n    compile 'com.github.xiprox.simpleratingview:library:+'\n}\n```\n\nOnce you have the library added as a dependency to your project, you can start with including the view in your layout:\n```xml\n\u003ctr.xip.widget.simpleratingview.SimpleRatingView xmlns:srv=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/simple_rating_view\"\n    android:layout_width=\"wrap_content\"\n    android:layout_height=\"wrap_content\" /\u003e\n```\nYou 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.\n```\n    srv:srv_positiveIcon=\"@drawable/rating_positive\"\n    srv:srv_neutralIcon=\"@drawable/rating_neutral\"\n    srv:srv_negativeIcon=\"@drawable/rating_negative\"\n```\nAs for a custom color, you'll need to insert the following attribute:\n```\n    srv:srv_iconColor=\"@color/my_rating_icon_color\"\n```\n\nOn the Java side, all you have to do is catching rating changes from the view:\n```java\nmSimpleRatingView = (SimpleRatingView) findViewById(R.id.simple_rating_view);\nmSimpleRatingView.setOnRatingChangedListener(new SimpleRatingView.OnRatingChangeListener() {\n    @Override\n    public void onRatingChanged(SimpleRatingView.Rating ratingType) {\n        switch (ratingType) {\n            case POSITIVE:\n                // Do something\n                break;\n            case NEUTRAL:\n                // Do something\n                break;\n            case NEGATIVE:\n                // Do something\n                break;\n        }\n    }\n});\n```\nOf course, you can directly set the rating too.\n```java\nsetSelectedRating(Rating rating)\n```\n\nAnd lastly, all customization can be applied programmatically too:\n```java\nsetIconColor(int color)\nsetIconColor(Resources res, int color) // Set the icon color to a color resource\nsetPositiveIconResource(int res)\nsetPositiveIconDrawable(Drawable drawable)\nsetNeutralIconResource(int res)\nsetNeutralIconDrawable(Drawable drawable)\nsetNegativeIconResource(int res)\nsetNegativeIconDrawable(Drawable drawable)\n```\n\n# Sample App\n\u003ca href=\"https://play.google.com/store/apps/details?id=tr.xip.widget.simpleratingview.sample\"\u003e\n  \u003cimg alt=\"Get it on Google Play\"\n       src=\"https://developer.android.com/images/brand/en_generic_rgb_wo_45.png\" /\u003e\n\u003c/a\u003e\n\n# License\n```\nCopyright (C) 2014 Ihsan Isik\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","funding_links":[],"categories":["RatingView","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiprox%2FSimpleRatingView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxiprox%2FSimpleRatingView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxiprox%2FSimpleRatingView/lists"}