-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move search to fab (#1138)
* feat: add fab on series screen for search * refactor: remove search from the bottom nav * refactor: rename host screen to search * fix: hide the bottom bar on search screen * test: update tests for path to search screen * refactor: move content description to strings file * feat: hide or show the fab based on scrolling * feat: add extra padding to bottom of collection view Add extra padding so the fab cannot get stuck in the way of the +1 buttons on cards. * refactor: switch to use the expanded fab * style: ktlint fix * test: remove top level test to navigate to search
- Loading branch information
Showing
32 changed files
with
263 additions
and
165 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
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
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
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
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
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
30 changes: 30 additions & 0 deletions
30
core/compose/src/main/java/com/chesire/nekome/core/compose/LazyListStateExtensions.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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.chesire.nekome.core.compose | ||
|
||
import androidx.compose.foundation.lazy.LazyListState | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.derivedStateOf | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableIntStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
|
||
/** | ||
* Returns whether the lazy list is currently scrolling up. | ||
*/ | ||
@Composable | ||
fun LazyListState.isScrollingUp(): Boolean { | ||
var previousIndex by remember(this) { mutableIntStateOf(firstVisibleItemIndex) } | ||
var previousScrollOffset by remember(this) { mutableIntStateOf(firstVisibleItemScrollOffset) } | ||
return remember(this) { | ||
derivedStateOf { | ||
if (previousIndex != firstVisibleItemIndex) { | ||
previousIndex > firstVisibleItemIndex | ||
} else { | ||
previousScrollOffset >= firstVisibleItemScrollOffset | ||
}.also { | ||
previousIndex = firstVisibleItemIndex | ||
previousScrollOffset = firstVisibleItemScrollOffset | ||
} | ||
} | ||
}.value | ||
} |
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
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
Oops, something went wrong.