This file contains hidden or 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
1. Fork their repo on Github | |
2. In your local, rename your origin remote to upstream | |
git remote rename origin upstream | |
3. Add a new origin | |
git remote add origin [email protected] | |
4. Fetch & push |
This file contains hidden or 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
suspend fun changeFloatValueOverTime( | |
initialValue: Float, | |
targetValue: Float, | |
durationMillis: Int, | |
onUpdate: (Float) -> Unit, | |
) { | |
val startTime = System.currentTimeMillis() | |
while (System.currentTimeMillis() - startTime < durationMillis) { | |
val elapsedTime = System.currentTimeMillis() - startTime | |
val fraction = elapsedTime.toFloat() / durationMillis |
This file contains hidden or 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
@Immutable | |
enum class MyPullToRefreshIndicatorState { | |
DEFAULT, // No user interaction and no refreshing | |
PULL, // User is pull the UI | |
RELEASE, // User released the pull, but did not cross the threshold to refresh | |
REFRESHING, // User crossed the threshold to refresh and released the pull | |
REFRESH_COMPLETED, // Refreshing is completed - to perform state reset | |
} | |
@Immutable |
This file contains hidden or 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
@OptIn(ExperimentalMaterialApi::class) | |
@Composable | |
fun MyPullToRefreshLayout( | |
modifier: Modifier = Modifier, | |
isRefreshing: Boolean, | |
widthFraction: Float = 0.2F, | |
animationSpeedFactor: Int = 4, | |
defaultAnimationDuration: Int = 300, | |
iconPath: (Float) -> Path, | |
onRefresh: () -> Unit, |
This file contains hidden or 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
fun generateHeartIcon(sizeFactor: Float): Path { | |
val path = Path().apply { | |
moveTo(sizeFactor * 12.5f, sizeFactor * 19.491f) | |
lineTo(sizeFactor * 9.577f, sizeFactor * 16.491f) | |
lineTo(sizeFactor * 6.677f, sizeFactor * 13.491f) | |
cubicTo(sizeFactor * 5.108f, sizeFactor * 11.833f, sizeFactor * 5.108f, sizeFactor * 9.238f, sizeFactor * 6.677f, sizeFactor * 7.58f) | |
cubicTo(sizeFactor * 7.445f, sizeFactor * 6.842f, sizeFactor * 8.485f, sizeFactor * 6.456f, sizeFactor * 9.549f, sizeFactor * 6.515f) | |
cubicTo(sizeFactor * 10.613f, sizeFactor * 6.574f, sizeFactor * 11.605f, sizeFactor * 7.072f, sizeFactor * 12.287f, sizeFactor * 7.891f) | |
lineTo(sizeFactor * 12.5f, sizeFactor * 8.1f) | |
lineTo(sizeFactor * 12.711f, sizeFactor * 7.882f) |
This file contains hidden or 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
@Composable | |
fun ScrollingTextWithMaxLinesDemo() { | |
val textMeasurer = rememberTextMeasurer() | |
val density = LocalDensity.current | |
val textHeight = with(density) { | |
textMeasurer.measure( | |
text = randomText, | |
maxLines = 10, | |
style = TextStyle(), | |
).size.height.toDp() |
This file contains hidden or 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
@Composable | |
fun VerticalAndHorizontalScrollingWithFixedHeightAndWidthTextDemo() { | |
Text( | |
text = randomText, | |
modifier = Modifier | |
.height(300.dp) | |
.width(300.dp) | |
.verticalScroll(rememberScrollState()) | |
.horizontalScroll(rememberScrollState()) | |
) |
This file contains hidden or 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
@Composable | |
fun HorizontalScrollingWithFixedWidthTextDemo() { | |
Text( | |
text = randomText, | |
modifier = Modifier | |
.width(300.dp) | |
.horizontalScroll(rememberScrollState()) | |
) | |
} |
This file contains hidden or 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
@Composable | |
fun VerticalScrollingWithFixedHeightTextDemo() { | |
Text( | |
text = randomText, | |
modifier = Modifier | |
.height(300.dp) | |
.verticalScroll(rememberScrollState()) | |
) | |
} |
This file contains hidden or 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
@Composable | |
fun VerticalAndHorizontalScrollingTextDemo() { | |
Text( | |
text = randomText, | |
modifier = Modifier | |
.verticalScroll(rememberScrollState()) | |
.horizontalScroll(rememberScrollState()) | |
) | |
} |
NewerOlder