-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from farukguler/feature/image-slider
Add indicator visibility choice.
- Loading branch information
Showing
3 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 17 additions & 2 deletions
19
...s/imageslider/src/main/java/com/trendyol/uicomponents/imageslider/ImageSliderViewState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
package com.trendyol.uicomponents.imageslider | ||
|
||
import android.view.View | ||
|
||
data class ImageSliderViewState( | ||
val imageList: List<String>, | ||
var isImageDynamic: Boolean? = null, | ||
var imageHeight: Int? = null | ||
var imageHeight: Int? = null, | ||
var isIndicatorAlwaysVisible: Boolean = false | ||
) { | ||
|
||
fun isSingleImage() = imageList.size == 1 | ||
|
||
fun isSingleImageVisible() = isSingleImage() | ||
|
||
private fun isMultiImage() = imageList.size.greaterThan(1) | ||
fun isMultiImage() = imageList.size.greaterThan(1) | ||
|
||
fun getIndicatorVisibility(): Int { | ||
return if (isIndicatorAlwaysVisible) { | ||
View.VISIBLE | ||
} else { | ||
if (isMultiImage()) { | ||
View.VISIBLE | ||
} else { | ||
View.GONE | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters