diff --git a/buildSrc/src/main/kotlin/ComponentVersions.kt b/buildSrc/src/main/kotlin/ComponentVersions.kt
index fafb0857..adc14b07 100644
--- a/buildSrc/src/main/kotlin/ComponentVersions.kt
+++ b/buildSrc/src/main/kotlin/ComponentVersions.kt
@@ -8,7 +8,7 @@ object ComponentVersions {
const val dialogsVersion = "1.4.0"
const val cardInputViewVersion = "1.2.2"
const val quantityPickerViewVersion = "1.2.5"
- const val timelineViewVersion = "1.0.0"
+ const val timelineViewVersion = "1.0.1"
const val touchDelegatorVersion = "1.0.0"
const val fitOptionMessageView = "1.0.0"
}
diff --git a/libraries/timeline-view/README.md b/libraries/timeline-view/README.md
index 2d4fdb54..58701e27 100644
--- a/libraries/timeline-view/README.md
+++ b/libraries/timeline-view/README.md
@@ -1,6 +1,6 @@
-timelineViewVersion = timeline-view-1.0.0 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
+timelineViewVersion = timeline-view-1.0.1 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
## TimelineView
TimelineView creates a timeline and shows actions over time
@@ -42,6 +42,7 @@ To set width you can use `android:layout_width` attribute. To customize more you
| setBorderWidth | borderWidth: Float | To set borderWidth programmatically |
| setTextSize | textSize: Float | To set setTextSize programmatically |
| setLineWidth | lineWidth: Float | To set setLineWidth programmatically |
+| setMaxLineCount | maxLineCount: Int | To set setMaxLineCount programmatically |
# Contributors
diff --git a/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineItemViewState.kt b/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineItemViewState.kt
index e8b24147..b21d51da 100644
--- a/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineItemViewState.kt
+++ b/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineItemViewState.kt
@@ -9,7 +9,8 @@ class TimelineItemViewState(
val borderWidth: Float,
val textSize: Float,
val lineWidth: Float,
- val fontFamily: String
+ val fontFamily: String,
+ val maxLineCount: Int
) {
fun getOutsideColor(): Int = Color.parseColor(timelineItem.outsideColor)
@@ -40,6 +41,8 @@ class TimelineItemViewState(
fun getItemWidth(): Float =
dotSize + borderWidth + lineWidth
+ fun getItemMaxLineCount(): Int = maxLineCount
+
companion object {
private const val hexColorWhite = "#000000"
}
diff --git a/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineView.kt b/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineView.kt
index 6ed28b57..925f2cd4 100644
--- a/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineView.kt
+++ b/libraries/timeline-view/src/main/java/com/trendyol/timelineview/TimelineView.kt
@@ -41,6 +41,8 @@ class TimelineView : ConstraintLayout {
private var fontFamily: String = ""
+ private var maxLineCount: Int = 2
+
private val binding: ViewTimelineBinding = inflate(R.layout.view_timeline)
private var timelineOrientation: TimelineOrientation = TimelineOrientation.HORIZONTAL
@@ -119,6 +121,10 @@ class TimelineView : ConstraintLayout {
this.timelineOrientation = timelineOrientation
}
+ fun setMaxLineCount(maxLineCount: Int?) {
+ this.maxLineCount = maxLineCount ?: 2
+ }
+
fun setItems(items: List?) {
binding.viewState = TimelineViewState(
timelineOrientation = timelineOrientation,
@@ -163,7 +169,8 @@ class TimelineView : ConstraintLayout {
borderWidth = borderWidth,
textSize = textSize,
lineWidth = lineWidth,
- fontFamily = fontFamily
+ fontFamily = fontFamily,
+ maxLineCount = maxLineCount
)
} ?: emptyList()
}
diff --git a/libraries/timeline-view/src/main/res/layout/item_timeline.xml b/libraries/timeline-view/src/main/res/layout/item_timeline.xml
index 7f20d575..c9316aee 100644
--- a/libraries/timeline-view/src/main/res/layout/item_timeline.xml
+++ b/libraries/timeline-view/src/main/res/layout/item_timeline.xml
@@ -100,7 +100,7 @@
android:layout_marginTop="4dp"
android:ellipsize="end"
android:gravity="center"
- android:maxLines="2"
+ android:maxLines="@{itemViewState.getItemMaxLineCount()}"
android:text="@{itemViewState.getText()}"
android:textColor="@{itemViewState.getTextColor()}"
android:textSize="@{itemViewState.textSize}"