-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- added a second dynamic and screen-specific FAB (WIP) - added dynamic title on the TopBar - cleaned up/messed up code here and there - updated dependencies - upgraded AGP
- Loading branch information
Showing
8 changed files
with
207 additions
and
163 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
63 changes: 63 additions & 0 deletions
63
app/src/main/java/com/mukuro/pedalboard/ui/components/PedalboardUIElements.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,63 @@ | ||
package com.mukuro.pedalboard.ui.components | ||
|
||
import androidx.compose.animation.core.Easing | ||
import androidx.compose.animation.core.LinearEasing | ||
import androidx.compose.animation.core.RepeatMode | ||
import androidx.compose.animation.core.animateFloat | ||
import androidx.compose.animation.core.infiniteRepeatable | ||
import androidx.compose.animation.core.rememberInfiniteTransition | ||
import androidx.compose.animation.core.tween | ||
import androidx.compose.foundation.background | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.draw.clip | ||
import androidx.compose.ui.draw.drawWithContent | ||
import androidx.compose.ui.graphics.BlendMode | ||
import androidx.compose.ui.graphics.Brush | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.RectangleShape | ||
import androidx.compose.ui.graphics.Shape | ||
import androidx.compose.ui.graphics.drawscope.rotate | ||
import androidx.compose.ui.unit.Dp | ||
import androidx.compose.ui.unit.dp | ||
|
||
class PedalboardUIElements { | ||
} | ||
|
||
@Composable | ||
fun Modifier.animatedBorder( | ||
borderColors: List<Color>, | ||
//backgroundColor: Color, | ||
shape: Shape = RectangleShape, | ||
borderWidth: Dp = 1.dp, | ||
animationDurationInMillis: Int = 1000, | ||
easing: Easing = LinearEasing | ||
): Modifier { | ||
val brush = Brush.sweepGradient(borderColors) | ||
val infiniteTransition = rememberInfiniteTransition(label = "animatedBorder") | ||
val angle by infiniteTransition.animateFloat( | ||
initialValue = 0f, | ||
targetValue = 360f, | ||
animationSpec = infiniteRepeatable( | ||
animation = tween(durationMillis = animationDurationInMillis, easing = easing), | ||
repeatMode = RepeatMode.Restart | ||
), label = "angleAnimation" | ||
) | ||
|
||
return this | ||
.clip(shape) | ||
.padding(borderWidth) | ||
.drawWithContent { | ||
rotate(angle) { | ||
drawCircle( | ||
brush = brush, | ||
radius = size.width, | ||
blendMode = BlendMode.SrcIn, | ||
) | ||
} | ||
drawContent() | ||
} | ||
//.background(color = backgroundColor, shape = shape) | ||
} |
Oops, something went wrong.