diff --git a/README.md b/README.md
index 4aeb5b2..e93d3a2 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ dependencies {
android:maxLines="10"
app:expandAction="More"
app:limitedMaxLines="2"
- app:expandActionColor="@color/blue_500"
+ app:actionColor="@color/blue_500"
app:originalText="@string/long_text" />
```
@@ -72,7 +72,7 @@ dependencies {
|:---------------------:|:------:|:-----------------------------------------------------------:|:-------------------------------------------------------:|
| app:limitedMaxLines | Int | The maximum line counts when the text is collapsed | 3 |
| app:expandAction | String | The action at the end of truncated text such as "View more" | "" (Nothing will be shown at the end of truncated text) |
-| app:expandActionColor | Color | The color of expand action | #ffaa66cc |
+| app:actionColor | Color | The color of expand/collapse action | #ffaa66cc |
| app:originalText | String | The text to be displayed on this text view | "" |
#### Public functions
@@ -80,7 +80,7 @@ dependencies {
- `limitedMaxLines` public getter & setter for the maximum line counts when the text is collapsed.
- `expandAction` public getter & setter for the action at the end of truncated text such as "View
more".
-- `expandActionColor` public getter & setter for the color of expand action.
+- `actionColor` public getter & setter for the color of expand/collapse action.
- `originalText` public getter & setter for the text to be displayed on this text view.
- `collapsed` public getter to determine if the text is being collapsed
- `expanded` public getter to determine if the text is being expanded
@@ -108,7 +108,7 @@ ExpandableText(
originalText = "a very long text that will be truncated at some points",
expandAction = "See more",
expand = expand,
- expandActionColor = Color.Blue,
+ actionColor = Color.Blue,
limitedMaxLines = 2,
animationSpec = spring(),
modifier = Modifier
diff --git a/app/src/main/java/io/github/giangpham96/app/MainActivity.kt b/app/src/main/java/io/github/giangpham96/app/MainActivity.kt
index c5a30c3..35152bc 100644
--- a/app/src/main/java/io/github/giangpham96/app/MainActivity.kt
+++ b/app/src/main/java/io/github/giangpham96/app/MainActivity.kt
@@ -61,7 +61,7 @@ class MainActivity : AppCompatActivity() {
btnExpandCtaColor.setOnClickListener {
val ctaColorSet =
setOf(Color.WHITE, Color.BLACK, Color.BLUE, Color.CYAN, Color.MAGENTA, Color.RED, Color.DKGRAY)
- tvDynamic.expandActionColor = ctaColorSet.random()
+ tvDynamic.actionColor = ctaColorSet.random()
}
btnMaxLines.setOnClickListener {
tvDynamic.maxLines = Random.nextInt(7, 20)
@@ -120,7 +120,7 @@ class MainActivity : AppCompatActivity() {
originalText = stringResource(id = R.string.long_text),
expandAction = "See more",
expand = expand,
- expandActionColor = androidx.compose.ui.graphics.Color.Blue,
+ actionColor = androidx.compose.ui.graphics.Color.Blue,
)
}
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 246a3fd..c1a51cb 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -43,7 +43,26 @@
android:background="@color/purple_100"
android:padding="16dp"
app:expandAction="More"
- app:expandActionColor="@color/blue_500"
+ app:actionColor="@color/blue_500"
+ app:originalText="@string/long_text" />
+
+
+
this@addLessMoreSpan
+ else -> return SpannableStringBuilder(this)
+ .append(collapseActionSpannable)
+ }
+ }
+
}
diff --git a/expandable_textview/src/main/res/values/attrs.xml b/expandable_textview/src/main/res/values/attrs.xml
index 0573ac7..208effa 100644
--- a/expandable_textview/src/main/res/values/attrs.xml
+++ b/expandable_textview/src/main/res/values/attrs.xml
@@ -4,7 +4,8 @@
-
+
+