Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions library/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@

<!-- Margin to be applied to tick drawables. Only applies to drawable-type ticks. Default is '1dp' (gray). -->
<attr name="prb_tickSpacing" format="dimension" />

<!--star size, default is 20dp-->
<attr name="prb_drawableSize" format="dimension"/>
</declare-styleable>

<item name="prb_tick_tag_id" type="id" />
Expand Down
1 change: 1 addition & 0 deletions library/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

<dimen name="prb_symbolic_tick_default_text_size">15sp</dimen>
<dimen name="prb_drawable_tick_default_spacing">1dp</dimen>
<dimen name="prb_drawable_default_size">20dp</dimen>
</resources>
5 changes: 4 additions & 1 deletion library/src/io/techery/properratingbar/ProperRatingBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class ProperRatingBar extends LinearLayout {
private static final int DF_SYMBOLIC_TEXT_NORMAL_COLOR = Color.BLACK;
private static final int DF_SYMBOLIC_TEXT_SELECTED_COLOR = Color.GRAY;
private static final int DF_TICK_SPACING_RES = R.dimen.prb_drawable_tick_default_spacing;

private static final int DF_DRAWABLE_SIZE = R.dimen.prb_drawable_default_size;
private int totalTicks;
private int lastSelectedTickIndex;
private boolean clickable;
Expand All @@ -62,6 +62,7 @@ public class ProperRatingBar extends LinearLayout {
private int customTextStyle;
private int customTextNormalColor;
private int customTextSelectedColor;
private int drawableSize;
private Drawable tickNormalDrawable;
private Drawable tickSelectedDrawable;
private int tickSpacing;
Expand All @@ -80,6 +81,7 @@ private void init(Context context, AttributeSet attrs) {
//
totalTicks = a.getInt(R.styleable.ProperRatingBar_prb_totalTicks, DF_TOTAL_TICKS);
rating = a.getInt(R.styleable.ProperRatingBar_prb_defaultRating, DF_DEFAULT_TICKS);
drawableSize = a.getInt(R.styleable.ProperRatingBar_prb_drawableSize, DF_DRAWABLE_SIZE);
//
clickable = a.getBoolean(R.styleable.ProperRatingBar_prb_clickable, DF_CLICKABLE);
//
Expand Down Expand Up @@ -145,6 +147,7 @@ private void addSymbolicTick(Context context, int position) {
private void addDrawableTick(Context context, int position) {
ImageView iv = new ImageView(context);
iv.setPadding(tickSpacing, tickSpacing, tickSpacing, tickSpacing);
iv.setLayoutParams(new LinearLayoutCompat.LayoutParams(drawableSize,drawableSize));
updateTicksClickParameters(iv, position);
this.addView(iv);
}
Expand Down