{"id":13942136,"url":"https://github.com/saran2020/DragRating","last_synced_at":"2025-07-20T05:32:12.354Z","repository":{"id":131345881,"uuid":"183735487","full_name":"saran2020/DragRating","owner":"saran2020","description":"Easy to use Drag Rating with customisation with custom assets","archived":false,"fork":false,"pushed_at":"2019-07-13T04:45:42.000Z","size":561,"stargazers_count":23,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-27T11:38:53.997Z","etag":null,"topics":["dragging","material-design","rating-component","rating-stars","ratingbar","stars"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/saran2020.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-04-27T06:10:03.000Z","updated_at":"2024-07-20T11:15:17.000Z","dependencies_parsed_at":"2023-07-31T12:31:49.706Z","dependency_job_id":null,"html_url":"https://github.com/saran2020/DragRating","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/saran2020/DragRating","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saran2020%2FDragRating","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saran2020%2FDragRating/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saran2020%2FDragRating/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saran2020%2FDragRating/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/saran2020","download_url":"https://codeload.github.com/saran2020/DragRating/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/saran2020%2FDragRating/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266071519,"owners_count":23871940,"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":["dragging","material-design","rating-component","rating-stars","ratingbar","stars"],"created_at":"2024-08-08T02:01:43.044Z","updated_at":"2025-07-20T05:32:07.340Z","avatar_url":"https://github.com/saran2020.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# Drag Rating\n\nDrag rating is a rating view inspired of Drag Review from Book My Show app. The purpose of this library is to create simple and easy to use Drag Rating Widget with support for custom assets.\n\n![](assets/demo.gif)\n\nInclude this library by adding below line to the module level `build.gradle`\n```Gradle\ndependencies {\n    implementation 'com.github.saran2020:DragRating:2.1.0'\n}\n```\n\n**layout.xml**\n```xml\n\u003ccom.github.saran2020.dragrating.DragRatingView\n    android:id=\"@+id/slide_rating\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    app:initial_rating=\"2.5\"\n    app:rating_space=\"8dp\"\n    app:max_rating=\"5\" /\u003e\n```\n`initial_rating` - It's used to set the initial rating to the widget.  \n`max_rating` - It's used to set the maximum allowed rating. The number you provide here is the number of stars that will be drawn.  \n`rating_space` - It can be used to control the space between two star views.\n\nCurrent rating can be read using `getRating()` and to set the rating use method `setRating(3.5f)`.\n\n\nTo provide custom asset for the view, you need to set a `Map` with the multiplier for the asset and the asset like shown below.\n\nPassing custom asset resource id\n```kotlin\nratingView.setDrawableResourceAssetMap(\n    mapOf(\n        0f to R.drawable.ic_star_empty,\n        0.5f to R.drawable.ic_star_half,\n        1f to R.drawable.ic_star_full\n    )\n)\n```\n\nPassing asset as `Drawable` in kotlin\n```kotlin\nratingView.setDrawableAssetMap(\n    mapOf(\n        0f to emptyRating,\n        0.5f to halfRating,\n        1f to fullRating\n    )\n)\n```\n**NOTE: You should only provide the multiplier between 0 and 1. If the current rating is 1.5 it will automatically fill one star with the asset mapped to `1f` and one star with asset mapped to `0.5f`**\n\nCallback when user is dragging the `DragRatingView`\n```kotlin\nratingView.callback = object : DragRatingView.RatingChangeCallback {\n    override fun onRatingChange(previous: Float, new: Float) {\n        Log.d(TAG, \"previous rating = $previous new rating = $current\")\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaran2020%2FDragRating","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsaran2020%2FDragRating","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsaran2020%2FDragRating/lists"}