diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 460b26b..1fa581e 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -7,7 +7,7 @@ - + diff --git a/app/build.gradle b/app/build.gradle index 1ecf7aa..0adce90 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,12 +4,13 @@ plugins { } android { - compileSdkVersion 33 + compileSdkVersion 34 + namespace 'com.a_lab.textarc' defaultConfig { applicationId "com.a_lab.textarc" minSdkVersion 23 - targetSdkVersion 33 + targetSdkVersion 34 versionCode 1 versionName "1.0" @@ -34,10 +35,7 @@ android { dependencies { implementation project(path: ':textarc') - - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.8.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'com.google.android.material:material:1.10.0' testImplementation 'junit:junit:' androidTestImplementation 'androidx.test.ext:junit:1.1.5' diff --git a/build.gradle b/build.gradle index af5f819..cd4c30b 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' + classpath 'com.android.tools.build:gradle:8.1.4' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.10" // NOTE: Do not place your application dependencies here; they belong diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1da0eac..475124f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Fri Mar 24 22:29:14 MSK 2023 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/textarc/build.gradle b/textarc/build.gradle index c454620..fcea847 100644 --- a/textarc/build.gradle +++ b/textarc/build.gradle @@ -4,11 +4,12 @@ plugins { } android { - compileSdkVersion 33 + compileSdkVersion 34 + namespace 'com.a_lab.textarc' defaultConfig { minSdkVersion 23 - targetSdkVersion 33 + targetSdkVersion 34 versionCode 1 versionName "1.0" @@ -33,7 +34,6 @@ android { dependencies { implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.8.0' testImplementation 'junit:junit:' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' diff --git a/textarc/src/main/AndroidManifest.xml b/textarc/src/main/AndroidManifest.xml index 011bf11..a5918e6 100644 --- a/textarc/src/main/AndroidManifest.xml +++ b/textarc/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + \ No newline at end of file diff --git a/textarc/src/main/java/com/a_lab/textarc/TextArc.kt b/textarc/src/main/java/com/a_lab/textarc/TextArc.kt index f1d1fc2..9ca6ce1 100644 --- a/textarc/src/main/java/com/a_lab/textarc/TextArc.kt +++ b/textarc/src/main/java/com/a_lab/textarc/TextArc.kt @@ -3,6 +3,7 @@ package com.a_lab.textarc import android.content.Context import android.graphics.* import android.util.AttributeSet +import android.util.Log import android.view.View import androidx.core.content.res.ResourcesCompat @@ -29,6 +30,7 @@ class TextArc @JvmOverloads constructor( private var textColor = Color.WHITE private var fontFamily: Typeface? = null + private var letterSpacing: Float = 0f private val paintText = Paint(Paint.ANTI_ALIAS_FLAG) private var offset = 0 @@ -54,13 +56,11 @@ class TextArc @JvmOverloads constructor( } } + letterSpacing = typedArray.getFloat(R.styleable.TextArc_letter_spacing, letterSpacing) + typedArray.recycle(); } - override fun onAttachedToWindow() { - super.onAttachedToWindow() - - } override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { super.onMeasure(widthMeasureSpec, heightMeasureSpec) @@ -76,6 +76,7 @@ class TextArc @JvmOverloads constructor( paintText.color = textColor paintText.typeface = fontFamily paintText.textSize = textSize.toFloat() + paintText.letterSpacing = letterSpacing super.onLayout(changed, left, top, right, bottom) } @@ -151,4 +152,13 @@ class TextArc @JvmOverloads constructor( invalidate() } + /** + * Sets letter spacing. + * @param letterSpacing Letter spacing. + */ + fun setLetterSpacing(letterSpacing: Float) { + this.letterSpacing = letterSpacing + invalidate() + } + } \ No newline at end of file diff --git a/textarc/src/main/res/values/attrs.xml b/textarc/src/main/res/values/attrs.xml index c62e364..affee30 100644 --- a/textarc/src/main/res/values/attrs.xml +++ b/textarc/src/main/res/values/attrs.xml @@ -8,6 +8,7 @@ +