@@ -13,11 +13,8 @@ import android.text.style.*
13
13
import android.text.util.Linkify
14
14
import android.util.AttributeSet
15
15
import android.util.LayoutDirection
16
- import android.util.TypedValue
17
16
import android.view.View
18
17
import androidx.annotation.StringRes
19
- import androidx.appcompat.widget.AppCompatTextView
20
- import com.flyjingfish.FormatTexttextview.FormatText
21
18
import java.lang.NullPointerException
22
19
import androidx.core.text.TextUtilsCompat
23
20
import java.util.*
@@ -137,20 +134,20 @@ class FormatTextView : BaseTextView {
137
134
} else {
138
135
false
139
136
}
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)
142
139
var marginLeft = if (isRtl) formatImage.marginEnd else formatImage.marginStart
143
140
var marginRight = if (isRtl) formatImage.marginStart else formatImage.marginEnd
144
141
marginLeft = if (marginLeft == 0f ){
145
- Utils . dp2px(context, formatImage.marginLeft)
142
+ dp2px(context, formatImage.marginLeft)
146
143
}else {
147
- Utils . dp2px(context, marginLeft)
144
+ dp2px(context, marginLeft)
148
145
}
149
146
150
147
marginRight = if (marginRight == 0f ){
151
- Utils . dp2px(context, formatImage.marginRight)
148
+ dp2px(context, formatImage.marginRight)
152
149
}else {
153
- Utils . dp2px(context, marginRight)
150
+ dp2px(context, marginRight)
154
151
}
155
152
156
153
val start = htmlBuilder.getSpanStart(urlSpan)
@@ -268,15 +265,15 @@ class FormatTextView : BaseTextView {
268
265
}
269
266
if (underline && (formatText.underlineColor != 0 || formatText.underlineMarginTop != 0f || formatText.underlineWidth != 0f )) {
270
267
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()
272
269
val fm = textPaint.fontMetrics
273
270
274
271
val underLineText = LineText (
275
272
start,
276
273
end,
277
274
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(
280
277
context,
281
278
formatText.underlineWidth
282
279
)
@@ -287,15 +284,15 @@ class FormatTextView : BaseTextView {
287
284
var userDefaultDelete = true
288
285
if (deleteLine && (formatText.deleteLineColor != 0 || formatText.deleteLineWidth != 0f )) {
289
286
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()
291
288
val fm = textPaint.fontMetrics
292
289
293
290
val deleteLineText = LineText (
294
291
start,
295
292
end,
296
293
if (formatText.deleteLineColor != 0 ) resources.getColor(formatText.deleteLineColor) else textColor,
297
294
(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(
299
296
context,
300
297
formatText.deleteLineWidth
301
298
)
@@ -321,7 +318,7 @@ class FormatTextView : BaseTextView {
321
318
if (textSize > 0 ) {
322
319
htmlBuilder.setSpan(
323
320
AbsoluteSizeSpan (
324
- Utils . sp2px(context, textSize).toInt(),
321
+ sp2px(context, textSize).toInt(),
325
322
false
326
323
), start, end, flags
327
324
)
0 commit comments