Uitoken相关类增加 advance attrs
This commit is contained in:
parent
a03a7bd31e
commit
199993b862
|
|
@ -1,6 +1,7 @@
|
||||||
package com.remax.visualnovel.widget.uitoken
|
package com.remax.visualnovel.widget.uitoken
|
||||||
|
|
||||||
import android.content.res.ColorStateList
|
import android.content.res.ColorStateList
|
||||||
|
import android.content.res.TypedArray
|
||||||
import android.graphics.LinearGradient
|
import android.graphics.LinearGradient
|
||||||
import android.graphics.Outline
|
import android.graphics.Outline
|
||||||
import android.graphics.Shader
|
import android.graphics.Shader
|
||||||
|
|
@ -572,3 +573,29 @@ fun View.getGradientDrawableDirectly(
|
||||||
)
|
)
|
||||||
return gradientDrawable
|
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)
|
||||||
|
}
|
||||||
|
|
@ -8,6 +8,7 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
|
||||||
import com.remax.visualnovel.widget.uitoken.changeBackground
|
import com.remax.visualnovel.widget.uitoken.changeBackground
|
||||||
import com.remax.visualnovel.widget.uitoken.changeOutline
|
import com.remax.visualnovel.widget.uitoken.changeOutline
|
||||||
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
||||||
|
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by HJW on 2022/8/31
|
* Created by HJW on 2022/8/31
|
||||||
|
|
@ -43,6 +44,8 @@ open class UITokenConstraintLayout @JvmOverloads constructor(context: Context, a
|
||||||
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_yClickExpend, 0)
|
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_yClickExpend, 0)
|
||||||
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_strokeDashWidth, 0).toFloat()
|
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_strokeDashWidth, 0).toFloat()
|
||||||
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_strokeDashGap, 0).toFloat()
|
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenConstraintLayout_strokeDashGap, 0).toFloat()
|
||||||
|
|
||||||
|
readTokenAdvAttrs(this@run, typedArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import com.remax.visualnovel.widget.uitoken.changeBackground
|
||||||
import com.remax.visualnovel.widget.uitoken.changeOutline
|
import com.remax.visualnovel.widget.uitoken.changeOutline
|
||||||
import com.remax.visualnovel.widget.uitoken.changeTextColor
|
import com.remax.visualnovel.widget.uitoken.changeTextColor
|
||||||
import com.remax.visualnovel.widget.uitoken.changeTextFont
|
import com.remax.visualnovel.widget.uitoken.changeTextFont
|
||||||
|
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by HJW on 2022/8/31
|
* Created by HJW on 2022/8/31
|
||||||
|
|
@ -45,6 +46,8 @@ open class UITokenEditView @JvmOverloads constructor(context: Context, attrs: At
|
||||||
strokeUIPressedColorToken = typedArray.getString(R.styleable.UITokenEditView_strokePressedColorToken) ?: ""
|
strokeUIPressedColorToken = typedArray.getString(R.styleable.UITokenEditView_strokePressedColorToken) ?: ""
|
||||||
strokeUIHoveredColorToken = typedArray.getString(R.styleable.UITokenEditView_strokeHoveredColorToken) ?: ""
|
strokeUIHoveredColorToken = typedArray.getString(R.styleable.UITokenEditView_strokeHoveredColorToken) ?: ""
|
||||||
strokeUIDisabledColorToken = typedArray.getString(R.styleable.UITokenEditView_strokeDisabledColorToken) ?: ""
|
strokeUIDisabledColorToken = typedArray.getString(R.styleable.UITokenEditView_strokeDisabledColorToken) ?: ""
|
||||||
|
|
||||||
|
readTokenAdvAttrs(this@run, typedArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
|
||||||
import com.remax.visualnovel.widget.uitoken.changeBackground
|
import com.remax.visualnovel.widget.uitoken.changeBackground
|
||||||
import com.remax.visualnovel.widget.uitoken.changeOutline
|
import com.remax.visualnovel.widget.uitoken.changeOutline
|
||||||
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
||||||
|
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by HJW on 2022/8/31
|
* Created by HJW on 2022/8/31
|
||||||
|
|
@ -43,6 +44,8 @@ open class UITokenFrameLayout @JvmOverloads constructor(context: Context, attrs:
|
||||||
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_yClickExpend, 0)
|
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_yClickExpend, 0)
|
||||||
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_strokeDashWidth, 0).toFloat()
|
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_strokeDashWidth, 0).toFloat()
|
||||||
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_strokeDashGap, 0).toFloat()
|
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenFrameLayout_strokeDashGap, 0).toFloat()
|
||||||
|
|
||||||
|
readTokenAdvAttrs(this@run, typedArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
|
||||||
import com.remax.visualnovel.widget.uitoken.changeBackground
|
import com.remax.visualnovel.widget.uitoken.changeBackground
|
||||||
import com.remax.visualnovel.widget.uitoken.changeOutline
|
import com.remax.visualnovel.widget.uitoken.changeOutline
|
||||||
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
||||||
|
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by HJW on 2022/8/31
|
* Created by HJW on 2022/8/31
|
||||||
|
|
@ -44,6 +45,8 @@ open class UITokenImageView @JvmOverloads constructor(context: Context, attrs: A
|
||||||
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_yClickExpend, 0)
|
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_yClickExpend, 0)
|
||||||
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_strokeDashWidth, 0).toFloat()
|
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_strokeDashWidth, 0).toFloat()
|
||||||
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_strokeDashGap, 0).toFloat()
|
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenImageView_strokeDashGap, 0).toFloat()
|
||||||
|
|
||||||
|
readTokenAdvAttrs(this@run, typedArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
|
||||||
import com.remax.visualnovel.widget.uitoken.changeBackground
|
import com.remax.visualnovel.widget.uitoken.changeBackground
|
||||||
import com.remax.visualnovel.widget.uitoken.changeOutline
|
import com.remax.visualnovel.widget.uitoken.changeOutline
|
||||||
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
||||||
|
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by HJW on 2022/8/31
|
* Created by HJW on 2022/8/31
|
||||||
|
|
@ -43,6 +44,8 @@ open class UITokenLinearLayout @JvmOverloads constructor(context: Context, attrs
|
||||||
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_yClickExpend, 0)
|
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_yClickExpend, 0)
|
||||||
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_strokeDashWidth, 0).toFloat()
|
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_strokeDashWidth, 0).toFloat()
|
||||||
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_strokeDashGap, 0).toFloat()
|
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenLinearLayout_strokeDashGap, 0).toFloat()
|
||||||
|
|
||||||
|
readTokenAdvAttrs(this@run, typedArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import com.remax.visualnovel.widget.uitoken.bean.CustomViewToken
|
||||||
import com.remax.visualnovel.widget.uitoken.changeBackground
|
import com.remax.visualnovel.widget.uitoken.changeBackground
|
||||||
import com.remax.visualnovel.widget.uitoken.changeOutline
|
import com.remax.visualnovel.widget.uitoken.changeOutline
|
||||||
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
||||||
|
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by HJW on 2022/8/31
|
* Created by HJW on 2022/8/31
|
||||||
|
|
@ -43,6 +44,8 @@ class UITokenRelativeLayout @JvmOverloads constructor(context: Context, attrs: A
|
||||||
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_yClickExpend, 0)
|
yClickExpend = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_yClickExpend, 0)
|
||||||
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_strokeDashWidth, 0).toFloat()
|
strokeDashWidth = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_strokeDashWidth, 0).toFloat()
|
||||||
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_strokeDashGap, 0).toFloat()
|
strokeDashGap = typedArray.getDimensionPixelOffset(R.styleable.UITokenRelativeLayout_strokeDashGap, 0).toFloat()
|
||||||
|
|
||||||
|
readTokenAdvAttrs(this@run, typedArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
typedArray.recycle()
|
typedArray.recycle()
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import com.remax.visualnovel.widget.uitoken.changeTextColor
|
||||||
import com.remax.visualnovel.widget.uitoken.changeTextFont
|
import com.remax.visualnovel.widget.uitoken.changeTextFont
|
||||||
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
import com.remax.visualnovel.widget.uitoken.expend.dsl.expand
|
||||||
import androidx.core.content.withStyledAttributes
|
import androidx.core.content.withStyledAttributes
|
||||||
|
import com.remax.visualnovel.widget.uitoken.readTokenAdvAttrs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by HJW on 2022/8/31
|
* Created by HJW on 2022/8/31
|
||||||
|
|
@ -79,15 +80,7 @@ open class UITokenTextView @JvmOverloads constructor(context: Context, private v
|
||||||
fixTextIsSelectable = getBoolean(R.styleable.UITokenTextView_fixTextIsSelectable, fixTextIsSelectable)
|
fixTextIsSelectable = getBoolean(R.styleable.UITokenTextView_fixTextIsSelectable, fixTextIsSelectable)
|
||||||
|
|
||||||
|
|
||||||
//<!-- new added 2025.10.29 -->
|
readTokenAdvAttrs(this@run, this@withStyledAttributes)
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -160,4 +153,4 @@ open class UITokenTextView @JvmOverloads constructor(context: Context, private v
|
||||||
override fun getUITokenView(): CustomViewToken {
|
override fun getUITokenView(): CustomViewToken {
|
||||||
return customViewToken
|
return customViewToken
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue