红包全服通知

This commit is contained in:
18401019693
2023-07-04 16:02:45 +08:00
parent f417e4ead8
commit cbe91c84e9
9 changed files with 152 additions and 28 deletions

View File

@@ -34,6 +34,17 @@ public class AllServerNotifyEvent extends BaseModel {
//主播名字
@SerializedName("ancherName")
private String anchorName;
// 是否是红包
private boolean isRedPacket = false;
public boolean isRedPacket() {
return isRedPacket;
}
public AllServerNotifyEvent setRedPacket(boolean redPacket) {
isRedPacket = redPacket;
return this;
}
public String getAnchorName() {
return anchorName;
@@ -137,6 +148,6 @@ public class AllServerNotifyEvent extends BaseModel {
", blindBoxId='" + blindBoxId + '\'' + "\n" +
", boxType='" + boxType + '\'' + "\n" +
", displaySrc='" + displaySrc + '\'' + "\n" +
'}' + "\n" ;
'}' + "\n";
}
}

View File

@@ -0,0 +1,52 @@
package com.yunbao.common.views;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.text.style.ImageSpan;
import org.jetbrains.annotations.NotNull;
public class CenterImageSpan extends ImageSpan {
public CenterImageSpan(Drawable arg1) {
super(arg1);
}
public int getSize(@NotNull Paint paint, CharSequence text, int start, int end, Paint.FontMetricsInt fm) {
Drawable d = getDrawable();
Rect rect = d.getBounds();
if (fm != null) {
Paint.FontMetricsInt fmPaint = paint.getFontMetricsInt();
int fontHeight = fmPaint.bottom - fmPaint.top;
int drHeight = rect.bottom - rect.top;
int top = drHeight / 2 - fontHeight / 4;
int bottom = drHeight / 2 + fontHeight / 4;
fm.ascent = -bottom;
fm.top = -bottom;
fm.bottom = top;
fm.descent = top;
}
return rect.right;
}
@Override
public void draw(@NotNull Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom, @NotNull Paint paint) {
Drawable b = getDrawable();
canvas.save();
int transY = 0;
transY = ((bottom - top) - b.getBounds().bottom) / 2 + top;
canvas.translate(x, transY);
b.draw(canvas);
canvas.restore();
}
}

View File

@@ -1247,4 +1247,5 @@ Limited ride And limited avatar frame</string>
<string name="red_too_bad">很遺憾</string>
<string name="red_too_bad2">與紅包擦肩而過</string>
<string name="check_out_your_luck">查看大家手氣</string>
<string name="lucky_red_envelope"> %s 在 好運紅包 中抽到了 %s</string>
</resources>