feat: show notification sequence number in upper right #84
4 changed files with 24 additions and 5 deletions
|
@ -117,11 +117,14 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
|||
launchTask {
|
||||
notificationAdapter.notifications =
|
||||
euiccChannelManager.withEuiccChannel(logicalSlotId) { channel ->
|
||||
val profiles = channel.lpa.profiles
|
||||
val nameMap = buildMap {
|
||||
for (profile in channel.lpa.profiles) {
|
||||
put(profile.iccid, profile.displayName)
|
||||
}
|
||||
}
|
||||
|
||||
channel.lpa.notifications.map {
|
||||
val profile = profiles.find { p -> p.iccid == it.iccid }
|
||||
LocalProfileNotificationWrapper(it, profile?.displayName ?: "???")
|
||||
LocalProfileNotificationWrapper(it, nameMap[it.iccid] ?: "???")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -136,6 +139,8 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
|||
inner class NotificationViewHolder(private val root: View):
|
||||
RecyclerView.ViewHolder(root), View.OnCreateContextMenuListener, OnMenuItemClickListener {
|
||||
private val address: TextView = root.requireViewById(R.id.notification_address)
|
||||
private val sequenceNumber: TextView =
|
||||
root.requireViewById(R.id.notification_sequence_number)
|
||||
private val profileName: TextView = root.requireViewById(R.id.notification_profile_name)
|
||||
|
||||
private lateinit var notification: LocalProfileNotificationWrapper
|
||||
|
@ -157,6 +162,7 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private fun operationToLocalizedText(operation: LocalProfileNotification.Operation) =
|
||||
root.context.getText(
|
||||
when (operation) {
|
||||
|
@ -170,6 +176,10 @@ class NotificationsActivity: BaseEuiccAccessActivity(), OpenEuiccContextMarker {
|
|||
notification = value
|
||||
|
||||
address.text = value.inner.notificationAddress
|
||||
sequenceNumber.text = root.context.getString(
|
||||
R.string.profile_notification_sequence_number_format,
|
||||
value.inner.seqNumber
|
||||
)
|
||||
profileName.text = Html.fromHtml(
|
||||
root.context.getString(R.string.profile_notification_name_format,
|
||||
operationToLocalizedText(value.inner.profileManagementOperation),
|
||||
|
|
|
@ -15,6 +15,15 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notification_sequence_number"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginVertical="12dp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notification_profile_name"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -89,7 +89,6 @@
|
|||
<string name="profile_notification_operation_delete">削除しました</string>
|
||||
<string name="profile_notification_operation_enable">有効化しました</string>
|
||||
<string name="profile_notification_operation_disable">無効化しました</string>
|
||||
<string name="profile_notification_name_format"><b>%1$s</b> %2$s (%3$s)</string>
|
||||
<string name="profile_notification_process">処理</string>
|
||||
<string name="profile_notification_delete">削除</string>
|
||||
<string name="euicc_info">eUICC 情報</string>
|
||||
|
|
|
@ -103,7 +103,8 @@
|
|||
<string name="profile_notification_operation_delete">Deleted</string>
|
||||
<string name="profile_notification_operation_enable">Enabled</string>
|
||||
<string name="profile_notification_operation_disable">Disabled</string>
|
||||
<string name="profile_notification_name_format"><b>%1$s</b> %2$s (%3$s)</string>
|
||||
<string name="profile_notification_name_format" translatable="false"><b>%1$s</b> %2$s (%3$s)</string>
|
||||
<string name="profile_notification_sequence_number_format" translatable="false">#%d</string>
|
||||
<string name="profile_notification_process">Process</string>
|
||||
<string name="profile_notification_delete">Delete</string>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue