diff --git a/.idea/caches/build_file_checksums.ser b/.idea/caches/build_file_checksums.ser index 990efe1..5a3623d 100644 Binary files a/.idea/caches/build_file_checksums.ser and b/.idea/caches/build_file_checksums.ser differ diff --git a/.idea/caches/gradle_models.ser b/.idea/caches/gradle_models.ser index c67d820..53fd55b 100644 Binary files a/.idea/caches/gradle_models.ser and b/.idea/caches/gradle_models.ser differ diff --git a/AutoFitTextViewLibrary/build.gradle b/AutoFitTextViewLibrary/build.gradle index 6294cb0..413cb76 100644 --- a/AutoFitTextViewLibrary/build.gradle +++ b/AutoFitTextViewLibrary/build.gradle @@ -37,7 +37,7 @@ android { dependencies { implementation 'androidx.appcompat:appcompat:1.0.2' - compile "androidx.core:core-ktx:1.0.1" + implementation "androidx.core:core-ktx:1.0.1" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } repositories { diff --git a/AutoFitTextViewLibrary/src/com/lb/auto_fit_textview/AutoResizeTextView.kt b/AutoFitTextViewLibrary/src/com/lb/auto_fit_textview/AutoResizeTextView.kt index 5e2801a..df5689f 100644 --- a/AutoFitTextViewLibrary/src/com/lb/auto_fit_textview/AutoResizeTextView.kt +++ b/AutoFitTextViewLibrary/src/com/lb/auto_fit_textview/AutoResizeTextView.kt @@ -69,7 +69,9 @@ class AutoResizeTextView @JvmOverloads constructor(context: Context, attrs: Attr textRect.bottom = textPaint!!.fontSpacing textRect.right = textPaint!!.measureText(text) } else { - val layout = StaticLayout(text, textPaint, widthLimit, Alignment.ALIGN_NORMAL, spacingMult, spacingAdd, true) + val layout: StaticLayout = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + StaticLayout.Builder.obtain(text, 0, text.length, textPaint!!, widthLimit).setLineSpacing(spacingAdd, spacingMult).setAlignment(Alignment.ALIGN_NORMAL).setIncludePad(true).build() + } else StaticLayout(text, textPaint, widthLimit, Alignment.ALIGN_NORMAL, spacingMult, spacingAdd, true) // return early if we have more lines if (maxLines != NO_LINE_LIMIT && layout.lineCount > maxLines) return 1 diff --git a/build.gradle b/build.gradle index 1dd0ad7..3ca9435 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.20' + ext.kotlin_version = '1.3.21' repositories { jcenter() google() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.0' + classpath 'com.android.tools.build:gradle:3.3.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong