|
|
@@ -35,9 +35,7 @@ class UserIdView @JvmOverloads constructor(
|
|
|
|
|
|
private var copyBtnResID = R.drawable.profile_sid_bg
|
|
|
|
|
|
- private var copyBtnSize = 12
|
|
|
-
|
|
|
- private var copyBtnMarginStart = 6
|
|
|
+ private var copyBtnSize = 14.dp()
|
|
|
|
|
|
//常规字体颜色
|
|
|
private var normalTextColor = Color.parseColor("#FFFFFF")
|
|
|
@@ -59,9 +57,7 @@ class UserIdView @JvmOverloads constructor(
|
|
|
val ta = context.obtainStyledAttributes(it, R.styleable.UserIdView)
|
|
|
showCopyBtn = ta.getBoolean(R.styleable.UserIdView_show_copy_btn, false)
|
|
|
copyBtnResID = ta.getResourceId(R.styleable.UserIdView_copy_btn_res_id, R.drawable.profile_copy_ic)
|
|
|
- copyBtnSize = ta.getDimensionPixelSize(R.styleable.UserIdView_copy_btn_size, 16.dp())
|
|
|
- copyBtnMarginStart = ta.getDimensionPixelSize(R.styleable.UserIdView_copy_btn_margin_start, 4.dp())
|
|
|
-
|
|
|
+ copyBtnSize = ta.getDimensionPixelSize(R.styleable.UserIdView_copy_btn_size, 14.dp())
|
|
|
normalTextColor = ta.getColor(
|
|
|
R.styleable.UserIdView_id_text_color,
|
|
|
getCompatColor(R.color.white)
|
|
|
@@ -89,7 +85,9 @@ class UserIdView @JvmOverloads constructor(
|
|
|
if (goodIdInfo != null && goodIdInfo.goodId != 0) {
|
|
|
showEffectId = true
|
|
|
binding.tvId.apply {
|
|
|
- setPadding(20.dp(), 0, 0, 0)
|
|
|
+ updateLayoutParams<LayoutParams> {
|
|
|
+ marginStart = 18.dp()
|
|
|
+ }
|
|
|
text = goodIdInfo.goodId.toString()
|
|
|
setTextColor(getCompatColor(R.color.white))
|
|
|
}
|
|
|
@@ -136,10 +134,10 @@ class UserIdView @JvmOverloads constructor(
|
|
|
|
|
|
private fun getIdTag(length: Int): IdTag {
|
|
|
return when (length) {
|
|
|
- 8 -> IdTag("svip_8_digit_good_id.svga", 97.dp()) //173
|
|
|
- 7 -> IdTag("svip_7_digit_good_id.svga", 85.dp()) //152
|
|
|
- 6 -> IdTag("svip_6_digit_good_id.svga", 80.dp()) //143
|
|
|
- else -> IdTag("svip_8_digit_good_id.svga", 97.dp())
|
|
|
+ 8 -> IdTag("svip_8_digit_good_id.svga", 91.5f.dp()) //173
|
|
|
+ 7 -> IdTag("svip_7_digit_good_id.svga", 80.5f.dp()) //152
|
|
|
+ 6 -> IdTag("svip_6_digit_good_id.svga", 75.7f.dp()) //143
|
|
|
+ else -> IdTag("svip_8_digit_good_id.svga", 91.5f.dp())
|
|
|
}
|
|
|
}
|
|
|
}
|