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.draw.alpha
|
||||||
import androidx.compose.ui.focus.FocusRequester
|
import androidx.compose.ui.focus.FocusRequester
|
||||||
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.Color
|
||||||
import androidx.compose.ui.graphics.RectangleShape
|
|
||||||
import androidx.compose.ui.graphics.SolidColor
|
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.font.FontWeight
|
||||||
import androidx.compose.ui.text.input.VisualTransformation
|
import androidx.compose.ui.text.input.VisualTransformation
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import mg.dot.feufaro.Platform
|
|
||||||
import mg.dot.feufaro.getPlatform
|
import mg.dot.feufaro.getPlatform
|
||||||
import mg.dot.feufaro.pdf.PrintSettings
|
import mg.dot.feufaro.pdf.PrintSettings
|
||||||
import mg.dot.feufaro.pdf.defaultPrintSettings
|
import mg.dot.feufaro.pdf.defaultPrintSettings
|
||||||
|
|
@ -562,7 +561,7 @@ fun MainScreenWithDrawer(
|
||||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||||
) {
|
) {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
codeContent = sourceContent
|
codeContent = sourceContent
|
||||||
|
|
@ -571,14 +570,10 @@ fun MainScreenWithDrawer(
|
||||||
solfaScreenModel.loadExternalFile(originalPath)
|
solfaScreenModel.loadExternalFile(originalPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, modifier = Modifier.alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x20000000),
|
||||||
Icon(
|
icon = Icons.AutoMirrored.Default.Undo
|
||||||
imageVector = Icons.AutoMirrored.Default.Undo,
|
)
|
||||||
contentDescription = null,
|
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
|
|
@ -586,7 +581,7 @@ fun MainScreenWithDrawer(
|
||||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||||
) {
|
) {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
try {
|
try {
|
||||||
|
|
@ -597,14 +592,10 @@ fun MainScreenWithDrawer(
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, modifier = Modifier.alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x20000000),
|
||||||
Icon(
|
icon = Icons.Filled.SaveAs
|
||||||
imageVector = Icons.Filled.SaveAs,
|
)
|
||||||
contentDescription = null,
|
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
|
|
@ -612,17 +603,13 @@ fun MainScreenWithDrawer(
|
||||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||||
) {
|
) {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
sharedScreenModel.toggleEditorMode(false)
|
sharedScreenModel.toggleEditorMode(false)
|
||||||
}, modifier = Modifier.alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x20000000),
|
||||||
Icon(
|
icon = Icons.Default.Close
|
||||||
imageVector = Icons.Default.Close,
|
)
|
||||||
contentDescription = null,
|
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
|
|
@ -632,30 +619,24 @@ fun MainScreenWithDrawer(
|
||||||
) {
|
) {
|
||||||
Row {
|
Row {
|
||||||
Column {
|
Column {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
sharedScreenModel.descGridCount(1)
|
sharedScreenModel.descGridCount(1)
|
||||||
}, modifier = Modifier.size(30.dp).alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x15000000),
|
||||||
Icon(
|
size = 30.dp,
|
||||||
Icons.Default.Remove,
|
icon = Icons.Default.Remove
|
||||||
contentDescription = null,
|
)
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Column {
|
Column {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
sharedScreenModel.addGridCount(1)
|
sharedScreenModel.addGridCount(1)
|
||||||
}, modifier = Modifier.size(30.dp).alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x15000000),
|
||||||
Icon(
|
size = 30.dp,
|
||||||
Icons.Default.Add,
|
icon = Icons.Default.Add
|
||||||
contentDescription = null,
|
)
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -664,18 +645,14 @@ fun MainScreenWithDrawer(
|
||||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||||
) {
|
) {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
sharedScreenModel.toggleQRCodeVisibility()
|
sharedScreenModel.toggleQRCodeVisibility()
|
||||||
sharedScreenModel.setExpandedFAB(false)
|
sharedScreenModel.setExpandedFAB(false)
|
||||||
}, modifier = Modifier.alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x15000000),
|
||||||
Icon(
|
icon = Icons.Filled.QrCode
|
||||||
imageVector = Icons.Filled.QrCode,
|
)
|
||||||
contentDescription = "share qr",
|
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -684,17 +661,13 @@ fun MainScreenWithDrawer(
|
||||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||||
) {
|
) {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
showPrintSettings = !showPrintSettings
|
showPrintSettings = !showPrintSettings
|
||||||
}, modifier = Modifier.alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x15000000),
|
||||||
Icon(
|
icon = Icons.Filled.Print
|
||||||
imageVector = Icons.Filled.Print,
|
)
|
||||||
contentDescription = "Imprimer",
|
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
|
|
@ -702,32 +675,24 @@ fun MainScreenWithDrawer(
|
||||||
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
enter = fadeIn() + scaleIn() + slideInVertically { it / 2 },
|
||||||
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
exit = fadeOut() + scaleOut() + slideOutVertically { it / 2 }
|
||||||
) {
|
) {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
sharedScreenModel.setMidiCtrl(!showMidiCtrl)
|
sharedScreenModel.setMidiCtrl(!showMidiCtrl)
|
||||||
}, modifier = Modifier.alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = Color(0x15000000),
|
||||||
Icon(
|
icon = if (showMidiCtrl) Icons.Filled.StopCircle else Icons.Filled.PlayCircle
|
||||||
imageVector = if (showMidiCtrl) Icons.Filled.StopCircle else Icons.Filled.PlayCircle,
|
)
|
||||||
contentDescription = "Jouer",
|
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!showMidiCtrl) {
|
if (!showMidiCtrl) {
|
||||||
FloatingActionButton(
|
MyFAB(
|
||||||
onClick = {
|
onClick = {
|
||||||
sharedScreenModel.setExpandedFAB(!isExpanded)
|
sharedScreenModel.setExpandedFAB(!isExpanded)
|
||||||
refreshTrigeer++
|
refreshTrigeer++
|
||||||
sharedScreenModel.loadNewSong("$midiFile")
|
sharedScreenModel.loadNewSong("$midiFile")
|
||||||
}, modifier = Modifier.alpha(0.45f)
|
},
|
||||||
) {
|
containerColor = if (isExpanded) Color(0x25000000) else Color.Transparent,
|
||||||
Icon(
|
icon = if (isExpanded) Icons.Filled.Close else Icons.Filled.Menu
|
||||||
imageVector = if (isExpanded) Icons.Filled.Close else Icons.Filled.Menu,
|
)
|
||||||
contentDescription = "MenuFermer",
|
|
||||||
tint = Color.Blue
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = showMidiCtrl,
|
visible = showMidiCtrl,
|
||||||
|
|
@ -810,7 +775,7 @@ fun MainScreenWithDrawer(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.size(56.dp)
|
.size(55.dp)
|
||||||
.alpha(0.6f)
|
.alpha(0.6f)
|
||||||
.background(
|
.background(
|
||||||
color = Color.Blue,
|
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> {
|
val LocalFullscreenController = staticCompositionLocalOf<(Boolean) -> Unit> {
|
||||||
{ _ -> }
|
{ _ -> }
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue