Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ dependencies {
implementation(libs.androidx.dynamicanimation)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.material.icons.core)
implementation(libs.androidx.compose.material.icons.extended)
implementation(libs.androidx.graphics.shapes)
debugImplementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.foundation.layout)
implementation(libs.aboutlibraries)
Expand Down
1 change: 0 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission
android:name="android.permission.BLUETOOTH_PRIVILEGED"
tools:ignore="ProtectedPermissions" />
Expand Down
459 changes: 90 additions & 369 deletions android/app/src/main/java/me/kavishdevar/librepods/MainActivity.kt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
Expand Down Expand Up @@ -241,7 +243,7 @@ fun DraggableDismissBox(
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.Black.copy(alpha = 0.5f * backgroundAlpha))
.background(MaterialTheme.colorScheme.scrim.copy(alpha = 0.5f * backgroundAlpha))
.pointerInput(Unit) {
detectVerticalDragGestures(
onDragStart = { isDragging = true },
Expand Down Expand Up @@ -305,7 +307,7 @@ fun NewControlCenterDialogContent(
) {
val context = LocalContext.current
val sharedPreferences = context.getSharedPreferences("settings", Context.MODE_PRIVATE)
val textColor = Color.White
val colorScheme = MaterialTheme.colorScheme

var currentAncMode by remember { mutableStateOf(NoiseControlMode.TRANSPARENCY) }
var isConvAwarenessEnabled by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -419,26 +421,35 @@ fun NewControlCenterDialogContent(
if (service != null) {
Spacer(modifier = Modifier.weight(1f))

Column(
Surface(
modifier = Modifier
.weight(2f)
.fillMaxWidth(),
shape = MaterialTheme.shapes.extraLarge,
color = colorScheme.surfaceContainerHigh,
tonalElevation = 3.dp,
shadowElevation = 6.dp
) {
Column(
modifier = Modifier
.fillMaxSize()
.padding(vertical = 24.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
Icon(
painter = painterResource(id = R.drawable.airpods),
contentDescription = "Device Icon",
tint = textColor.copy(alpha = 0.8f),
tint = colorScheme.onSurfaceVariant,
modifier = Modifier.size(48.dp)
)

Spacer(modifier = Modifier.height(4.dp))

Text(
text = deviceName,
color = textColor,
fontSize = 16.sp,
color = colorScheme.onSurface,
style = MaterialTheme.typography.titleMedium,
fontWeight = FontWeight.Medium
)

Expand Down Expand Up @@ -469,13 +480,23 @@ fun NewControlCenterDialogContent(
.padding(vertical = 8.dp)
)
}
}

Spacer(modifier = Modifier.weight(1f))

Surface(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 72.dp),
shape = MaterialTheme.shapes.extraLarge,
color = colorScheme.surfaceContainerHigh,
tonalElevation = 3.dp,
shadowElevation = 6.dp
) {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 72.dp)
.padding(vertical = 20.dp)
.animateContentSize(
animationSpec = spring(
dampingRatio = Spring.DampingRatioMediumBouncy,
Expand Down Expand Up @@ -525,7 +546,7 @@ fun NewControlCenterDialogContent(
.clip(CircleShape)
.background(
brush = noiseControlButtonBrush ?:
Brush.linearGradient(colors = listOf(Color(0xFF0A84FF), Color(0xFF0A84FF)))
Brush.linearGradient(colors = listOf(colorScheme.primary, colorScheme.primary))
)
.clickable(
onClick = { onNoiseControlExpandedChange(true) },
Expand All @@ -537,7 +558,7 @@ fun NewControlCenterDialogContent(
Icon(
painter = painterResource(id = getModeIconRes(currentAncMode)),
contentDescription = getModeLabel(currentAncMode),
tint = Color.White,
tint = colorScheme.onPrimary,
modifier = Modifier.size(32.dp)
)
}
Expand All @@ -546,8 +567,8 @@ fun NewControlCenterDialogContent(

Text(
text = getModeLabel(currentAncMode),
color = Color.White,
fontSize = 12.sp,
color = colorScheme.onSurface,
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Medium,
textAlign = androidx.compose.ui.text.style.TextAlign.Center
)
Expand All @@ -567,8 +588,8 @@ fun NewControlCenterDialogContent(
.background(
Brush.linearGradient(
colors = listOf(
if (isConvAwarenessEnabled) Color(0xFF0A84FF) else Color(0x593C3C3E),
if (isConvAwarenessEnabled) Color(0xFF0A84FF) else Color(0x593C3C3E)
if (isConvAwarenessEnabled) colorScheme.primary else colorScheme.surfaceContainerHighest,
if (isConvAwarenessEnabled) colorScheme.primary else colorScheme.surfaceContainerHighest
)
)
)
Expand All @@ -589,7 +610,7 @@ fun NewControlCenterDialogContent(
Icon(
painter = painterResource(id = R.drawable.airpods),
contentDescription = "Conversational Awareness",
tint = Color.White,
tint = if (isConvAwarenessEnabled) colorScheme.onPrimary else colorScheme.onSurfaceVariant,
modifier = Modifier.size(32.dp)
)
}
Expand All @@ -598,8 +619,8 @@ fun NewControlCenterDialogContent(

Text(
text = "Conversational\nAwareness",
color = Color.White,
fontSize = 12.sp,
color = colorScheme.onSurface,
style = MaterialTheme.typography.labelMedium,
fontWeight = FontWeight.Medium,
textAlign = androidx.compose.ui.text.style.TextAlign.Center,
lineHeight = 14.sp
Expand All @@ -609,11 +630,16 @@ fun NewControlCenterDialogContent(
}
}
}
}

} else {
Spacer(modifier = Modifier.weight(1f))
Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.Center) {
Text("Loading...", color = textColor)
Text(
"Loading...",
color = colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyLarge
)
}
Spacer(modifier = Modifier.weight(1f))
}
Expand Down
Loading