diff --git a/README.md b/README.md index ecc7fac..87d4a90 100644 --- a/README.md +++ b/README.md @@ -12,10 +12,12 @@ Whatever you need to display some rating or pricing category - just use ProperRa android:textSize="22sp" android:textStyle="bold" app:prb_defaultRating="4" + app:prb_minRating="1" app:prb_symbolicTick="$" app:prb_symbolicTickNormalColor="@android:color/darker_gray" app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark" app:prb_totalTicks="5" + app:prb_tickAnimation="@anroid:anim/fade_in" /> ``` @@ -44,7 +46,7 @@ Library's minSdkVersion is set to 14. We use jitpack, so you can obtain made-up library right from our github sources in your module's `build.gradle` file: -`compile 'com.github.techery:properratingbar:{version_name}'` +`compile 'com.github.branpark:ProperRatingBar:0.0.6'` Also you need to add jitpack as repository in the same file: ```groovy @@ -59,7 +61,7 @@ So far we only support customising via xml layout. Here is the list of applicable attributes: + ``prb_totalTicks``: total number of ticks to show. Default is '5' + ``prb_defaultRating``: use this to set rating from xml. Default is '3' -+ ``prb_clickable``: if set to 'true' - use will be able to change rating by clicking. Default is 'false' ++ ``prb_minRating`` : use this to set minimum rating. Default is '0' + ``prb_symbolicTick``: symbol to be used as a tick. Default is '$' + ``android:textSize``: text size of symbolic tick. Default is '15sp' @@ -70,12 +72,11 @@ Here is the list of applicable attributes: + ``prb_tickNormalDrawable``: drawable resource to use as a tick that is not selected (not rated). No default value + ``prb_tickSelectedDrawable``: drawable resource to use as a tick that is selected (rated). No default value + ``prb_tickSpacing``: margin to be applied to tick drawables. Only applies to drawable-type ticks. Default is '1dp' (gray) ++ ``prb_tickAnimation``: Animation to be applied to the tick view. No default value. Also there's a number of methods to operate on ProperRatingBar programmatically: ```java -public boolean isClickable(); - /** * Nifty sugar method to just toggle clickable to opposite state. */ @@ -112,6 +113,39 @@ public int getRating(); * @param rating new rating value */ public void setRating(int rating); + +/** +* Set normal tick drawable +* @param tickDrawable normal tick drawable +*/ +public void setTickNormalDrawable(Drawable tickDrawable); + +/** +* Set selected tick drawable +* @param tickDrawable selected tick drawable +*/ +public void setTickSelectedDrawable(Drawable tickDrawable); + +/** +* Get normal tick drawable +* @retrun normal tick drawable +*/ +public Drawable getTickNormalDrawable(); + +/** +* Get selected tick drawable +* @retrun selected tick drawable +*/ +public Drawable setTickSelectedDrawable(); + +/** +* Animation resource id to be applied to the tick view. +* @param animResId animation resource id +*/ +public void setTickAnimationResId(int animResId); + +public int getTickAnimationResId(); + ``` ## Tests diff --git a/app/build.gradle b/app/build.gradle index 7ba00d2..e43f4fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,8 +1,14 @@ apply plugin: 'com.android.application' +allprojects { + repositories { + maven { url 'https://jitpack.io' } + } +} + android { compileSdkVersion 23 - buildToolsVersion "23.0.2" + buildToolsVersion '25.0.0' defaultConfig { applicationId "io.techery.properratingbar.sample" diff --git a/app/src/main/res/anim/animation_scale_updown.xml b/app/src/main/res/anim/animation_scale_updown.xml new file mode 100644 index 0000000..aed7dd7 --- /dev/null +++ b/app/src/main/res/anim/animation_scale_updown.xml @@ -0,0 +1,8 @@ + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 5e8f1b2..cf3aa1a 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -34,8 +34,7 @@ app:prb_symbolicTick="$" app:prb_symbolicTickNormalColor="@android:color/darker_gray" app:prb_symbolicTickSelectedColor="@android:color/holo_green_dark" - app:prb_totalTicks="5" - /> + app:prb_totalTicks="5" />