-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Feat: DragRefresh * Feat: Improved demo * Add demo gifs * Update README.md * Bump version
- Loading branch information
Showing
16 changed files
with
452 additions
and
64 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
35 changes: 35 additions & 0 deletions
35
demo/src/main/java/dev/materii/pullrefresh/demo/sample/DragRefreshSample.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,35 @@ | ||
package dev.materii.pullrefresh.demo.sample | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import dev.materii.pullrefresh.DragRefreshLayout | ||
import dev.materii.pullrefresh.PullRefreshState | ||
|
||
@Composable | ||
fun DragRefreshSample( | ||
flipped: Boolean, | ||
pullRefreshState: PullRefreshState, | ||
modifier: Modifier = Modifier | ||
) { | ||
DragRefreshLayout( | ||
state = pullRefreshState, | ||
flipped = flipped, | ||
modifier = modifier | ||
.fillMaxSize() | ||
) { | ||
Box( | ||
contentAlignment = Alignment.Center, | ||
modifier = modifier | ||
.fillMaxSize() | ||
.verticalScroll(rememberScrollState()) | ||
) { | ||
Text(text = "Pull ${if (flipped) "up" else "down"} to refresh") | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
demo/src/main/java/dev/materii/pullrefresh/demo/sample/PullRefreshSample.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,44 @@ | ||
package dev.materii.pullrefresh.demo.sample | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.rememberScrollState | ||
import androidx.compose.foundation.verticalScroll | ||
import androidx.compose.material3.MaterialTheme | ||
import androidx.compose.material3.Text | ||
import androidx.compose.material3.surfaceColorAtElevation | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import dev.materii.pullrefresh.PullRefreshIndicator | ||
import dev.materii.pullrefresh.PullRefreshState | ||
|
||
@Composable | ||
fun PullRefreshSample( | ||
flipped: Boolean, | ||
pullRefreshState: PullRefreshState, | ||
isRefreshing: Boolean, | ||
modifier: Modifier = Modifier | ||
) { | ||
Box( | ||
contentAlignment = Alignment.Center, | ||
modifier = modifier | ||
.fillMaxSize() | ||
.verticalScroll(rememberScrollState()) | ||
) { | ||
Text(text = "Pull ${if (flipped) "up" else "down"} to refresh") | ||
|
||
PullRefreshIndicator( | ||
refreshing = isRefreshing, | ||
state = pullRefreshState, | ||
flipped = flipped, | ||
backgroundColor = MaterialTheme.colorScheme.surfaceColorAtElevation(3.dp), | ||
contentColor = MaterialTheme.colorScheme.primary, | ||
modifier = Modifier | ||
.align( | ||
if (flipped) Alignment.BottomCenter else Alignment.TopCenter | ||
) | ||
) | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
demo/src/main/java/dev/materii/pullrefresh/demo/theme/Color.kt
This file was deleted.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
pullrefresh/src/commonMain/kotlin/dev/materii/pullrefresh/Constants.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,15 @@ | ||
package dev.materii.pullrefresh | ||
|
||
import androidx.compose.foundation.shape.CircleShape | ||
import androidx.compose.ui.unit.dp | ||
|
||
internal const val CrossfadeDurationMs = 100 | ||
internal const val MaxProgressArc = 0.8f | ||
|
||
internal val IndicatorSize = 40.dp | ||
internal val SpinnerShape = CircleShape | ||
internal val ArcRadius = 7.5.dp | ||
internal val StrokeWidth = 2.5.dp | ||
internal val ArrowWidth = 10.dp | ||
internal val ArrowHeight = 5.dp | ||
internal val Elevation = 6.dp |
Oops, something went wrong.