Skip to content

Commit 19e7127

Browse files
committed
feat(details): group number actions in a card
1 parent afb6c99 commit 19e7127

5 files changed

Lines changed: 66 additions & 58 deletions

File tree

‎CHANGELOG.md‎

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

77
- Insights now opens with outlined totals, then its real weekly chart and
88
detail cards. Its labels describe recorded call and text events accurately.
9+
- Number details now groups block, report, call and area-code controls under a
10+
single action card.
911
- Blocklist now has a clearer rules heading, an outlined count card, pill tabs
1012
for each rule type, and a framed empty state.
1113
- Recent calls now uses compact, neutral history cards and shows a Retry card

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ language in [issue #7](https://github.com/SysAdminDoc/CallShield/issues/7).
542542
| URL Safety | Local spam-domain data; optional PhishTank and OpenPhish |
543543
| Verification | Local Gradle, lint, and release-artifact checks |
544544
| Tests | 1559 JVM unit tests (JUnit) |
545-
| Strings | 1635 string resources and 38 plural groups (translation-ready) |
545+
| Strings | 1637 string resources and 38 plural groups (translation-ready) |
546546
| Accessibility | 100+ content descriptions, 48dp touch targets |
547547
| Min SDK | 29 (Android 10) |
548548
| Target SDK | 36 |

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

Lines changed: 59 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -258,64 +258,66 @@ fun NumberDetailScreen(
258258
}
259259
}
260260

261-
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
262-
PremiumActionButton(
263-
label = stringResource(if (isBlocked) R.string.detail_unblock else R.string.detail_block),
264-
icon = if (isBlocked) Icons.Default.CheckCircle else Icons.Default.Block,
265-
color = CatRed,
266-
onClick = {
267-
if (isBlocked) {
268-
// By number, so a block saved in another spelling of it goes too.
269-
viewModel.unblockByNumber(number)
270-
hapticTick(context)
271-
Toast.makeText(context, numberUnblockedMessage, Toast.LENGTH_SHORT).show()
272-
} else {
273-
viewModel.blockNumber(number, "spam", blockedFromDetail)
274-
hapticConfirm(context)
275-
Toast.makeText(context, numberBlockedMessage, Toast.LENGTH_SHORT).show()
276-
}
277-
},
278-
modifier = Modifier.weight(1f),
279-
)
280-
PremiumActionButton(
281-
label = stringResource(R.string.detail_report),
282-
icon = Icons.Default.Flag,
283-
color = CatRed,
284-
onClick = {
285-
val title = Uri.encode(reportIssueTitle)
286-
val body = Uri.encode(reportIssueBody)
287-
context.launchViewUrlSafely("https://github.com/SysAdminDoc/CallShield/issues/new?title=$title&body=$body&labels=spam-report")
288-
},
289-
modifier = Modifier.weight(1f),
290-
outlined = true,
291-
)
292-
PremiumActionButton(
293-
label = stringResource(R.string.detail_call),
294-
icon = Icons.Default.Phone,
295-
color = CatText,
296-
onClick = {
297-
context.startActivitySafely(
298-
Intent(Intent.ACTION_DIAL, Uri.parse("tel:$number")).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) },
299-
)
300-
},
301-
modifier = Modifier.weight(1f),
302-
outlined = true,
303-
)
304-
}
305-
306-
// Block area code — confirmed first: a ~7.9M-number rule from a stray
307-
// tap with zero feedback is exactly what the Dashboard flow fixed in
308-
// v1.7.26. Same dialog + toast here.
309261
var showAreaBlockConfirm by rememberSaveable { mutableStateOf(false) }
310-
if (areaCode != null) {
311-
PremiumActionButton(
312-
label = stringResource(R.string.detail_block_area_code, areaCode),
313-
icon = Icons.Default.FilterAlt,
314-
color = CatYellow,
315-
onClick = { showAreaBlockConfirm = true },
316-
modifier = Modifier.fillMaxWidth(),
317-
outlined = true,
318-
)
262+
PremiumCard {
263+
Column(modifier = Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(12.dp)) {
264+
SectionHeader(stringResource(R.string.detail_take_action), CatGreen)
265+
Text(stringResource(R.string.detail_take_action_desc), style = MaterialTheme.typography.bodySmall, color = CatSubtext)
266+
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.spacedBy(8.dp)) {
267+
PremiumActionButton(
268+
label = stringResource(if (isBlocked) R.string.detail_unblock else R.string.detail_block),
269+
icon = if (isBlocked) Icons.Default.CheckCircle else Icons.Default.Block,
270+
color = CatRed,
271+
onClick = {
272+
if (isBlocked) {
273+
// By number, so a block saved in another spelling of it goes too.
274+
viewModel.unblockByNumber(number)
275+
hapticTick(context)
276+
Toast.makeText(context, numberUnblockedMessage, Toast.LENGTH_SHORT).show()
277+
} else {
278+
viewModel.blockNumber(number, "spam", blockedFromDetail)
279+
hapticConfirm(context)
280+
Toast.makeText(context, numberBlockedMessage, Toast.LENGTH_SHORT).show()
281+
}
282+
},
283+
modifier = Modifier.weight(1f),
284+
)
285+
PremiumActionButton(
286+
label = stringResource(R.string.detail_report),
287+
icon = Icons.Default.Flag,
288+
color = CatRed,
289+
onClick = {
290+
val title = Uri.encode(reportIssueTitle)
291+
val body = Uri.encode(reportIssueBody)
292+
context.launchViewUrlSafely("https://github.com/SysAdminDoc/CallShield/issues/new?title=$title&body=$body&labels=spam-report")
293+
},
294+
modifier = Modifier.weight(1f),
295+
outlined = true,
296+
)
297+
PremiumActionButton(
298+
label = stringResource(R.string.detail_call),
299+
icon = Icons.Default.Phone,
300+
color = CatText,
301+
onClick = {
302+
context.startActivitySafely(
303+
Intent(Intent.ACTION_DIAL, Uri.parse("tel:$number")).apply { addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) },
304+
)
305+
},
306+
modifier = Modifier.weight(1f),
307+
outlined = true,
308+
)
309+
}
310+
if (areaCode != null) {
311+
PremiumActionButton(
312+
label = stringResource(R.string.detail_block_area_code, areaCode),
313+
icon = Icons.Default.FilterAlt,
314+
color = CatYellow,
315+
onClick = { showAreaBlockConfirm = true },
316+
modifier = Modifier.fillMaxWidth(),
317+
outlined = true,
318+
)
319+
}
320+
}
319321
}
320322
if (showAreaBlockConfirm && areaCode != null) {
321323
val areaAddedToast = stringResource(R.string.dashboard_block_area_added, areaCode)

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,8 @@
871871
<string name="detail_copied">已复制</string>
872872
<string name="detail_block_area_code">拦截所有 %s 号码</string>
873873
<string name="detail_statistics">统计</string>
874+
<string name="detail_take_action">采取操作</string>
875+
<string name="detail_take_action_desc">选择此号码联系您时要执行的操作。</string>
874876
<string name="detail_calls">通话</string>
875877
<string name="detail_sms">短信</string>
876878
<string name="detail_total">总计</string>

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,8 @@
12261226
<string name="detail_statistics">Statistics</string>
12271227
<string name="detail_calls">Calls</string>
12281228
<string name="detail_number_details">Number details</string>
1229+
<string name="detail_take_action">Take action</string>
1230+
<string name="detail_take_action_desc">Choose what happens when this number contacts you.</string>
12291231
<string name="detail_phone_number">Phone number</string>
12301232
<string name="detail_high_risk">High risk</string>
12311233
<string name="detail_no_risk">No risk detected</string>

0 commit comments

Comments
 (0)