[add] 个人中心与热心指数心形区分 自定义属性
@@ -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) {
|
||||
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 771 B |
@@ -38,6 +38,7 @@
|
||||
<enum name="Half" value="0" />
|
||||
<enum name="Full" value="1" />
|
||||
</attr>
|
||||
<attr name="OtherHeartImg" format="boolean" />
|
||||
|
||||
</declare-styleable>
|
||||
</resources>
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="BaseFloatDialogStyle" parent="@android:style/Theme.Dialog">
|
||||
<item name="android:windowIsFloating">true</item>
|
||||
<item name="android:windowFrame">@null</item>
|
||||
@@ -15,8 +16,6 @@
|
||||
<item name="android:borderlessButtonStyle">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<style name="customHeartHeartRatingBarStyle" parent="@style/Widget.AppCompat.RatingBar">
|
||||
<item name="android:maxWidth">@dimen/heart_ratingbar_width</item>
|
||||
<item name="android:minWidth">@dimen/heart_ratingbar_width</item>
|
||||
@@ -28,5 +27,4 @@
|
||||
<item name="android:progressDrawable">@drawable/module_commons_heart_ratingbar_drawable</item>
|
||||
</style>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -108,7 +108,8 @@
|
||||
<com.mogo.module.common.view.CustomRatingBar
|
||||
android:id="@+id/rating_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
app:OtherHeartImg="false" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/share_index_des"
|
||||
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 771 B |