mirror of
https://github.com/kavishdevar/librepods.git
synced 2026-09-01 16:59:35 +02:00
android: hide reconnect button in m3e when no successful aacp connection
This commit is contained in:
+87
-76
@@ -736,96 +736,107 @@ fun AirPodsSettingsScreen(
|
|||||||
|
|
||||||
val animatedShapeColor by animateColorAsState(if (reconnecting) primaryContainerColor else secondaryContainerColor)
|
val animatedShapeColor by animateColorAsState(if (reconnecting) primaryContainerColor else secondaryContainerColor)
|
||||||
|
|
||||||
Box(
|
if (state.connectionSuccessful) {
|
||||||
modifier = Modifier
|
Box(
|
||||||
.size(240.dp)
|
modifier = Modifier
|
||||||
.background(
|
.size(240.dp)
|
||||||
MaterialTheme.colorScheme.surfaceBright,
|
.background(
|
||||||
CircleShape
|
MaterialTheme.colorScheme.surfaceBright,
|
||||||
)
|
CircleShape
|
||||||
.clickable(
|
)
|
||||||
interactionSource = null,
|
.clickable(
|
||||||
indication = ripple(
|
interactionSource = null,
|
||||||
bounded = false,
|
indication = ripple(
|
||||||
radius = 120.dp
|
bounded = false,
|
||||||
),
|
radius = 120.dp
|
||||||
enabled = !reconnecting,
|
),
|
||||||
onClick = {}
|
enabled = !reconnecting,
|
||||||
)
|
onClick = {}
|
||||||
.pointerInput(Unit) {
|
)
|
||||||
detectTapGestures(
|
.pointerInput(Unit) {
|
||||||
onTap = {
|
detectTapGestures(
|
||||||
if (!reconnecting) {
|
onTap = {
|
||||||
currentMorphIndex = 1
|
if (!reconnecting) {
|
||||||
reconnecting = true
|
currentMorphIndex = 1
|
||||||
reconnectFromSavedMac()
|
reconnecting = true
|
||||||
}
|
reconnectFromSavedMac()
|
||||||
},
|
}
|
||||||
onPress = {
|
},
|
||||||
if (!reconnecting) {
|
onPress = {
|
||||||
morphProgress.animateTo(
|
if (!reconnecting) {
|
||||||
targetValue = 1f,
|
morphProgress.animateTo(
|
||||||
animationSpec = spring(
|
targetValue = 1f,
|
||||||
dampingRatio = Spring.DampingRatioMediumBouncy,
|
animationSpec = spring(
|
||||||
stiffness = Spring.StiffnessLow
|
dampingRatio = Spring.DampingRatioMediumBouncy,
|
||||||
|
stiffness = Spring.StiffnessLow
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
tryAwaitRelease()
|
||||||
tryAwaitRelease()
|
morphProgress.animateTo(
|
||||||
morphProgress.animateTo(
|
targetValue = 0f,
|
||||||
targetValue = 0f,
|
animationSpec = spring(
|
||||||
animationSpec = spring(
|
dampingRatio = Spring.DampingRatioMediumBouncy,
|
||||||
dampingRatio = Spring.DampingRatioMediumBouncy,
|
stiffness = Spring.StiffnessLow
|
||||||
stiffness = Spring.StiffnessLow
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
)
|
}
|
||||||
}
|
.drawWithContent {
|
||||||
.drawWithContent {
|
val activeMorph = morphs[currentMorphIndex]
|
||||||
val activeMorph = morphs[currentMorphIndex]
|
|
||||||
|
|
||||||
val shapePath = activeMorph.toPath(
|
val shapePath = activeMorph.toPath(
|
||||||
progress = morphProgress.value,
|
progress = morphProgress.value,
|
||||||
path = path
|
path = path
|
||||||
)
|
)
|
||||||
|
|
||||||
val bounds = shapePath.getBounds()
|
val bounds = shapePath.getBounds()
|
||||||
|
|
||||||
val scale = min(size.width/bounds.width, size.height/bounds.height) * 0.8f
|
val scale = min(
|
||||||
|
size.width / bounds.width,
|
||||||
|
size.height / bounds.height
|
||||||
|
) * 0.8f
|
||||||
|
|
||||||
scaleMatrix.reset()
|
scaleMatrix.reset()
|
||||||
|
|
||||||
scaleMatrix.scale(x = scale, y = scale)
|
scaleMatrix.scale(x = scale, y = scale)
|
||||||
|
|
||||||
shapePath.transform(scaleMatrix)
|
shapePath.transform(scaleMatrix)
|
||||||
|
|
||||||
shapePath.translate(size.center - shapePath.getBounds().center)
|
shapePath.translate(size.center - shapePath.getBounds().center)
|
||||||
|
|
||||||
drawPath(
|
drawPath(
|
||||||
path = shapePath,
|
path = shapePath,
|
||||||
color = animatedShapeColor
|
color = animatedShapeColor
|
||||||
)
|
)
|
||||||
|
|
||||||
drawContent()
|
drawContent()
|
||||||
},
|
},
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = if (reconnecting) MaterialIcons.bluetooth_searching else MaterialIcons.headset_off,
|
imageVector = if (reconnecting) MaterialIcons.bluetooth_searching else MaterialIcons.headset_off,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
modifier = Modifier.size(84.dp),
|
modifier = Modifier.size(84.dp),
|
||||||
tint = if (reconnecting) MaterialTheme.colorScheme.onPrimaryContainer else MaterialTheme.colorScheme.onSecondaryContainer
|
tint = if (reconnecting) MaterialTheme.colorScheme.onPrimaryContainer else MaterialTheme.colorScheme.onSecondaryContainer
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(Modifier.height(40.dp))
|
||||||
|
|
||||||
|
Text(
|
||||||
|
text = if (reconnecting) stringResource(R.string.reconnecting) else stringResource(R.string.tap_to_reconnect),
|
||||||
|
style = MaterialTheme.typography.labelSmallEmphasized,
|
||||||
|
color = MaterialTheme.colorScheme.primary
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Text(
|
||||||
|
text = stringResource(R.string.not_connected),
|
||||||
|
style = MaterialTheme.typography.labelMediumEmphasized,
|
||||||
|
color = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Spacer(Modifier.height(40.dp))
|
|
||||||
|
|
||||||
Text(
|
|
||||||
text = if (reconnecting) stringResource(R.string.reconnecting) else stringResource(R.string.tap_to_reconnect),
|
|
||||||
style = MaterialTheme.typography.labelSmallEmphasized,
|
|
||||||
color = MaterialTheme.colorScheme.primary
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BuildConfig.PLAY_BUILD) {
|
if (!BuildConfig.PLAY_BUILD) {
|
||||||
|
|||||||
Reference in New Issue
Block a user