添加盲盒礼物蒙版

This commit is contained in:
18401019693 2023-05-29 11:34:34 +08:00
parent c3b5f17f44
commit 9c32c6af25
3 changed files with 25 additions and 7 deletions

View File

@ -101,7 +101,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
private ViewPager mVPWrapList;
private RadioGroup mRadioGroup, mRGroupWrap;
private View mLoading;
private View mArrow;
private View mArrow, iconMasking;
private View mBtnSend;
private View mBtnSendGroup;
private View mBtnSendLian;
@ -215,6 +215,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
progressBlind1 = mRootView.findViewById(R.id.progress_blind2);
progressBlind2 = mRootView.findViewById(R.id.progress_blind3);
mArrow = mRootView.findViewById(R.id.arrow);
iconMasking = mRootView.findViewById(R.id.icon_masking);
blindSvga = mRootView.findViewById(R.id.blind_svga);
mBtnSend = mRootView.findViewById(R.id.btn_send);
mBtnSendGroup = mRootView.findViewById(R.id.btn_send_group);
@ -718,7 +719,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
} else {
if (isPk) {
mVipGold.setVisibility(View.GONE);
}else {
} else {
mVipGold.setVisibility(View.VISIBLE);
}
blindBox.setVisibility(View.INVISIBLE);
@ -810,10 +811,11 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), dressNameIndexOf, dressNameIndexOf + dressNameSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
builder.setSpan(new ForegroundColorSpan(Color.parseColor("#FFF682")), individualDressingIndexOf, individualDressingIndexOf + individualDressingSize, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
blindNumber.setText(builder);
iconMasking.setAlpha(0.f);
} else {
int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue());
String msg = mContext.getString(R.string.resend_win);
msg = String.format(msg, String.valueOf(progress), model.getThresholdDressName());
msg = String.format(msg, String.valueOf(progress), model.getThresholdDressName());
int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
int progressIndexOf = msg.indexOf(String.valueOf(progress));
int dressNameSize = model.getThresholdDressName().length();
@ -828,6 +830,8 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
.append("/")
.append(model.getThresholdValue());
textBlindProgress.setText(stringBuffer.toString());
float maskingAlpha = (float) progress / Float.parseFloat(model.getThresholdValue());
iconMasking.setAlpha(maskingAlpha);
}
//盲盒礼物文字跑马灯
for (int i = 0; i < model.getItemName().size(); i++) {
@ -1091,7 +1095,7 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
} else {
int progress = Integer.parseInt(model.getThresholdValue()) - Integer.parseInt(model.getDressThresholdValue());
String msg = mContext.getString(R.string.resend_win);
msg = String.format(msg, String.valueOf(progress), model.getThresholdDressName());
msg = String.format(msg, String.valueOf(progress), model.getThresholdDressName());
int dressNameIndexOf = msg.indexOf(model.getThresholdDressName());
int progressIndexOf = msg.indexOf(String.valueOf(progress));
int dressNameSize = model.getThresholdDressName().length();
@ -1106,6 +1110,8 @@ public class LiveGiftDialogFragment extends AbsDialogFragment implements View.On
.append("/")
.append(model.getThresholdValue());
textBlindProgress.setText(stringBuffer.toString());
float maskingAlpha = (float) progress / Float.parseFloat(model.getThresholdValue());
iconMasking.setAlpha(maskingAlpha);
}
if (stringBuilders.size() == 0) {
boxBlindHandler.postDelayed(boxBlindRunnable, 1500);

View File

@ -11,12 +11,24 @@
android:layout_height="86.5dp"
android:background="@mipmap/bg_kirin">
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/blind_svga"
<RelativeLayout
android:layout_width="29dp"
android:layout_height="29dp"
android:layout_marginStart="14dp"
android:layout_marginTop="51dp" />
android:layout_marginTop="51dp">
<com.opensource.svgaplayer.SVGAImageView
android:id="@+id/blind_svga"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<com.yunbao.common.views.weight.ClipPathCircleImage
android:id="@+id/icon_masking"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@mipmap/icon_masking" />
</RelativeLayout>
<LinearLayout
android:layout_width="wrap_content"

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB