Skip to content

Commit 1c1733b

Browse files
committed
feat(home): surface screening and protection choices
The generated Home design prioritizes call and text readiness plus protection levels. Keep the detailed setup checks and quick controls below those summaries so all existing actions remain available.
1 parent 347b422 commit 1c1733b

4 files changed

Lines changed: 111 additions & 57 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ All notable changes to CallShield will be documented in this file.
44

55
## Unreleased
66

7+
- Home now puts today's results, call and text readiness, the latest blocked
8+
caller and protection levels ahead of the longer checks and tools.
79
- Fresh installs now open in the AMOLED theme. Its graphite cards, mint controls,
810
coral warnings and thin outlines follow the new screen designs. Existing
911
theme choices remain saved, including Light and System.

‎app/src/main/java/com/sysadmindoc/callshield/ui/screens/main/DashboardScreen.kt‎

Lines changed: 107 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import androidx.compose.animation.core.animateFloatAsState
1313
import androidx.compose.animation.core.animateIntAsState
1414
import androidx.compose.animation.core.tween
1515
import androidx.compose.foundation.background
16+
import androidx.compose.foundation.border
1617
import androidx.compose.foundation.layout.Arrangement
1718
import androidx.compose.foundation.layout.Box
1819
import androidx.compose.foundation.layout.Column
@@ -469,48 +470,62 @@ fun DashboardScreen(
469470
},
470471
)
471472

472-
DashboardSetupChecklistCard(
473-
dashboardStatus = dashboardStatus,
474-
corePermissionsReady = corePermissionsReady,
475-
syncState = syncState,
476-
spamDatabaseReady = spamDatabaseReady,
477-
spamCount = spamCount,
478-
blockCallsEnabled = blockCallsEnabled,
479-
callScreenerReady = callScreenerReady,
480-
overlayGranted = overlayGranted,
481-
notificationsGranted = notificationsGranted,
482-
onReviewPermissions = openPermissions,
483-
onSyncDatabase = {
484-
hapticTick(context)
485-
viewModel.sync()
486-
},
487-
onEnableCallScreener = openPermissions,
488-
onEnableOverlay = openPermissions,
489-
onEnableNotifications = openPermissions,
490-
)
491-
492-
if (backgroundExecutionRisk != BackgroundExecutionRisk.Ok && !backgroundWarningDismissed) {
493-
BackgroundExecutionWarning(
494-
risk = backgroundExecutionRisk,
495-
showMiuiAction = remember { BackgroundExecutionStatus.isLikelyMiui() },
496-
onOpenBatterySettings = {
497-
context.startActivitySafely(
498-
BackgroundExecutionStatus.batteryExemptionSettingsIntent(context),
499-
)
500-
},
501-
onOpenMiuiSettings = {
502-
context.startActivitySafely(BackgroundExecutionStatus.miuiAutostartIntent())
503-
},
504-
onDismiss = { backgroundWarningDismissed = true },
505-
)
506-
}
507-
508473
DashboardStatsRow(
509474
totalBlocked = totalBlocked,
510475
blockedToday = blockedToday,
511476
blockedThisWeek = blockedThisWeek,
512477
)
513478

479+
Row(
480+
modifier = Modifier.fillMaxWidth(),
481+
horizontalArrangement = Arrangement.spacedBy(10.dp),
482+
) {
483+
val callsActive = blockCallsEnabled && callProtectionReady
484+
val textsActive = blockSmsEnabled && smsProtectionReady
485+
PremiumCard(
486+
modifier = Modifier.weight(1f),
487+
onClick = openPermissions,
488+
accentColor = if (callsActive) CatGreen else CatYellow,
489+
) {
490+
Column(modifier = Modifier.padding(14.dp), verticalArrangement = Arrangement.spacedBy(5.dp)) {
491+
PremiumIconTile(Icons.Default.Phone, if (callsActive) CatGreen else CatYellow, showContainer = true)
492+
Text(stringResource(R.string.onboarding_call_screening_title), style = MaterialTheme.typography.titleSmall)
493+
Text(
494+
stringResource(
495+
when {
496+
callsActive -> R.string.dashboard_status_ready
497+
blockCallsEnabled -> R.string.dashboard_status_needed
498+
else -> R.string.dashboard_profile_off
499+
},
500+
),
501+
style = MaterialTheme.typography.labelMedium,
502+
color = if (callsActive) CatGreen else CatYellow,
503+
)
504+
}
505+
}
506+
PremiumCard(
507+
modifier = Modifier.weight(1f),
508+
onClick = openPermissions,
509+
accentColor = if (textsActive) CatGreen else CatYellow,
510+
) {
511+
Column(modifier = Modifier.padding(14.dp), verticalArrangement = Arrangement.spacedBy(5.dp)) {
512+
PremiumIconTile(Icons.Default.Sms, if (textsActive) CatGreen else CatYellow, showContainer = true)
513+
Text(stringResource(R.string.dashboard_block_sms), style = MaterialTheme.typography.titleSmall)
514+
Text(
515+
stringResource(
516+
when {
517+
textsActive -> R.string.dashboard_status_ready
518+
blockSmsEnabled -> R.string.dashboard_status_needed
519+
else -> R.string.dashboard_profile_off
520+
},
521+
),
522+
style = MaterialTheme.typography.labelMedium,
523+
color = if (textsActive) CatGreen else CatYellow,
524+
)
525+
}
526+
}
527+
}
528+
514529
if (blockedThisWeek > 0 || blockedLastWeek > 0) {
515530
val diff = blockedThisWeek - blockedLastWeek
516531
val trendIcon =
@@ -587,25 +602,7 @@ fun DashboardScreen(
587602

588603
PremiumCard(modifier = Modifier.fillMaxWidth()) {
589604
Column(modifier = Modifier.padding(18.dp)) {
590-
SectionHeader(stringResource(R.string.dashboard_quick_controls), CatGreen)
591-
Spacer(Modifier.height(12.dp))
592-
QuickToggle(
593-
icon = Icons.Default.Phone,
594-
label = stringResource(R.string.dashboard_block_calls),
595-
checked = blockCallsEnabled,
596-
) { viewModel.setBlockCalls(it) }
597-
GradientDivider(modifier = Modifier.padding(vertical = 4.dp))
598-
QuickToggle(
599-
icon = Icons.Default.Sms,
600-
label = stringResource(R.string.dashboard_block_sms),
601-
checked = blockSmsEnabled,
602-
) { viewModel.setBlockSms(it) }
603-
}
604-
}
605-
606-
PremiumCard(modifier = Modifier.fillMaxWidth()) {
607-
Column(modifier = Modifier.padding(18.dp)) {
608-
SectionHeader(stringResource(R.string.dashboard_quick_profiles), CatMauve)
605+
SectionHeader(stringResource(R.string.dashboard_quick_profiles), CatGreen)
609606
SnackbarHost(profileSnackbar)
610607
Spacer(Modifier.height(12.dp))
611608
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
@@ -660,6 +657,60 @@ fun DashboardScreen(
660657
}
661658
}
662659

660+
DashboardSetupChecklistCard(
661+
dashboardStatus = dashboardStatus,
662+
corePermissionsReady = corePermissionsReady,
663+
syncState = syncState,
664+
spamDatabaseReady = spamDatabaseReady,
665+
spamCount = spamCount,
666+
blockCallsEnabled = blockCallsEnabled,
667+
callScreenerReady = callScreenerReady,
668+
overlayGranted = overlayGranted,
669+
notificationsGranted = notificationsGranted,
670+
onReviewPermissions = openPermissions,
671+
onSyncDatabase = {
672+
hapticTick(context)
673+
viewModel.sync()
674+
},
675+
onEnableCallScreener = openPermissions,
676+
onEnableOverlay = openPermissions,
677+
onEnableNotifications = openPermissions,
678+
)
679+
680+
if (backgroundExecutionRisk != BackgroundExecutionRisk.Ok && !backgroundWarningDismissed) {
681+
BackgroundExecutionWarning(
682+
risk = backgroundExecutionRisk,
683+
showMiuiAction = remember { BackgroundExecutionStatus.isLikelyMiui() },
684+
onOpenBatterySettings = {
685+
context.startActivitySafely(
686+
BackgroundExecutionStatus.batteryExemptionSettingsIntent(context),
687+
)
688+
},
689+
onOpenMiuiSettings = {
690+
context.startActivitySafely(BackgroundExecutionStatus.miuiAutostartIntent())
691+
},
692+
onDismiss = { backgroundWarningDismissed = true },
693+
)
694+
}
695+
696+
PremiumCard(modifier = Modifier.fillMaxWidth()) {
697+
Column(modifier = Modifier.padding(18.dp)) {
698+
SectionHeader(stringResource(R.string.dashboard_quick_controls), CatGreen)
699+
Spacer(Modifier.height(12.dp))
700+
QuickToggle(
701+
icon = Icons.Default.Phone,
702+
label = stringResource(R.string.dashboard_block_calls),
703+
checked = blockCallsEnabled,
704+
) { viewModel.setBlockCalls(it) }
705+
GradientDivider(modifier = Modifier.padding(vertical = 4.dp))
706+
QuickToggle(
707+
icon = Icons.Default.Sms,
708+
label = stringResource(R.string.dashboard_block_sms),
709+
checked = blockSmsEnabled,
710+
) { viewModel.setBlockSms(it) }
711+
}
712+
}
713+
663714
PremiumCard(modifier = Modifier.fillMaxWidth(), accentColor = CatGreen) {
664715
Column(
665716
modifier = Modifier.padding(18.dp),
@@ -1834,6 +1885,7 @@ fun ProfileChip(
18341885
modifier =
18351886
modifier
18361887
.height(48.dp)
1888+
.border(1.dp, if (isActive) color else CatMuted, RoundedCornerShape(ShapeSm))
18371889
.semantics { selected = isActive },
18381890
shape = RoundedCornerShape(ShapeSm),
18391891
contentPadding = PaddingValues(horizontal = 4.dp, vertical = 0.dp),

‎app/src/main/res/values-zh-rCN/strings.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
<string name="dashboard_quick_controls">快捷控制</string>
5757
<string name="dashboard_block_calls">拦截通话</string>
5858
<string name="dashboard_block_sms">拦截短信</string>
59-
<string name="dashboard_quick_profiles">快速情景模式</string>
59+
<string name="dashboard_quick_profiles">保护等级</string>
6060
<string name="dashboard_profile_personal">个人</string>
6161
<string name="dashboard_profile_sleep">睡眠</string>
6262
<string name="dashboard_profile_off">关闭</string>

‎app/src/main/res/values/strings.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<string name="dashboard_quick_controls">Quick Controls</string>
8080
<string name="dashboard_block_calls">Block Calls</string>
8181
<string name="dashboard_block_sms">Analyze spam SMS</string>
82-
<string name="dashboard_quick_profiles">Quick Profiles</string>
82+
<string name="dashboard_quick_profiles">How strict?</string>
8383
<string name="dashboard_profile_personal">Personal</string>
8484
<string name="dashboard_profile_sleep">Sleep</string>
8585
<string name="dashboard_profile_off">Off</string>

0 commit comments

Comments
 (0)