Skip to content

Commit

Permalink
Changes:
Browse files Browse the repository at this point in the history
- 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
arutemu committed May 2, 2024
1 parent 93174c3 commit 998d01c
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 163 deletions.
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ dependencies {
def lifecycle_version = "2.7.0"
def accompanist = "0.35.0-alpha"

implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.7.0'

implementation 'androidx.activity:activity-compose:1.8.2'
implementation 'androidx.activity:activity-compose:1.9.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"

// ViewModel
Expand Down Expand Up @@ -90,7 +90,7 @@ dependencies {
// palette
implementation 'androidx.palette:palette-ktx:1.0.0'

implementation platform('androidx.compose:compose-bom:2024.03.00')
implementation platform('androidx.compose:compose-bom:2024.05.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
Expand All @@ -103,7 +103,7 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation platform('androidx.compose:compose-bom:2024.03.00')
androidTestImplementation platform('androidx.compose:compose-bom:2024.05.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'
Expand Down
59 changes: 39 additions & 20 deletions app/src/main/java/com/mukuro/pedalboard/ui/PedalboardApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,8 @@ private fun PedalboardNavigationWrapper(
navigateToDetail: (Long, PedalboardContentType) -> Unit,
toggleSelectedPlugin: (Long) -> Unit
) {
val drawerState = rememberDrawerState(initialValue = DrawerValue.Open) //Closed) // TODO - dont forget to change back! <<<
val drawerState = rememberDrawerState(initialValue = DrawerValue.Closed)
val scope = rememberCoroutineScope()
//val isNavigationRailVisible = remember { mutableStateOf(true) }

val navController = rememberNavController()
val navigationActions = remember(navController) {
Expand All @@ -189,29 +188,49 @@ private fun PedalboardNavigationWrapper(
val navBackStackEntry by navController.currentBackStackEntryAsState()
val selectedDestination = navBackStackEntry?.destination?.route ?: PedalboardRoute.QUICK

lateinit var mainTitle : String
lateinit var subTitle : String

// TODO - move NavRail here
/* PedalboardNavigationRail(
selectedDestination = selectedDestination,
navigationContentPosition = navigationContentPosition,
navigateToTopLevelDestination = navigateToTopLevelDestination,
onDrawerClicked = onDrawerClicked
)*/

when (selectedDestination) {
PedalboardRoute.QUICK -> {
mainTitle = "Pedalboard";
subTitle = "On-board plugins"
}
PedalboardRoute.EFFECTS -> {
mainTitle = "Library";
subTitle = "Available plugins"
}
PedalboardRoute.PRESETS -> {
mainTitle = "Presets";
subTitle = "Ready-to-go plugin presets"
}
PedalboardRoute.RECORDED -> {
mainTitle = "Records";
subTitle = "All recorder audios"
}
PedalboardRoute.DRUMS -> {
mainTitle = "Drums";
subTitle = "Backing tracks"
}
}

Column(modifier = Modifier){
PedalboardTopBar(onDrawerClicked = {
if (drawerState.isOpen) {
scope.launch {
drawerState.close()
PedalboardTopBar(
onDrawerClicked = {
if (drawerState.isOpen) {
scope.launch {
drawerState.close()
}
}
}
else {
scope.launch {
drawerState.open()
else {
scope.launch {
drawerState.open()
}
}
}
})
},
mainTitle = mainTitle,
subtitle = subTitle
)

Box(modifier = Modifier) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ fun PluginDetailAppBar(
@Composable
fun PedalboardTopBar(
modifier: Modifier = Modifier,
mainTitle: String = "Pedalboard",
subtitle: String = "On-board plugins",
onDrawerClicked: () -> Unit = {} //onBackPressed: () -> Unit
) {
TopAppBar(
Expand All @@ -173,13 +175,13 @@ fun PedalboardTopBar(
) {
// TODO - add dynamic titles for each app page (dunno how yet tho)
Text(
text = "Pedal board",
text = mainTitle,//"Pedal board",
style = MaterialTheme.typography.titleLarge,
color = MaterialTheme.colorScheme.onSurfaceVariant
)
Text(
modifier = Modifier.padding(top = 4.dp),
text = "On-board plugins",
text = subtitle,//"On-board plugins",
style = MaterialTheme.typography.labelMedium,
color = MaterialTheme.colorScheme.outline
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ fun PedalboardPluginCard(
//.clip(CircleShape)
//.background(MaterialTheme.colorScheme.surface)
) {
val tint by animateColorAsState(if (turnedOn) Color(0xff8cff78) else Color(0xFFEC407A), label = "ON State")
val tint by animateColorAsState(if (turnedOn) Color(0xFF5EC281) else Color(0xffc25e66), label = "ON State")
Icon(
imageVector = Icons.Default.RadioButtonChecked,
contentDescription = "Move vertically",
Expand Down
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)
}
Loading

0 comments on commit 998d01c

Please sign in to comment.