@@ -13,11 +13,8 @@ import android.text.style.*
1313import android.text.util.Linkify
1414import android.util.AttributeSet
1515import android.util.LayoutDirection
16- import android.util.TypedValue
1716import android.view.View
1817import androidx.annotation.StringRes
19- import androidx.appcompat.widget.AppCompatTextView
20- import com.flyjingfish.FormatTexttextview.FormatText
2118import java.lang.NullPointerException
2219import androidx.core.text.TextUtilsCompat
2320import java.util.*
@@ -137,20 +134,20 @@ class FormatTextView : BaseTextView {
137134 } else {
138135 false
139136 }
140- val imageWidth = Utils . dp2px(context, formatImage.width)
141- val imageHeight = Utils . dp2px(context, formatImage.height)
137+ val imageWidth = dp2px(context, formatImage.width)
138+ val imageHeight = dp2px(context, formatImage.height)
142139 var marginLeft = if (isRtl) formatImage.marginEnd else formatImage.marginStart
143140 var marginRight = if (isRtl) formatImage.marginStart else formatImage.marginEnd
144141 marginLeft = if (marginLeft == 0f ){
145- Utils . dp2px(context, formatImage.marginLeft)
142+ dp2px(context, formatImage.marginLeft)
146143 }else {
147- Utils . dp2px(context, marginLeft)
144+ dp2px(context, marginLeft)
148145 }
149146
150147 marginRight = if (marginRight == 0f ){
151- Utils . dp2px(context, formatImage.marginRight)
148+ dp2px(context, formatImage.marginRight)
152149 }else {
153- Utils . dp2px(context, marginRight)
150+ dp2px(context, marginRight)
154151 }
155152
156153 val start = htmlBuilder.getSpanStart(urlSpan)
@@ -268,15 +265,15 @@ class FormatTextView : BaseTextView {
268265 }
269266 if (underline && (formatText.underlineColor != 0 || formatText.underlineMarginTop != 0f || formatText.underlineWidth != 0f )) {
270267 val textPaint = TextPaint ()
271- textPaint.textSize = if (textSize > 0 ) Utils . sp2px(context, textSize) else getTextSize()
268+ textPaint.textSize = if (textSize > 0 ) sp2px(context, textSize) else getTextSize()
272269 val fm = textPaint.fontMetrics
273270
274271 val underLineText = LineText (
275272 start,
276273 end,
277274 if (formatText.underlineColor != 0 ) resources.getColor(formatText.underlineColor) else textColor,
278- Utils . dp2px(context, formatText.underlineMarginTop) + fm.descent / 3 ,
279- if (formatText.underlineWidth == 0f ) Utils . dp2px(context, 1f ) else Utils . dp2px(
275+ dp2px(context, formatText.underlineMarginTop) + fm.descent / 3 ,
276+ if (formatText.underlineWidth == 0f ) dp2px(context, 1f ) else dp2px(
280277 context,
281278 formatText.underlineWidth
282279 )
@@ -287,15 +284,15 @@ class FormatTextView : BaseTextView {
287284 var userDefaultDelete = true
288285 if (deleteLine && (formatText.deleteLineColor != 0 || formatText.deleteLineWidth != 0f )) {
289286 val textPaint = TextPaint ()
290- textPaint.textSize = if (textSize > 0 ) Utils . sp2px(context, textSize) else getTextSize()
287+ textPaint.textSize = if (textSize > 0 ) sp2px(context, textSize) else getTextSize()
291288 val fm = textPaint.fontMetrics
292289
293290 val deleteLineText = LineText (
294291 start,
295292 end,
296293 if (formatText.deleteLineColor != 0 ) resources.getColor(formatText.deleteLineColor) else textColor,
297294 (fm.descent - fm.ascent) / 2 - fm.descent,
298- if (formatText.deleteLineWidth == 0f ) Utils . dp2px(context, 1f ) else Utils . dp2px(
295+ if (formatText.deleteLineWidth == 0f ) dp2px(context, 1f ) else dp2px(
299296 context,
300297 formatText.deleteLineWidth
301298 )
@@ -321,7 +318,7 @@ class FormatTextView : BaseTextView {
321318 if (textSize > 0 ) {
322319 htmlBuilder.setSpan(
323320 AbsoluteSizeSpan (
324- Utils . sp2px(context, textSize).toInt(),
321+ sp2px(context, textSize).toInt(),
325322 false
326323 ), start, end, flags
327324 )
0 commit comments