File tree Expand file tree Collapse file tree 9 files changed +29
-49
lines changed
src/main/java/com/flyjingfish/formattextview Expand file tree Collapse file tree 9 files changed +29
-49
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -3,22 +3,18 @@ apply plugin: 'kotlin-android'
33apply plugin : ' kotlin-android-extensions'
44
55android {
6- compileSdkVersion 30
7- buildToolsVersion ' 30.0.2'
6+ compileSdkVersion rootProject. ext. sdkVersion
87
98 defaultConfig {
10- minSdkVersion 14
11- targetSdkVersion 30
12- versionCode 1
13- versionName " 1.0"
9+ minSdkVersion rootProject. ext. minSdkVersion
10+ targetSdkVersion rootProject. ext. sdkVersion
1411 }
15-
1612}
1713
14+
1815dependencies {
19- implementation fileTree(dir : " libs" , include : [" *.jar" ])
2016 implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
2117 implementation ' androidx.core:core-ktx:1.1.0'
2218 implementation ' androidx.appcompat:appcompat:1.1.0'
23-
19+ api ' com.github.FlyJingFish:PerfectTextView:1.1.8 '
2420}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -6,12 +6,12 @@ import android.graphics.Paint
66import android.graphics.drawable.Drawable
77import android.text.style.ImageSpan
88import android.util.AttributeSet
9- import androidx.appcompat.widget.AppCompatTextView
9+ import com.flyjingfish.perfecttextviewlib.PerfectTextView
1010
11- open class BaseTextView : AppCompatTextView {
12- constructor (context: Context ? ) : super (context)
13- constructor (context: Context ? , attrs: AttributeSet ? ) : super (context, attrs)
14- constructor (context: Context ? , attrs: AttributeSet ? , defStyleAttr: Int ) : super (
11+ open class BaseTextView : PerfectTextView {
12+ constructor (context: Context ) : super (context)
13+ constructor (context: Context , attrs: AttributeSet ? ) : super (context, attrs)
14+ constructor (context: Context , attrs: AttributeSet ? , defStyleAttr: Int ) : super (
1515 context,
1616 attrs,
1717 defStyleAttr
Original file line number Diff line number Diff line change @@ -28,9 +28,9 @@ class FormatTextView : BaseTextView {
2828 private val underLineTexts: ArrayList <LineText > = ArrayList ()
2929 private val deleteLineTexts: ArrayList <LineText > = ArrayList ()
3030
31- constructor (context: Context ? ) : super (context)
32- constructor (context: Context ? , attrs: AttributeSet ? ) : super (context, attrs)
33- constructor (context: Context ? , attrs: AttributeSet ? , defStyleAttr: Int ) : super (
31+ constructor (context: Context ) : super (context)
32+ constructor (context: Context , attrs: AttributeSet ? ) : super (context, attrs)
33+ constructor (context: Context , attrs: AttributeSet ? , defStyleAttr: Int ) : super (
3434 context,
3535 attrs,
3636 defStyleAttr
@@ -479,7 +479,7 @@ class FormatTextView : BaseTextView {
479479
480480 val underLineText = underLineTexts[underLineTexts.size - 1 ]
481481 val line = layout.getLineForOffset(underLineText.end - 1 )
482- if (measuredHeight - paddingTop - paddingBottom == layout.height && line == lineCount - 1 ) {
482+ if (line == lineCount - 1 && measuredHeight - compoundPaddingTop - compoundPaddingBottom <= layout.height ) {
483483 setMeasuredDimension(
484484 measuredWidth,
485485 measuredHeight + underLineText.lineTop.toInt() + underLineText.lineWidth.toInt()
Original file line number Diff line number Diff line change @@ -20,9 +20,9 @@ class HtmlTextView : BaseTextView {
2020 private var onInflateImageListener: OnInflateImageListener ? = null
2121 private var isClickSpanItem = false
2222
23- constructor (context: Context ? ) : super (context)
24- constructor (context: Context ? , attrs: AttributeSet ? ) : super (context, attrs)
25- constructor (context: Context ? , attrs: AttributeSet ? , defStyleAttr: Int ) : super (
23+ constructor (context: Context ) : super (context)
24+ constructor (context: Context , attrs: AttributeSet ? ) : super (context, attrs)
25+ constructor (context: Context , attrs: AttributeSet ? , defStyleAttr: Int ) : super (
2626 context,
2727 attrs,
2828 defStyleAttr
Original file line number Diff line number Diff line change @@ -3,13 +3,12 @@ apply plugin: 'kotlin-android'
33apply plugin : ' kotlin-android-extensions'
44
55android {
6- compileSdkVersion 31
7- buildToolsVersion ' 30.0.2'
6+ compileSdkVersion rootProject. ext. sdkVersion
87
98 defaultConfig {
109 applicationId " com.flyjingfish.formattextviewdemo"
11- minSdkVersion 14
12- targetSdkVersion 31
10+ minSdkVersion 17
11+ targetSdkVersion rootProject . ext . sdkVersion
1312 versionCode 1
1413 versionName " 1.0"
1514
Original file line number Diff line number Diff line change @@ -3,7 +3,8 @@ buildscript {
33 ext. kotlin_version = " 1.4.21"
44 repositories {
55 google()
6- jcenter()
6+ mavenCentral()
7+ maven { url ' https://jitpack.io' }
78 }
89 dependencies {
910 classpath " com.android.tools.build:gradle:4.0.0"
@@ -17,10 +18,16 @@ buildscript {
1718allprojects {
1819 repositories {
1920 google()
20- jcenter()
21+ mavenCentral()
22+ maven { url ' https://jitpack.io' }
2123 }
2224}
2325
2426task clean (type : Delete ) {
2527 delete rootProject. buildDir
28+ }
29+
30+ ext {
31+ sdkVersion = 30
32+ minSdkVersion = 17
2633}
You can’t perform that action at this time.
0 commit comments