From b55df25650bd5b3237da4faf1ced6196f10cdc0d Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Sun, 21 Jul 2024 08:38:31 -0400 Subject: [PATCH] NotificationsActivity: display channel name in toolbar --- .../main/java/im/angry/openeuicc/ui/MainActivity.kt | 2 +- .../im/angry/openeuicc/ui/NotificationsActivity.kt | 11 +++++++++++ app-common/src/main/res/values/strings.xml | 4 +++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/MainActivity.kt b/app-common/src/main/java/im/angry/openeuicc/ui/MainActivity.kt index 74fe385..0f504eb 100644 --- a/app-common/src/main/java/im/angry/openeuicc/ui/MainActivity.kt +++ b/app-common/src/main/java/im/angry/openeuicc/ui/MainActivity.kt @@ -146,7 +146,7 @@ open class MainActivity : BaseEuiccAccessActivity(), OpenEuiccContextMarker { // If USB readers exist, add them at the very last // We use a wrapper fragment to handle logic specific to USB readers usbDevice?.let { - pages.add(Page(it.productName ?: "USB") { UsbCcidReaderFragment() }) + pages.add(Page(it.productName ?: getString(R.string.usb)) { UsbCcidReaderFragment() }) } viewPager.visibility = View.VISIBLE diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/NotificationsActivity.kt b/app-common/src/main/java/im/angry/openeuicc/ui/NotificationsActivity.kt index 9758d18..59abbc5 100644 --- a/app-common/src/main/java/im/angry/openeuicc/ui/NotificationsActivity.kt +++ b/app-common/src/main/java/im/angry/openeuicc/ui/NotificationsActivity.kt @@ -20,6 +20,7 @@ import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import im.angry.openeuicc.common.R import im.angry.openeuicc.core.EuiccChannel +import im.angry.openeuicc.core.EuiccChannelManager import im.angry.openeuicc.util.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -53,6 +54,16 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker { notificationList.adapter = notificationAdapter registerForContextMenu(notificationList) + // This is slightly different from the MainActivity logic + // due to the length (we don't want to display the full USB product name) + val channelTitle = if (euiccChannel.logicalSlotId == EuiccChannelManager.USB_CHANNEL_ID) { + getString(R.string.usb) + } else { + getString(R.string.channel_name_format, euiccChannel.logicalSlotId) + } + + title = getString(R.string.profile_notifications_detailed_format, channelTitle) + swipeRefresh.setOnRefreshListener { refresh() } diff --git a/app-common/src/main/res/values/strings.xml b/app-common/src/main/res/values/strings.xml index a1a002a..7647815 100644 --- a/app-common/src/main/res/values/strings.xml +++ b/app-common/src/main/res/values/strings.xml @@ -7,6 +7,7 @@ Reload Slots Logical Slot %d + USB Enabled Disabled @@ -48,7 +49,8 @@ Are you sure you want to delete the profile %s? This operation is irreversible. Type \'%s\' here to confirm deletion - Profile Notifications + Notifications + Notifications (%s) Manage Notifications eSIM profiles can send notifications to the carrier when they are downloaded, deleted, enabled, or disabled. The queue of these notifications to be sent is listed here.\n\nIn Settings, you can specify whether to send each type of notification automatically. Note that even if a notification has been sent, it will not be deleted automatically from the record, unless the queue runs out of space.\n\nHere, you can manually send or delete each pending notification. Downloaded