红包打开创建领取的样式逻辑构建

This commit is contained in:
18401019693
2023-06-29 10:15:24 +08:00
parent 279575d80b
commit 40455fffc9
17 changed files with 598 additions and 30 deletions

View File

@@ -0,0 +1,73 @@
package com.yunbao.common.views.weight;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
public class CircleProgress extends View {
private Paint mPaint;
private RectF mRectF;
private int mCurrent = 1, mMax = 100;
//圆弧(也可以说是圆环)的宽度
private float mArcWidth =8;
//控件的宽度
private float mWidth;
public CircleProgress(Context context) {
this(context, null);
}
public CircleProgress(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public CircleProgress(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mPaint = new Paint();
mPaint.setAntiAlias(true);
mRectF = new RectF();
}
public void setCurrent(int mCurrent) {
this.mCurrent = mCurrent;
invalidate();
}
public void setMax(int mMax) {
this.mMax = mMax;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
//getMeasuredWidth获取的是view的原始大小也就是xml中配置或者代码中设置的大小
//getWidth获取的是view最终显示的大小这个大小不一定等于原始大小
mWidth = getMeasuredWidth();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
mPaint.setStyle(Paint.Style.STROKE);
//设置圆弧的宽度(圆环的宽度)
mPaint.setStrokeWidth(mArcWidth);
mPaint.setColor(Color.parseColor("#FF98A2"));
//大圆的半径
float bigCircleRadius = mWidth / 2;
//小圆的半径
float smallCircleRadius = bigCircleRadius - mArcWidth;
//绘制小圆
canvas.drawCircle(bigCircleRadius, bigCircleRadius, smallCircleRadius, mPaint);
mPaint.setColor(Color.parseColor("#FFF7CD"));
mRectF.set(mArcWidth, mArcWidth, mWidth - mArcWidth, mWidth - mArcWidth);
//绘制圆弧
canvas.drawArc(mRectF, -90, mCurrent * 360 / mMax, false, mPaint);
setBackgroundColor(Color.parseColor("#FD2D48"));
}
}

View File

@@ -1205,4 +1205,22 @@ Limited ride And limited avatar frame</string>
<string name="total_consumption_of_drill">共計消耗%s鑚</string>
<string name="top_up_now">去充值></string>
<string name="range_range_is">范围区间为[%s]</string>
<string name="red_packet_value">价值</string>
<string name="red_packet_open"></string>
<string name="randomly_available">隨機可得</string>
<string name="build_up_popularity">攢人氣</string>
<string name="send_red_packet_illustrate1">1.在直播間發紅包有什麽好處?</string>
<string name="send_red_packet_illustrate2">有紅包的直播間會給新增熱度,吸引更多用戶觀看直播</string>
<string name="send_red_packet_illustrate3">2.紅包發給誰?</string>
<string name="send_red_packet_illustrate4">紅包發出后,直播間所有用戶都可搶,包括自己</string>
<string name="send_red_packet_illustrate5">3.紅包怎麽發?</string>
<string name="send_red_packet_illustrate6">紅包同爲禮物20%鑽石獎勵給主播剩餘70%的鑽石會以【1鑽石=1金豆】的比列兌換成金豆塞進紅包内給直播間觀看領取剩餘10%隨機包成鑽石禮物包進紅包裹,另平臺設有紅包目標任務,每連成一個目標,平臺將獎勵目標紅包 數總價值的2%開設超級獎池供所有目標用戶抽取</string>
<string name="send_red_packet_illustrate7">4.未被領取的紅包如何處理?</string>
<string name="send_red_packet_illustrate8">紅包打開后未被領取,以及主播下播后未打開的紅包,會退回您的賬戶</string>
<string name="send_red_packet_illustrate9">5.搶到的紅包能幹嘛?</string>
<string name="send_red_packet_illustrate10">搶到紅包所得金豆可用於平臺一切金豆行爲,不轉增,不可體現</string>
<string name="congratulations_on_getting_the_red_envelope">恭喜搶到紅包</string>
<string name="cred_envelope_obtained">獲得%s</string>
<string name="view_lucky_viewers">查看幸運觀衆></string>
<string name="anchor_his_heart">贈送主播禮物表達心意</string>
</resources>