Update background FloatingActionButton
This commit is contained in:
parent
13154d6acd
commit
e91bc7d08e
1 changed files with 71 additions and 85 deletions
|
|
@ -22,21 +22,20 @@ import androidx.compose.ui.Modifier
|
|||
import androidx.compose.ui.draw.alpha
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.RectangleShape
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.input.VisualTransformation
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import mg.dot.feufaro.Platform
|
||||
import mg.dot.feufaro.getPlatform
|
||||
import mg.dot.feufaro.pdf.PrintSettings
|
||||
import mg.dot.feufaro.pdf.defaultPrintSettings
|
||||
|
|
@ -562,7 +561,7 @@ fun MainScreenWithDrawer(
|
|||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||
) {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
scope.launch {
|
||||
codeContent = sourceContent
|
||||
|
|
@ -571,22 +570,18 @@ fun MainScreenWithDrawer(
|
|||
solfaScreenModel.loadExternalFile(originalPath)
|
||||
}
|
||||
}
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Default.Undo,
|
||||
contentDescription = null,
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x20000000),
|
||||
icon = Icons.AutoMirrored.Default.Undo
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = true,
|
||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||
) {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
scope.launch {
|
||||
try {
|
||||
|
|
@ -597,33 +592,25 @@ fun MainScreenWithDrawer(
|
|||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.SaveAs,
|
||||
contentDescription = null,
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x20000000),
|
||||
icon = Icons.Filled.SaveAs
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = true,
|
||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||
) {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
sharedScreenModel.toggleEditorMode(false)
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Close,
|
||||
contentDescription = null,
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x20000000),
|
||||
icon = Icons.Default.Close
|
||||
)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
AnimatedVisibility(
|
||||
visible = isExpanded and !showMidiCtrl,
|
||||
|
|
@ -632,51 +619,41 @@ fun MainScreenWithDrawer(
|
|||
) {
|
||||
Row {
|
||||
Column {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
sharedScreenModel.descGridCount(1)
|
||||
}, modifier = Modifier.size(30.dp).alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Remove,
|
||||
contentDescription = null,
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x15000000),
|
||||
size = 30.dp,
|
||||
icon = Icons.Default.Remove
|
||||
)
|
||||
}
|
||||
}
|
||||
Column {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
sharedScreenModel.addGridCount(1)
|
||||
}, modifier = Modifier.size(30.dp).alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
Icons.Default.Add,
|
||||
contentDescription = null,
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x15000000),
|
||||
size = 30.dp,
|
||||
icon = Icons.Default.Add
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
AnimatedVisibility(
|
||||
visible = isExpanded and !showMidiCtrl,
|
||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||
) {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
sharedScreenModel.toggleQRCodeVisibility()
|
||||
sharedScreenModel.setExpandedFAB(false)
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.QrCode,
|
||||
contentDescription = "share qr",
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x15000000),
|
||||
icon = Icons.Filled.QrCode
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
AnimatedVisibility(
|
||||
|
|
@ -684,51 +661,39 @@ fun MainScreenWithDrawer(
|
|||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||
) {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
showPrintSettings = !showPrintSettings
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Filled.Print,
|
||||
contentDescription = "Imprimer",
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x15000000),
|
||||
icon = Icons.Filled.Print
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
AnimatedVisibility(
|
||||
visible = isExpanded,
|
||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||
) {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
sharedScreenModel.setMidiCtrl(!showMidiCtrl)
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (showMidiCtrl) Icons.Filled.StopCircle else Icons.Filled.PlayCircle,
|
||||
contentDescription = "Jouer",
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = Color(0x15000000),
|
||||
icon = if (showMidiCtrl) Icons.Filled.StopCircle else Icons.Filled.PlayCircle
|
||||
)
|
||||
}
|
||||
}
|
||||
if (!showMidiCtrl) {
|
||||
FloatingActionButton(
|
||||
MyFAB(
|
||||
onClick = {
|
||||
sharedScreenModel.setExpandedFAB(!isExpanded)
|
||||
refreshTrigeer++
|
||||
sharedScreenModel.loadNewSong("$midiFile")
|
||||
}, modifier = Modifier.alpha(0.45f)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = if (isExpanded) Icons.Filled.Close else Icons.Filled.Menu,
|
||||
contentDescription = "MenuFermer",
|
||||
tint = Color.Blue
|
||||
},
|
||||
containerColor = if (isExpanded) Color(0x25000000) else Color.Transparent,
|
||||
icon = if (isExpanded) Icons.Filled.Close else Icons.Filled.Menu
|
||||
)
|
||||
}
|
||||
}
|
||||
AnimatedVisibility(
|
||||
visible = showMidiCtrl,
|
||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||
|
|
@ -810,7 +775,7 @@ fun MainScreenWithDrawer(
|
|||
}
|
||||
},
|
||||
modifier = Modifier
|
||||
.size(56.dp)
|
||||
.size(55.dp)
|
||||
.alpha(0.6f)
|
||||
.background(
|
||||
color = Color.Blue,
|
||||
|
|
@ -916,6 +881,27 @@ fun MainScreenWithDrawer(
|
|||
})
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun MyFAB(
|
||||
onClick: () -> Unit,
|
||||
containerColor: Color,
|
||||
size: Dp ?= 55.dp,
|
||||
icon: ImageVector
|
||||
) {
|
||||
FloatingActionButton(
|
||||
onClick = onClick,
|
||||
modifier = Modifier.size(size!!),
|
||||
containerColor = containerColor,
|
||||
elevation = FloatingActionButtonDefaults.elevation(0.dp, 0.dp, 0.dp, 0.dp)
|
||||
) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = null,
|
||||
tint = Color.Blue.copy(alpha = 0.75f)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
val LocalFullscreenController = staticCompositionLocalOf<(Boolean) -> Unit> {
|
||||
{ _ -> }
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue