Skip to content

Commit 367c02c

Browse files
committed
#
1 parent 3ad8b3f commit 367c02c

13 files changed

+41
-87
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.iml
22
.gradle
3+
.idea
34
/local.properties
45
/.idea/caches
56
/.idea/libraries

.idea/.gitignore

-3
This file was deleted.

.idea/compiler.xml

-6
This file was deleted.

.idea/gradle.xml

-20
This file was deleted.

.idea/misc.xml

-22
This file was deleted.

.idea/vcs.xml

-6
This file was deleted.

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
apply from: "$buildGradlePath/build-library-demo.gradle"
2+
apply from: "$buildGradlePath/build-demo.gradle"
33

44
dependencies {
55
implementation project(":tv")

build.gradle

+12-18
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,18 @@
22

33

44
plugins {
5-
id 'com.android.application' version '7.2.1' apply false
6-
id 'com.android.library' version '7.2.1' apply false
7-
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
8-
id 'org.jetbrains.kotlin.jvm' version '1.7.0' apply false
9-
id 'com.google.devtools.ksp' version '1.7.0-1.0.6' apply false
10-
}
5+
alias(libs.plugins.agp.application) apply false
6+
alias(libs.plugins.agp.library) apply false
117

12-
ext {
13-
versions = [
14-
sdk_compile : 32,
15-
sdk_min : 21,
16-
sdk_target : 31,
17-
sdk_build : "31.0.0",
18-
java : "1.8"
19-
]
8+
alias(libs.plugins.kotlin.android) apply false
9+
alias(libs.plugins.kotlin.jvm) apply false
10+
// alias(libs.plugins.kotlin.kapt) apply false
11+
// alias(libs.plugins.kotlin.serialization) apply false
12+
13+
// alias(libs.plugins.gradle.kotlin.dsl) apply false
14+
// alias(libs.plugins.gradle.plugin.publish) apply false
15+
// alias(libs.plugins.ksp) apply false
16+
17+
// alias(libs.plugins.booster) apply false
2018

21-
localRepoPath = cosmoRepoPath
22-
}
23-
task clean(type: Delete) {
24-
delete rootProject.buildDir
2519
}

gradle.properties

+4-1
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
1515
# Android operating system, and which are packaged with your app"s APK
1616
# https://developer.android.com/topic/libraries/support-library/androidx-rn
1717
android.useAndroidX=true
18+
# Automatically convert third-party libraries to use AndroidX
19+
android.enableJetifier=false
1820
# Kotlin code style for this project: "official" or "obsolete":
1921
kotlin.code.style=official
2022
# Enables namespacing of each library's R class so that its R class includes only the
2123
# resources declared in the library itself and none from the library's dependencies,
2224
# thereby reducing the size of the R class for that library
2325
android.nonTransitiveRClass=true
26+
android.disableAutomaticComponentCreation=true
2427

2528

2629

2730
cosmoRepoPath=https://gitee.com/ezy/repo/raw/cosmo
2831
buildGradlePath=https://gitee.com/ezy/gradle/raw/cosmo
2932

3033
LIBRARY_GROUP=me.reezy.cosmo
31-
LIBRARY_VERSION=0.7.0
34+
LIBRARY_VERSION=0.8.0
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Tue Jun 28 14:00:16 CST 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

settings.gradle

+7
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ pluginManagement {
55
mavenCentral()
66
}
77
}
8+
9+
810
dependencyResolutionManagement {
911
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
1012
repositories {
1113
maven { url cosmoRepoPath }
1214
google()
1315
mavenCentral()
1416
}
17+
versionCatalogs {
18+
libs { from files("$buildGradlePath/versions-cosmo.toml") }
19+
}
1520
}
21+
22+
1623
rootProject.name = "tv"
1724
include ':app'
1825

tv/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
apply from: "$buildGradlePath/build-library-android.gradle"
33

44
dependencies {
5-
api 'androidx.appcompat:appcompat:1.5.0'
5+
api libs.androidx.appcompat
66
}

tv/src/main/java/me/reezy/cosmo/tv/ExpandableTextView.kt

+14-8
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class ExpandableTextView @JvmOverloads constructor(context: Context, attrs: Attr
3232
mIconLess = a.getDrawable(R.styleable.ExpandableTextView_tvIconLess)?.wrap()
3333
a.recycle()
3434

35+
3536
updateExpand(mExpand)
3637
setOnClickListener {
3738
updateExpand(!mExpand)
@@ -54,16 +55,21 @@ class ExpandableTextView @JvmOverloads constructor(context: Context, attrs: Attr
5455
override fun onDraw(canvas: Canvas) {
5556
super.onDraw(canvas)
5657

57-
val icon = if (mExpand) mIconLess else mIconMore
58+
val notNeedIcon = !mExpand && mMaxLines > 0 && layout.getEllipsisCount(mMaxLines - 1) == 0
59+
60+
if (!notNeedIcon) {
61+
62+
val icon = if (mExpand) mIconLess else mIconMore
5863

59-
icon?.let {
60-
val x = width - compoundPaddingRight
61-
val y = height - compoundPaddingBottom - mIconSize
64+
icon?.let {
65+
val x = width - compoundPaddingRight
66+
val y = height - compoundPaddingBottom - mIconSize
6267

63-
val bounds = it.bounds
64-
bounds.set(x, y, x + mIconSize, y + mIconSize)
65-
it.bounds = bounds
66-
it.draw(canvas)
68+
val bounds = it.bounds
69+
bounds.set(x, y, x + mIconSize, y + mIconSize)
70+
it.bounds = bounds
71+
it.draw(canvas)
72+
}
6773
}
6874
}
6975

0 commit comments

Comments
 (0)