Uitoken相关类增加 advance attrs+1

This commit is contained in:
renhaoting 2025-10-30 16:29:07 +08:00
parent 199993b862
commit 3c8b119a3a
10 changed files with 156 additions and 80 deletions

View File

@ -26,6 +26,7 @@ class ChatCallView @JvmOverloads constructor(
init {
mBinding = LayoutChatCallViewBinding.inflate(LayoutInflater.from(context), this, true)
setupClickListeners()
mBinding.lottieSpeaking.playAnimation()
}

View File

@ -574,28 +574,3 @@ fun View.getGradientDrawableDirectly(
return gradientDrawable
}
fun View.readTokenAdvAttrs(
token: CustomViewToken,
array: TypedArray
) {
//<!-- new added 2025.10.29 -->
token.advBgColor = array.getColor(R.styleable.UITokenTextView_advBgColor, token.advBgColor)
token.advRadius = array.getDimension(R.styleable.UITokenTextView_advRadius, token.advRadius)
token.advTopLeftRadius =
array.getDimension(R.styleable.UITokenTextView_advTopLeftRadius, token.advTopLeftRadius)
token.advTopRightRadius =
array.getDimension(R.styleable.UITokenTextView_advTopRightRadius, token.advTopRightRadius)
token.advBottomRightRadius = array.getDimension(
R.styleable.UITokenTextView_advBottomRightRadius,
token.advBottomRightRadius
)
token.advBottomLeftRadius = array.getDimension(
R.styleable.UITokenTextView_advBottomLeftRadius,
token.advBottomLeftRadius
)
token.advStrokeColor =
array.getColor(R.styleable.UITokenTextView_advStrokeColor, token.advStrokeColor)
token.advStrokeWidth =
array.getDimension(R.styleable.UITokenTextView_advStrokeWidth, token.advStrokeWidth)
}

View File

@ -8,7 +8,6 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
import com.remax.visualnovel.widget.uitoken.changeBackground
import com.remax.visualnovel.widget.uitoken.changeOutline
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
/**
* Created by HJW on 2022/8/31
@ -45,7 +44,15 @@ open class UITokenConstraintLayout @JvmOverloads constructor(context: Context, a
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_strokeDashWidth, 0).toFloat()
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_strokeDashGap, 0).toFloat()
readTokenAdvAttrs(this@run, typedArray)
//<!-- new added 2025.10.29 -->
advBgColor = typedArray.getColor(R.styleable.UITokenConstraintLayout_advBgColor, advBgColor)
advRadius = typedArray.getDimension(R.styleable.UITokenConstraintLayout_advRadius, advRadius)
advTopLeftRadius = typedArray.getDimension(R.styleable.UITokenConstraintLayout_advTopLeftRadius, advTopLeftRadius)
advTopRightRadius = typedArray.getDimension(R.styleable.UITokenConstraintLayout_advTopRightRadius, advTopRightRadius)
advBottomRightRadius = typedArray.getDimension(R.styleable.UITokenConstraintLayout_advBottomRightRadius, advBottomRightRadius)
advBottomLeftRadius = typedArray.getDimension(R.styleable.UITokenConstraintLayout_advBottomLeftRadius, advBottomLeftRadius)
advStrokeColor = typedArray.getColor(R.styleable.UITokenConstraintLayout_advStrokeColor, advStrokeColor)
advStrokeWidth = typedArray.getDimension(R.styleable.UITokenConstraintLayout_advStrokeWidth, advStrokeWidth)
}
typedArray.recycle()

View File

@ -9,7 +9,6 @@ import com.remax.visualnovel.widget.uitoken.changeBackground
import com.remax.visualnovel.widget.uitoken.changeOutline
import com.remax.visualnovel.widget.uitoken.changeTextColor
import com.remax.visualnovel.widget.uitoken.changeTextFont
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
/**
* Created by HJW on 2022/8/31
@ -47,7 +46,15 @@ open class UITokenEditView @JvmOverloads constructor(context: Context, attrs: At
strokeUIHoveredColorToken = typedArray.getString(R.styleable.UITokenEditView_strokeHoveredColorToken) ?: ""
strokeUIDisabledColorToken = typedArray.getString(R.styleable.UITokenEditView_strokeDisabledColorToken) ?: ""
readTokenAdvAttrs(this@run, typedArray)
//<!-- new added 2025.10.29 -->
advBgColor = typedArray.getColor(R.styleable.UITokenEditView_advBgColor, advBgColor)
advRadius = typedArray.getDimension(R.styleable.UITokenEditView_advRadius, advRadius)
advTopLeftRadius = typedArray.getDimension(R.styleable.UITokenEditView_advTopLeftRadius, advTopLeftRadius)
advTopRightRadius = typedArray.getDimension(R.styleable.UITokenEditView_advTopRightRadius, advTopRightRadius)
advBottomRightRadius = typedArray.getDimension(R.styleable.UITokenEditView_advBottomRightRadius, advBottomRightRadius)
advBottomLeftRadius = typedArray.getDimension(R.styleable.UITokenEditView_advBottomLeftRadius, advBottomLeftRadius)
advStrokeColor = typedArray.getColor(R.styleable.UITokenEditView_advStrokeColor, advStrokeColor)
advStrokeWidth = typedArray.getDimension(R.styleable.UITokenEditView_advStrokeWidth, advStrokeWidth)
}
typedArray.recycle()

View File

@ -8,7 +8,6 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
import com.remax.visualnovel.widget.uitoken.changeBackground
import com.remax.visualnovel.widget.uitoken.changeOutline
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
/**
* Created by HJW on 2022/8/31
@ -45,7 +44,15 @@ open class UITokenFrameLayout @JvmOverloads constructor(context: Context, attrs:
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_strokeDashWidth, 0).toFloat()
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_strokeDashGap, 0).toFloat()
readTokenAdvAttrs(this@run, typedArray)
//<!-- new added 2025.10.29 -->
advBgColor = typedArray.getColor(R.styleable.UITokenFrameLayout_advBgColor, advBgColor)
advRadius = typedArray.getDimension(R.styleable.UITokenFrameLayout_advRadius, advRadius)
advTopLeftRadius = typedArray.getDimension(R.styleable.UITokenFrameLayout_advTopLeftRadius, advTopLeftRadius)
advTopRightRadius = typedArray.getDimension(R.styleable.UITokenFrameLayout_advTopRightRadius, advTopRightRadius)
advBottomRightRadius = typedArray.getDimension(R.styleable.UITokenFrameLayout_advBottomRightRadius, advBottomRightRadius)
advBottomLeftRadius = typedArray.getDimension(R.styleable.UITokenFrameLayout_advBottomLeftRadius, advBottomLeftRadius)
advStrokeColor = typedArray.getColor(R.styleable.UITokenFrameLayout_advStrokeColor, advStrokeColor)
advStrokeWidth = typedArray.getDimension(R.styleable.UITokenFrameLayout_advStrokeWidth, advStrokeWidth)
}
typedArray.recycle()

View File

@ -1,6 +1,7 @@
package com.remax.visualnovel.widget.uitoken.view
import android.content.Context
import android.content.res.TypedArray
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatImageView
import com.remax.visualnovel.R
@ -8,7 +9,6 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
import com.remax.visualnovel.widget.uitoken.changeBackground
import com.remax.visualnovel.widget.uitoken.changeOutline
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
/**
* Created by HJW on 2022/8/31
@ -46,7 +46,16 @@ open class UITokenImageView @JvmOverloads constructor(context: Context, attrs: A
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_strokeDashWidth, 0).toFloat()
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_strokeDashGap, 0).toFloat()
readTokenAdvAttrs(this@run, typedArray)
//<!-- new added 2025.10.29 -->
advBgColor = typedArray.getColor(R.styleable.UITokenImageView_advBgColor, advBgColor)
advRadius = typedArray.getDimension(R.styleable.UITokenImageView_advRadius, advRadius)
advTopLeftRadius = typedArray.getDimension(R.styleable.UITokenImageView_advTopLeftRadius, advTopLeftRadius)
advTopRightRadius = typedArray.getDimension(R.styleable.UITokenImageView_advTopRightRadius, advTopRightRadius)
advBottomRightRadius = typedArray.getDimension(R.styleable.UITokenImageView_advBottomRightRadius, advBottomRightRadius)
advBottomLeftRadius = typedArray.getDimension(R.styleable.UITokenImageView_advBottomLeftRadius, advBottomLeftRadius)
advStrokeColor = typedArray.getColor(R.styleable.UITokenImageView_advStrokeColor, advStrokeColor)
advStrokeWidth = typedArray.getDimension(R.styleable.UITokenImageView_advStrokeWidth, advStrokeWidth)
}
typedArray.recycle()
@ -62,4 +71,4 @@ open class UITokenImageView @JvmOverloads constructor(context: Context, attrs: A
override fun getUITokenView(): CustomViewToken {
return customViewToken
}
}
}

View File

@ -8,7 +8,6 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
import com.remax.visualnovel.widget.uitoken.changeBackground
import com.remax.visualnovel.widget.uitoken.changeOutline
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
/**
* Created by HJW on 2022/8/31
@ -45,7 +44,15 @@ open class UITokenLinearLayout @JvmOverloads constructor(context: Context, attrs
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_strokeDashWidth, 0).toFloat()
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_strokeDashGap, 0).toFloat()
readTokenAdvAttrs(this@run, typedArray)
//<!-- new added 2025.10.29 -->
advBgColor = typedArray.getColor(R.styleable.UITokenLinearLayout_advBgColor, advBgColor)
advRadius = typedArray.getDimension(R.styleable.UITokenLinearLayout_advRadius, advRadius)
advTopLeftRadius = typedArray.getDimension(R.styleable.UITokenLinearLayout_advTopLeftRadius, advTopLeftRadius)
advTopRightRadius = typedArray.getDimension(R.styleable.UITokenLinearLayout_advTopRightRadius, advTopRightRadius)
advBottomRightRadius = typedArray.getDimension(R.styleable.UITokenLinearLayout_advBottomRightRadius, advBottomRightRadius)
advBottomLeftRadius = typedArray.getDimension(R.styleable.UITokenLinearLayout_advBottomLeftRadius, advBottomLeftRadius)
advStrokeColor = typedArray.getColor(R.styleable.UITokenLinearLayout_advStrokeColor, advStrokeColor)
advStrokeWidth = typedArray.getDimension(R.styleable.UITokenLinearLayout_advStrokeWidth, advStrokeWidth)
}
typedArray.recycle()

View File

@ -8,7 +8,6 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
import com.remax.visualnovel.widget.uitoken.changeBackground
import com.remax.visualnovel.widget.uitoken.changeOutline
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
/**
* Created by HJW on 2022/8/31
@ -45,7 +44,15 @@ class UITokenRelativeLayout @JvmOverloads constructor(context: Context, attrs: A
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_strokeDashWidth, 0).toFloat()
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_strokeDashGap, 0).toFloat()
readTokenAdvAttrs(this@run, typedArray)
//<!-- new added 2025.10.29 -->
advBgColor = typedArray.getColor(R.styleable.UITokenImageView_advBgColor, advBgColor)
advRadius = typedArray.getDimension(R.styleable.UITokenImageView_advRadius, advRadius)
advTopLeftRadius = typedArray.getDimension(R.styleable.UITokenImageView_advTopLeftRadius, advTopLeftRadius)
advTopRightRadius = typedArray.getDimension(R.styleable.UITokenImageView_advTopRightRadius, advTopRightRadius)
advBottomRightRadius = typedArray.getDimension(R.styleable.UITokenImageView_advBottomRightRadius, advBottomRightRadius)
advBottomLeftRadius = typedArray.getDimension(R.styleable.UITokenImageView_advBottomLeftRadius, advBottomLeftRadius)
advStrokeColor = typedArray.getColor(R.styleable.UITokenImageView_advStrokeColor, advStrokeColor)
advStrokeWidth = typedArray.getDimension(R.styleable.UITokenImageView_advStrokeWidth, advStrokeWidth)
}
typedArray.recycle()

View File

@ -16,7 +16,6 @@ import com.remax.visualnovel.widget.uitoken.changeTextColor
import com.remax.visualnovel.widget.uitoken.changeTextFont
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
import androidx.core.content.withStyledAttributes
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
/**
* Created by HJW on 2022/8/31
@ -80,7 +79,15 @@ open class UITokenTextView @JvmOverloads constructor(context: Context, private v
fixTextIsSelectable = getBoolean(R.styleable.UITokenTextView_fixTextIsSelectable, fixTextIsSelectable)
readTokenAdvAttrs(this@run, this@withStyledAttributes)
//<!-- new added 2025.10.29 -->
advBgColor = getColor(R.styleable.UITokenTextView_advBgColor, advBgColor)
advRadius = getDimension(R.styleable.UITokenTextView_advRadius, advRadius)
advTopLeftRadius = getDimension(R.styleable.UITokenTextView_advTopLeftRadius, advTopLeftRadius)
advTopRightRadius = getDimension(R.styleable.UITokenTextView_advTopRightRadius, advTopRightRadius)
advBottomRightRadius = getDimension(R.styleable.UITokenTextView_advBottomRightRadius, advBottomRightRadius)
advBottomLeftRadius = getDimension(R.styleable.UITokenTextView_advBottomLeftRadius, advBottomLeftRadius)
advStrokeColor = getColor(R.styleable.UITokenTextView_advStrokeColor, advStrokeColor)
advStrokeWidth = getDimension(R.styleable.UITokenTextView_advStrokeWidth, advStrokeWidth)
}
}

View File

@ -58,6 +58,17 @@
format="dimension" />
<attr name="radioCheck"
format="boolean" />
<!-- new added 2025.10.29 -->
<attr name="advBgColor" format="color" />
<attr name="advRadius" format="dimension" />
<attr name="advTopLeftRadius" format="dimension" />
<attr name="advTopRightRadius" format="dimension" />
<attr name="advBottomRightRadius" format="dimension" />
<attr name="advBottomLeftRadius" format="dimension" />
<attr name="advStrokeColor" format="color" />
<attr name="advStrokeWidth" format="dimension" />
<declare-styleable name="UITokenTextView">
<!-- 字体 -->
<attr name="textToken" />
@ -100,14 +111,14 @@
<!-- new added 2025.10.29 -->
<attr name="advBgColor" format="color" />
<attr name="advRadius" format="dimension" />
<attr name="advTopLeftRadius" format="dimension" />
<attr name="advTopRightRadius" format="dimension" />
<attr name="advBottomRightRadius" format="dimension" />
<attr name="advBottomLeftRadius" format="dimension" />
<attr name="advStrokeColor" format="color" />
<attr name="advStrokeWidth" format="dimension" />
<attr name="advBgColor" />
<attr name="advRadius" />
<attr name="advTopLeftRadius" />
<attr name="advTopRightRadius" />
<attr name="advBottomRightRadius" />
<attr name="advBottomLeftRadius" />
<attr name="advStrokeColor" />
<attr name="advStrokeWidth" />
</declare-styleable>
<declare-styleable name="UITokenEditView">
@ -138,14 +149,14 @@
<attr name="yClickExpend" />
<!-- new added 2025.10.29 -->
<!--<attr name="advBgColor" format="color" />
<attr name="advRadius" format="dimension" />
<attr name="advTopLeftRadius" format="dimension" />
<attr name="advTopRightRadius" format="dimension" />
<attr name="advBottomRightRadius" format="dimension" />
<attr name="advBottomLeftRadius" format="dimension" />
<attr name="advStrokeColor" format="color" />
<attr name="advStrokeWidth" format="dimension" />-->
<attr name="advBgColor" />
<attr name="advRadius" />
<attr name="advTopLeftRadius" />
<attr name="advTopRightRadius" />
<attr name="advBottomRightRadius" />
<attr name="advBottomLeftRadius" />
<attr name="advStrokeColor" />
<attr name="advStrokeWidth" />
</declare-styleable>
<declare-styleable name="UITokenImageView">
@ -171,14 +182,14 @@
<attr name="yClickExpend" />
<!-- new added 2025.10.29 -->
<!--<attr name="advBgColor" format="color" />
<attr name="advRadius" format="dimension" />
<attr name="advTopLeftRadius" format="dimension" />
<attr name="advTopRightRadius" format="dimension" />
<attr name="advBottomRightRadius" format="dimension" />
<attr name="advBottomLeftRadius" format="dimension" />
<attr name="advStrokeColor" format="color" />
<attr name="advStrokeWidth" format="dimension" />-->
<attr name="advBgColor" />
<attr name="advRadius" />
<attr name="advTopLeftRadius" />
<attr name="advTopRightRadius" />
<attr name="advBottomRightRadius" />
<attr name="advBottomLeftRadius" />
<attr name="advStrokeColor" />
<attr name="advStrokeWidth" />
</declare-styleable>
<declare-styleable name="UITokenFrameLayout">
@ -204,14 +215,14 @@
<attr name="yClickExpend" />
<!-- new added 2025.10.29 -->
<!--<attr name="advBgColor" format="color" />
<attr name="advRadius" format="dimension" />
<attr name="advTopLeftRadius" format="dimension" />
<attr name="advTopRightRadius" format="dimension" />
<attr name="advBottomRightRadius" format="dimension" />
<attr name="advBottomLeftRadius" format="dimension" />
<attr name="advStrokeColor" format="color" />
<attr name="advStrokeWidth" format="dimension" />-->
<attr name="advBgColor" />
<attr name="advRadius" />
<attr name="advTopLeftRadius" />
<attr name="advTopRightRadius" />
<attr name="advBottomRightRadius" />
<attr name="advBottomLeftRadius" />
<attr name="advStrokeColor" />
<attr name="advStrokeWidth" />
</declare-styleable>
<declare-styleable name="UITokenRelativeLayout">
@ -237,14 +248,14 @@
<attr name="yClickExpend" />
<!-- new added 2025.10.29 -->
<!--<attr name="advBgColor" format="color" />
<attr name="advRadius" format="dimension" />
<attr name="advTopLeftRadius" format="dimension" />
<attr name="advTopRightRadius" format="dimension" />
<attr name="advBottomRightRadius" format="dimension" />
<attr name="advBottomLeftRadius" format="dimension" />
<attr name="advStrokeColor" format="color" />
<attr name="advStrokeWidth" format="dimension" />-->
<attr name="advBgColor" />
<attr name="advRadius" />
<attr name="advTopLeftRadius" />
<attr name="advTopRightRadius" />
<attr name="advBottomRightRadius" />
<attr name="advBottomLeftRadius" />
<attr name="advStrokeColor" />
<attr name="advStrokeWidth" />
</declare-styleable>
<declare-styleable name="UITokenLinearLayout">
@ -268,6 +279,16 @@
<attr name="outlineToken" />
<attr name="xClickExpend" />
<attr name="yClickExpend" />
<!-- new added 2025.10.29 -->
<attr name="advBgColor" />
<attr name="advRadius" />
<attr name="advTopLeftRadius" />
<attr name="advTopRightRadius" />
<attr name="advBottomRightRadius" />
<attr name="advBottomLeftRadius" />
<attr name="advStrokeColor" />
<attr name="advStrokeWidth" />
</declare-styleable>
<declare-styleable name="UITokenConstraintLayout">
@ -291,6 +312,16 @@
<attr name="outlineToken" />
<attr name="xClickExpend" />
<attr name="yClickExpend" />
<!-- new added 2025.10.29 -->
<attr name="advBgColor" />
<attr name="advRadius" />
<attr name="advTopLeftRadius" />
<attr name="advTopRightRadius" />
<attr name="advBottomRightRadius" />
<attr name="advBottomLeftRadius" />
<attr name="advStrokeColor" />
<attr name="advStrokeWidth" />
</declare-styleable>
<declare-styleable name="UITokenProgressBar">
@ -1499,6 +1530,24 @@
<attr name="dividerColor" format="color"/>
</declare-styleable>
<declare-styleable name="LevelSeekBar">
<!-- 档位数量 -->
<attr name="totalLevels" format="integer" />
<!-- 当前档位 -->
<attr name="currentLevel" format="integer" />
<!-- 轨道颜色 -->
<attr name="trackColor" format="color" />
<attr name="activeTrackColor" format="color" />
<!-- 拇指颜色 -->
<attr name="thumbColor" format="color" />
<!-- 档位标记颜色 -->
<attr name="levelMarkerColor" format="color" />
<attr name="activeLevelMarkerColor" format="color" />
<!-- 尺寸 -->
<attr name="trackHeight" format="dimension" />
<attr name="thumbRadius" format="dimension" />
<attr name="levelMarkerRadius" format="dimension" />
</declare-styleable>
</resources>