Skip to content

Instantly share code, notes, and snippets.

@shakalaca
Last active August 6, 2020 15:11
Show Gist options
  • Save shakalaca/17ec323667c5b2abca1e3ff74af195bf to your computer and use it in GitHub Desktop.
Save shakalaca/17ec323667c5b2abca1e3ff74af195bf to your computer and use it in GitHub Desktop.
diff --git a/app/src/main/java/com/example/android/codelabs/paging/ui/SearchRepositoriesViewModel.kt b/app/src/main/java/com/example/android/codelabs/paging/ui/SearchRepositoriesViewModel.kt
index 16ac44a..61d77ca 100644
--- a/app/src/main/java/com/example/android/codelabs/paging/ui/SearchRepositoriesViewModel.kt
+++ b/app/src/main/java/com/example/android/codelabs/paging/ui/SearchRepositoriesViewModel.kt
@@ -55,7 +55,11 @@ class SearchRepositoriesViewModel(private val repository: GithubRepository) : Vi
if (before == null) {
// we're at the beginning of the list
- return@insertSeparators UiModel.SeparatorItem("${after.roundedStarCount}0.000+ stars")
+ if (after.roundedStarCount >= 1) {
+ return@insertSeparators UiModel.SeparatorItem("${after.roundedStarCount}0.000+ stars")
+ } else {
+ return@insertSeparators UiModel.SeparatorItem("< 10.000+ stars")
+ }
}
// check between 2 items
if (before.roundedStarCount > after.roundedStarCount) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment