Skip to content

Commit 1b5acd5

Browse files
committed
1,修改基础类
1 parent 9116f97 commit 1b5acd5

File tree

9 files changed

+29
-49
lines changed

9 files changed

+29
-49
lines changed

FormatTextView/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

FormatTextView/build.gradle

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,18 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
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+
1815
dependencies {
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
}

FormatTextView/consumer-rules.pro

Whitespace-only changes.

FormatTextView/proguard-rules.pro

Lines changed: 0 additions & 21 deletions
This file was deleted.

FormatTextView/src/main/java/com/flyjingfish/formattextview/BaseTextView.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import android.graphics.Paint
66
import android.graphics.drawable.Drawable
77
import android.text.style.ImageSpan
88
import 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

FormatTextView/src/main/java/com/flyjingfish/formattextview/FormatTextView.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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()

FormatTextView/src/main/java/com/flyjingfish/formattextview/HtmlTextView.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff 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

app/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ apply plugin: 'kotlin-android'
33
apply plugin: 'kotlin-android-extensions'
44

55
android {
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

build.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff 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 {
1718
allprojects {
1819
repositories {
1920
google()
20-
jcenter()
21+
mavenCentral()
22+
maven { url 'https://jitpack.io' }
2123
}
2224
}
2325

2426
task clean(type: Delete) {
2527
delete rootProject.buildDir
28+
}
29+
30+
ext {
31+
sdkVersion = 30
32+
minSdkVersion = 17
2633
}

0 commit comments

Comments
 (0)