feat: profile sequence number #197

Merged
PeterCxy merged 1 commit from septs/OpenEUICC:profile-sequence-number into master 2025-07-10 02:54:41 +02:00
4 changed files with 22 additions and 1 deletions

View file

@ -347,6 +347,7 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
private val profileClassLabel: TextView = root.requireViewById(R.id.profile_class_label) private val profileClassLabel: TextView = root.requireViewById(R.id.profile_class_label)
private val profileClass: TextView = root.requireViewById(R.id.profile_class) private val profileClass: TextView = root.requireViewById(R.id.profile_class)
private val profileMenu: ImageButton = root.requireViewById(R.id.profile_menu) private val profileMenu: ImageButton = root.requireViewById(R.id.profile_menu)
private val profileSeqNumber: TextView = root.requireViewById(R.id.profile_sequence_number)
init { init {
iccid.setOnClickListener { iccid.setOnClickListener {
@ -366,7 +367,9 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
true true
} }
profileMenu.setOnClickListener { showOptionsMenu() } profileMenu.setOnClickListener {
showOptionsMenu()
}
} }
private lateinit var profile: LocalProfileInfo private lateinit var profile: LocalProfileInfo
@ -396,6 +399,13 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
iccid.transformationMethod = PasswordTransformationMethod.getInstance() iccid.transformationMethod = PasswordTransformationMethod.getInstance()
} }
fun setProfileSequenceNumber(index: Int) {
profileSeqNumber.text = root.context.getString(
R.string.profile_sequence_number_format,
index,
)
}
private fun showOptionsMenu() { private fun showOptionsMenu() {
// Prevent users from doing multiple things at once // Prevent users from doing multiple things at once
if (invalid || swipeRefresh.isRefreshing) return if (invalid || swipeRefresh.isRefreshing) return
@ -461,6 +471,7 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
when (holder) { when (holder) {
is ProfileViewHolder -> { is ProfileViewHolder -> {
holder.setProfile(profiles[position]) holder.setProfile(profiles[position])
holder.setProfileSequenceNumber(position + 1)
} }
is FooterViewHolder -> { is FooterViewHolder -> {
holder.attach(footerViews[position - profiles.size]) holder.attach(footerViews[position - profiles.size])

View file

@ -129,6 +129,14 @@
app:layout_constraintTop_toBottomOf="@id/profile_class" app:layout_constraintTop_toBottomOf="@id/profile_class"
app:layout_constraintBottom_toBottomOf="parent"/> app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
android:id="@+id/profile_sequence_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/iccid" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>

View file

@ -27,6 +27,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="16dp" android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:contentDescription="@string/profile_download"
android:src="@drawable/ic_add" android:src="@drawable/ic_add"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/> app:layout_constraintBottom_toBottomOf="parent"/>

View file

@ -19,6 +19,7 @@
<string name="profile_class_provisioning">Provisioning</string> <string name="profile_class_provisioning">Provisioning</string>
<string name="profile_class_operational">Operational</string> <string name="profile_class_operational">Operational</string>
<string name="iccid" translatable="false">ICCID:</string> <string name="iccid" translatable="false">ICCID:</string>
<string name="profile_sequence_number_format" translatable="false">#%d</string>
<string name="enable">Enable</string> <string name="enable">Enable</string>
<string name="disable">Disable</string> <string name="disable">Disable</string>