Skip to content

Commit f06e85b

Browse files
committed
refactor: remove connectivity-off illustration from CastBottomSheet
Removes the `WifiOffIllustration` component and the conditional logic that displayed it when connectivity was disabled. The `CastBottomSheet` now proceeds directly to the scanning state or device list regardless of the `allConnectivityOff` flag. - Deleted `WifiOffIllustration` private composable. - Removed `allConnectivityOff` check within the lazy list. - Cleaned up unused imports.
1 parent 0f19100 commit f06e85b

1 file changed

Lines changed: 2 additions & 90 deletions

File tree

app/src/main/java/com/theveloper/pixelplay/presentation/components/CastBottomSheet.kt

Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import androidx.activity.compose.BackHandler
2424
import androidx.activity.compose.rememberLauncherForActivityResult
2525
import androidx.activity.result.contract.ActivityResultContracts
2626
import androidx.compose.foundation.Canvas
27-
import androidx.compose.foundation.LocalOverscrollFactory
2827
import androidx.compose.foundation.background
2928
import androidx.compose.foundation.clickable
3029
import androidx.compose.foundation.interaction.MutableInteractionSource
@@ -140,6 +139,7 @@ import com.theveloper.pixelplay.ui.theme.GoogleSansRounded
140139
import racra.compose.smooth_corner_rect_library.AbsoluteSmoothCornerShape
141140
import android.content.pm.PackageManager
142141
import androidx.compose.animation.animateColorAsState
142+
import androidx.compose.foundation.LocalOverscrollFactory
143143
import androidx.compose.foundation.gestures.detectVerticalDragGestures
144144
import androidx.compose.foundation.layout.navigationBars
145145
import androidx.compose.foundation.layout.navigationBarsPadding
@@ -862,14 +862,7 @@ private fun CastDevicesTabContent(
862862
}
863863
}
864864

865-
if (allConnectivityOff) {
866-
item(key = "wifiOff") {
867-
WifiOffIllustration(
868-
onTurnOnWifi = onTurnOnWifi,
869-
onOpenBluetoothSettings = onOpenBluetoothSettings
870-
)
871-
}
872-
} else if (state.isScanning && state.devices.isEmpty()) {
865+
if (state.isScanning && state.devices.isEmpty()) {
873866
item(key = "scanningPlaceholder") {
874867
ScanningPlaceholderList()
875868
}
@@ -1876,87 +1869,6 @@ private fun QuickSettingTile(
18761869
}
18771870
}
18781871

1879-
@Composable
1880-
private fun WifiOffIllustration(
1881-
onTurnOnWifi: () -> Unit,
1882-
onOpenBluetoothSettings: () -> Unit
1883-
) {
1884-
val shape = AbsoluteSmoothCornerShape(
1885-
cornerRadiusTL = 38.dp,
1886-
cornerRadiusTR = 20.dp,
1887-
cornerRadiusBL = 20.dp,
1888-
cornerRadiusBR = 38.dp,
1889-
smoothnessAsPercentTL = 70,
1890-
smoothnessAsPercentTR = 70,
1891-
smoothnessAsPercentBL = 70,
1892-
smoothnessAsPercentBR = 70
1893-
)
1894-
Card(
1895-
modifier = Modifier.fillMaxWidth(),
1896-
shape = shape,
1897-
colors = CardDefaults.cardColors(containerColor = MaterialTheme.colorScheme.surfaceContainerHigh),
1898-
elevation = CardDefaults.cardElevation(defaultElevation = 4.dp)
1899-
) {
1900-
Column(
1901-
modifier = Modifier
1902-
.fillMaxWidth()
1903-
.padding(24.dp),
1904-
verticalArrangement = Arrangement.spacedBy(16.dp),
1905-
horizontalAlignment = Alignment.CenterHorizontally
1906-
) {
1907-
val prim1 = MaterialTheme.colorScheme.primary.copy(alpha = 0.15f)
1908-
val prim2 = MaterialTheme.colorScheme.primary.copy(alpha = 0.35f)
1909-
val prim3 = MaterialTheme.colorScheme.primary
1910-
Canvas(modifier = Modifier.size(120.dp)) {
1911-
drawCircle(color = prim1, radius = size.minDimension / 2)
1912-
drawCircle(
1913-
color = prim2,
1914-
radius = size.minDimension / 3,
1915-
style = Stroke(width = 10.dp.toPx())
1916-
)
1917-
drawCircle(color = prim3, radius = size.minDimension / 6)
1918-
}
1919-
Text(
1920-
text = stringResource(R.string.presentation_batch_g_cast_connections_off_title),
1921-
style = MaterialTheme.typography.titleLarge.copy(fontWeight = FontWeight.Bold)
1922-
)
1923-
Text(
1924-
text = stringResource(R.string.presentation_batch_g_cast_connections_off_body),
1925-
style = MaterialTheme.typography.bodyMedium,
1926-
textAlign = TextAlign.Center,
1927-
color = MaterialTheme.colorScheme.onSurfaceVariant,
1928-
lineHeight = 20.sp
1929-
)
1930-
Column(
1931-
verticalArrangement = Arrangement.spacedBy(8.dp),
1932-
horizontalAlignment = Alignment.CenterHorizontally
1933-
) {
1934-
Button(
1935-
onClick = onTurnOnWifi,
1936-
shape = RoundedCornerShape(50),
1937-
colors = ButtonDefaults.buttonColors(
1938-
containerColor = MaterialTheme.colorScheme.primary,
1939-
contentColor = MaterialTheme.colorScheme.onPrimary
1940-
)
1941-
) {
1942-
Text(stringResource(R.string.presentation_batch_g_cast_turn_on_wifi))
1943-
}
1944-
1945-
Button(
1946-
onClick = onOpenBluetoothSettings,
1947-
shape = RoundedCornerShape(50),
1948-
colors = ButtonDefaults.buttonColors(
1949-
containerColor = MaterialTheme.colorScheme.secondaryContainer,
1950-
contentColor = MaterialTheme.colorScheme.onSecondaryContainer
1951-
)
1952-
) {
1953-
Text(stringResource(R.string.presentation_batch_g_cast_open_bluetooth))
1954-
}
1955-
}
1956-
}
1957-
}
1958-
}
1959-
19601872
@Composable
19611873
private fun ScanningPlaceholderList() {
19621874
Column(verticalArrangement = Arrangement.spacedBy(12.dp)) {

0 commit comments

Comments
 (0)