diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/CustomRatingBar.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/CustomRatingBar.java index 8403901eef..b38917966c 100644 --- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/CustomRatingBar.java +++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/view/CustomRatingBar.java @@ -77,6 +77,11 @@ public class CustomRatingBar extends LinearLayout { * */ private StepSize stepSize; + /* + *添加资源(空白心是白色还是灰色自定义属性) + * */ + private boolean otherHeartImg; + @Override public boolean isClickable() { return mClickable; @@ -159,14 +164,21 @@ public class CustomRatingBar extends LinearLayout { context.getResources().getDimension(R.dimen.heart_ratingbar_height)); elementPadding = mTypedArray.getDimension(R.styleable.CustomRatingBar_elenmentPadding, context.getResources().getDimension(R.dimen.ratingbar_padding)); + /* + * 白天模式下 热心指数(白色)和个人中心(灰色)使用不同的资源 + * 默认灰色 + * */ + otherHeartImg = mTypedArray.getBoolean(R.styleable.CustomRatingBar_OtherHeartImg, true); elementStep = mTypedArray.getFloat(R.styleable.CustomRatingBar_elenmentStep, 1.0f); stepSize = StepSize.fromStep(mTypedArray.getInt(R.styleable.CustomRatingBar_stepSize, 1)); elementCount = mTypedArray.getInteger(R.styleable.CustomRatingBar_elenmentCount, 5); stepSize = StepSize.Half; - Drawable drawable_empty_default = ContextCompat.getDrawable(context, R.drawable.icon_heart_unchoose); - Drawable drawable_harf_default = ContextCompat.getDrawable(context, R.drawable.icon_heart_second); + Drawable drawable_empty_default = ContextCompat.getDrawable(context, + otherHeartImg == false ? R.drawable.icon_heart_unchoose : R.drawable.icon_heart_unchoose_other); + Drawable drawable_half_default = ContextCompat.getDrawable(context, + otherHeartImg == false ? R.drawable.icon_heart_second : R.drawable.icon_heart_second_other); Drawable drawable_fill_default = ContextCompat.getDrawable(context, R.drawable.icon_heart_choose); Drawable drawable_empty = mTypedArray.getDrawable(R.styleable.CustomRatingBar_elenmentEmpty); @@ -175,7 +187,7 @@ public class CustomRatingBar extends LinearLayout { elementEmptyDrawable = drawable_empty != null ? drawable_empty : drawable_empty_default; elementFillDrawable = drawable_half != null ? drawable_half : drawable_fill_default; - elementHarfDrawable = drawable_fill != null ? drawable_fill : drawable_harf_default; + elementHarfDrawable = drawable_fill != null ? drawable_fill : drawable_half_default; mClickable = mTypedArray.getBoolean(R.styleable.CustomRatingBar_clickable, false); mTypedArray.recycle(); for (int i = 0; i < elementCount; ++i) { diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_heart_second_other.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_heart_second_other.png new file mode 100644 index 0000000000..1c49555541 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_heart_second_other.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_heart_unchoose_other.png b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_heart_unchoose_other.png new file mode 100644 index 0000000000..09ab4af9e3 Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable-xhdpi/icon_heart_unchoose_other.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable/icon_heart_second_other.png b/modules/mogo-module-common/src/main/res/drawable/icon_heart_second_other.png new file mode 100644 index 0000000000..e26dbe8a7b Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable/icon_heart_second_other.png differ diff --git a/modules/mogo-module-common/src/main/res/drawable/icon_heart_unchoose_other.png b/modules/mogo-module-common/src/main/res/drawable/icon_heart_unchoose_other.png new file mode 100644 index 0000000000..c1dbeacc1d Binary files /dev/null and b/modules/mogo-module-common/src/main/res/drawable/icon_heart_unchoose_other.png differ diff --git a/modules/mogo-module-common/src/main/res/values/attr.xml b/modules/mogo-module-common/src/main/res/values/attr.xml index c18d5a5d09..073636bd02 100644 --- a/modules/mogo-module-common/src/main/res/values/attr.xml +++ b/modules/mogo-module-common/src/main/res/values/attr.xml @@ -38,6 +38,7 @@ + \ No newline at end of file diff --git a/modules/mogo-module-common/src/main/res/values/styles.xml b/modules/mogo-module-common/src/main/res/values/styles.xml index 047f2a7f55..aab6f7f597 100644 --- a/modules/mogo-module-common/src/main/res/values/styles.xml +++ b/modules/mogo-module-common/src/main/res/values/styles.xml @@ -1,5 +1,6 @@ + - - - \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_share_description.xml b/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_share_description.xml index 6d3d72c99b..b0281ff0a3 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_share_description.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/module_v2x_event_share_description.xml @@ -108,7 +108,8 @@ + android:layout_height="wrap_content" + app:OtherHeartImg="false" />