diff --git a/.idea/misc.xml b/.idea/misc.xml index f0ee888..973695b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -27,5 +27,5 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/ac_main.xml b/app/src/main/res/layout/ac_main.xml index 74a2518..d3fe3a4 100644 --- a/app/src/main/res/layout/ac_main.xml +++ b/app/src/main/res/layout/ac_main.xml @@ -20,6 +20,7 @@ app:starFill="@mipmap/star_yellow" app:starHalf="@mipmap/star_half_yellow" app:starImageSize="30dp" + app:stepSize="Half" app:starStep="4.5"> fint) { setStar(indexOfChild(v) + 1); } else if (indexOfChild(v) == fint) { + if(stepSize==StepSize.Full){ + return; + } if (imageView.getDrawable().getCurrent().getConstantState().equals(starHalfDrawable.getConstantState())) { setStar(indexOfChild(v) + 1); } else { diff --git a/libray_lxndroid/src/main/java/com/kejiang/yuandl/view/StepSize.java b/libray_lxndroid/src/main/java/com/kejiang/yuandl/view/StepSize.java new file mode 100644 index 0000000..b1b1f79 --- /dev/null +++ b/libray_lxndroid/src/main/java/com/kejiang/yuandl/view/StepSize.java @@ -0,0 +1,22 @@ +package com.kejiang.yuandl.view; + +/** + * Created by yuandl on 2016/8/2 0002. + */ +public enum StepSize { + Half(0), Full(1); + int step; + + StepSize(int step) { + this.step = step; + } + + static StepSize fromStep(int step) { + for (StepSize f : values()) { + if (f.step == step) { + return f; + } + } + throw new IllegalArgumentException(); + } +} diff --git a/libray_lxndroid/src/main/res/values/attrs.xml b/libray_lxndroid/src/main/res/values/attrs.xml index b9b8ab1..1db1ccd 100644 --- a/libray_lxndroid/src/main/res/values/attrs.xml +++ b/libray_lxndroid/src/main/res/values/attrs.xml @@ -39,8 +39,8 @@ - - + + @@ -65,23 +65,33 @@ - + - - - - - - - - - - + + + + + + + + + + + - + + + + + + - + + + + + @@ -89,13 +99,13 @@ - + - + - - + + \ No newline at end of file