Fix! search custom Keyboard height
This commit is contained in:
parent
fea05c3f21
commit
43c90319e5
2 changed files with 39 additions and 29 deletions
|
|
@ -42,10 +42,7 @@ fun CustomKeyboard(
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 12.dp, vertical = 10.dp)
|
.padding(horizontal = 12.dp, vertical = 10.dp) ,
|
||||||
.then(
|
|
||||||
if (isFullScreen) Modifier.navigationBarsPadding() else Modifier
|
|
||||||
),
|
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
val keyboardButtonHeight = if (isAndroidLandscape) 35.dp else 44.dp
|
val keyboardButtonHeight = if (isAndroidLandscape) 35.dp else 44.dp
|
||||||
|
|
|
||||||
|
|
@ -432,6 +432,8 @@ fun MainScreenWithDrawer(
|
||||||
}
|
}
|
||||||
|
|
||||||
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
|
BoxWithConstraints(modifier = Modifier.fillMaxSize()) {
|
||||||
|
val totalScreenWidth = maxWidth
|
||||||
|
val totalScreenHeight = maxHeight
|
||||||
val prefs = remember { provideSettings() }
|
val prefs = remember { provideSettings() }
|
||||||
val rotationMode = prefs.getString("screen_rotation_mode", "LANDSCAPE")
|
val rotationMode = prefs.getString("screen_rotation_mode", "LANDSCAPE")
|
||||||
val isLandscape = when (rotationMode) {
|
val isLandscape = when (rotationMode) {
|
||||||
|
|
@ -813,7 +815,8 @@ fun MainScreenWithDrawer(
|
||||||
},
|
},
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.BottomEnd)
|
.align(Alignment.BottomEnd)
|
||||||
.fillMaxWidth(0.4f)
|
.width(totalScreenWidth * 0.4f)
|
||||||
|
.padding(bottom = 15.dp)
|
||||||
)
|
)
|
||||||
SolfaKeyboardSection(
|
SolfaKeyboardSection(
|
||||||
solfaKeyboardState = solfaKeyboardState,
|
solfaKeyboardState = solfaKeyboardState,
|
||||||
|
|
@ -831,20 +834,27 @@ fun MainScreenWithDrawer(
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.width(maxOf(rightNavBarWidth, 36.dp))
|
.width(maxOf(rightNavBarWidth, 36.dp))
|
||||||
.background(color = MaterialTheme.colorScheme.primary)
|
.background(color = MaterialTheme.colorScheme.primary)
|
||||||
.padding(25.dp),
|
.padding(vertical = 25.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
val screenHeight = maxHeight
|
val screenHeight = maxHeight
|
||||||
Text(
|
Box(
|
||||||
text = songTitle,
|
modifier = Modifier
|
||||||
style = MaterialTheme.typography.titleSmall,
|
.fillMaxHeight()
|
||||||
fontWeight = FontWeight.Bold,
|
.fillMaxWidth(),
|
||||||
color = MaterialTheme.colorScheme.onPrimary,
|
contentAlignment = Alignment.Center
|
||||||
maxLines = 1,
|
) {
|
||||||
softWrap = false,
|
Text(
|
||||||
modifier = Modifier.requiredWidth(screenHeight).graphicsLayer(rotationZ = 90f),
|
text = songTitle,
|
||||||
textAlign = TextAlign.Start
|
style = MaterialTheme.typography.titleSmall,
|
||||||
)
|
fontWeight = FontWeight.Bold,
|
||||||
|
color = MaterialTheme.colorScheme.onPrimary,
|
||||||
|
maxLines = 1,
|
||||||
|
softWrap = false,
|
||||||
|
modifier = Modifier.requiredWidth(screenHeight).graphicsLayer(rotationZ = 90f),
|
||||||
|
textAlign = TextAlign.Start
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -946,7 +956,10 @@ fun MainScreenWithDrawer(
|
||||||
focusManager.clearFocus(force = true)
|
focusManager.clearFocus(force = true)
|
||||||
keyboardController?.hide()
|
keyboardController?.hide()
|
||||||
},
|
},
|
||||||
modifier = Modifier.align(Alignment.BottomCenter)
|
modifier = Modifier
|
||||||
|
.align(Alignment.BottomEnd)
|
||||||
|
.height(totalScreenHeight * 0.35f)
|
||||||
|
.padding(bottom = 5.dp)
|
||||||
)
|
)
|
||||||
SolfaKeyboardSection(
|
SolfaKeyboardSection(
|
||||||
solfaKeyboardState = solfaKeyboardState,
|
solfaKeyboardState = solfaKeyboardState,
|
||||||
|
|
@ -1019,21 +1032,21 @@ private fun MainTopBar(
|
||||||
visualTransformation = VisualTransformation.None,
|
visualTransformation = VisualTransformation.None,
|
||||||
interactionSource = sharedInteractionSource,
|
interactionSource = sharedInteractionSource,
|
||||||
placeholder = { Text(text = "FFPM 1 Andriananahary ...", color = Color.White.copy(alpha = 0.5f), fontSize = 16.sp) },
|
placeholder = { Text(text = "FFPM 1 Andriananahary ...", color = Color.White.copy(alpha = 0.5f), fontSize = 16.sp) },
|
||||||
leadingIcon = { Icon(imageVector = Icons.Default.Search, contentDescription = null, tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(20.dp)) },
|
leadingIcon = { Icon(imageVector = Icons.Default.Search, contentDescription = "Search textfield", tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(20.dp)) },
|
||||||
trailingIcon = {
|
trailingIcon = {
|
||||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(2.dp)) {
|
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(2.dp)) {
|
||||||
if (isAndroid) {
|
if (isAndroid) {
|
||||||
IconButton(onClick = onToggleNumericKeyboard, modifier = Modifier.size(32.dp)) {
|
IconButton(onClick = onToggleNumericKeyboard, modifier = Modifier.size(32.dp)) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (isNumericKeyboard) Icons.Default.Abc else Icons.Filled._123,
|
imageVector = if (isNumericKeyboard) Icons.Default.Abc else Icons.Filled._123,
|
||||||
contentDescription = null,
|
contentDescription = "Icon to change ABC 123",
|
||||||
tint = MaterialTheme.colorScheme.tertiary,
|
tint = MaterialTheme.colorScheme.tertiary,
|
||||||
modifier = Modifier.size(22.dp)
|
modifier = Modifier.size(22.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
IconButton(onClick = onClearSearch, modifier = Modifier.size(32.dp)) {
|
IconButton(onClick = onClearSearch, modifier = Modifier.size(32.dp)) {
|
||||||
Icon(imageVector = Icons.Default.Clear, contentDescription = null, tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(18.dp))
|
Icon(imageVector = Icons.Default.Clear, contentDescription = "Clear search", tint = Color.White.copy(alpha = 0.8f), modifier = Modifier.size(18.dp))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1157,7 +1170,7 @@ private fun TranspositionDropdown(
|
||||||
val currentIndex = keysOrder.indexOf(tempUiKey).takeIf { it != -1 } ?: 0
|
val currentIndex = keysOrder.indexOf(tempUiKey).takeIf { it != -1 } ?: 0
|
||||||
|
|
||||||
IconButton(modifier = Modifier.size(if (isLandscapeMode) 32.dp else 36.dp), onClick = { tempInterval-- }) {
|
IconButton(modifier = Modifier.size(if (isLandscapeMode) 32.dp else 36.dp), onClick = { tempInterval-- }) {
|
||||||
Icon(imageVector = Icons.AutoMirrored.Filled.KeyboardArrowLeft, contentDescription = null, tint = Color.White)
|
Icon(imageVector = Icons.AutoMirrored.Filled.KeyboardArrowLeft, contentDescription = "Transposer de moins", tint = Color.White)
|
||||||
}
|
}
|
||||||
|
|
||||||
val centralIcon = if (isPendingChange && !isTransposedToC) Icons.Filled.Check else Icons.Filled.SwapHoriz
|
val centralIcon = if (isPendingChange && !isTransposedToC) Icons.Filled.Check else Icons.Filled.SwapHoriz
|
||||||
|
|
@ -1181,11 +1194,11 @@ private fun TranspositionDropdown(
|
||||||
isEyeVisible = false
|
isEyeVisible = false
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
Icon(imageVector = centralIcon, contentDescription = null, tint = centralTint)
|
Icon(imageVector = centralIcon, contentDescription = "Transposer", tint = centralTint)
|
||||||
}
|
}
|
||||||
|
|
||||||
IconButton(modifier = Modifier.size(if (isLandscapeMode) 32.dp else 36.dp), onClick = { tempInterval++ }) {
|
IconButton(modifier = Modifier.size(if (isLandscapeMode) 32.dp else 36.dp), onClick = { tempInterval++ }) {
|
||||||
Icon(imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = null, tint = Color.White)
|
Icon(imageVector = Icons.AutoMirrored.Filled.KeyboardArrowRight, contentDescription = "Transposer de plus", tint = Color.White)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1631,7 +1644,7 @@ private fun SearchOverlayCard(
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (isFavorite) Icons.Default.FavoriteBorder else Icons.Default.Favorite,
|
imageVector = if (isFavorite) Icons.Default.FavoriteBorder else Icons.Default.Favorite,
|
||||||
contentDescription = null,
|
contentDescription = "favoris",
|
||||||
modifier = Modifier.scale(scale),
|
modifier = Modifier.scale(scale),
|
||||||
tint = MaterialTheme.colorScheme.onSecondary
|
tint = MaterialTheme.colorScheme.onSecondary
|
||||||
)
|
)
|
||||||
|
|
@ -1639,7 +1652,7 @@ private fun SearchOverlayCard(
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
ListItem(
|
ListItem(
|
||||||
leadingContent = { Icon(imageVector = if (item.path.startsWith("assets://")) Icons.Default.ArrowDropDownCircle else Icons.Default.Folder, contentDescription = null, modifier = Modifier.size(24.dp)) },
|
leadingContent = { Icon(imageVector = if (item.path.startsWith("assets://")) Icons.Default.ArrowDropDownCircle else Icons.Default.Folder, contentDescription = "Prefixe icon resultats search", modifier = Modifier.size(24.dp)) },
|
||||||
headlineContent = { Text(item.title) },
|
headlineContent = { Text(item.title) },
|
||||||
supportingContent = { Text(item.contentTitle, maxLines = 1) },
|
supportingContent = { Text(item.contentTitle, maxLines = 1) },
|
||||||
trailingContent = {
|
trailingContent = {
|
||||||
|
|
@ -1649,7 +1662,7 @@ private fun SearchOverlayCard(
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.AutoMirrored.Default.PlaylistAdd,
|
imageVector = Icons.AutoMirrored.Default.PlaylistAdd,
|
||||||
contentDescription = null,
|
contentDescription = "Ajouter à la playlist",
|
||||||
tint = if (!onPlaylist) Color.LightGray else Color(0xFFFFD700)
|
tint = if (!onPlaylist) Color.LightGray else Color(0xFFFFD700)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -1696,8 +1709,8 @@ private fun CustomKeyboardSection(
|
||||||
) {
|
) {
|
||||||
CustomKeyboard(
|
CustomKeyboard(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
//.fillMaxWidth()
|
||||||
.fillMaxHeight(if (isAndroidLandscape) 0.6f else 0.38f)
|
//.fillMaxHeight(if (isAndroidLandscape) 0.6f else 0.38f)
|
||||||
.onGloballyPositioned { coordinates ->
|
.onGloballyPositioned { coordinates ->
|
||||||
onKeyboardHeightMeasured(with(density) { coordinates.size.height.toDp() })
|
onKeyboardHeightMeasured(with(density) { coordinates.size.height.toDp() })
|
||||||
},
|
},
|
||||||
|
|
@ -1888,7 +1901,7 @@ private fun HoverSearchButton(
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (isSearchActive) Icons.Default.Close else Icons.Default.Search,
|
imageVector = if (isSearchActive) Icons.Default.Close else Icons.Default.Search,
|
||||||
contentDescription = null,
|
contentDescription = "Search button",
|
||||||
tint = MaterialTheme.colorScheme.onTertiary
|
tint = MaterialTheme.colorScheme.onTertiary
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue