feat: show profile class with unfiltered profile list #86

Merged
PeterCxy merged 7 commits from septs/OpenEUICC:profile-class into master 2024-12-07 04:41:50 +01:00
4 changed files with 49 additions and 7 deletions

View file

@ -20,6 +20,7 @@ import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.isVisible
import androidx.core.view.updateLayoutParams
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
@ -339,6 +340,8 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
private val name: TextView = root.requireViewById(R.id.name)
private val state: TextView = root.requireViewById(R.id.state)
private val provider: TextView = root.requireViewById(R.id.provider)
private val profileClassLabel: TextView = root.requireViewById(R.id.profile_class_label)
private val profileClass: TextView = root.requireViewById(R.id.profile_class)
private val profileMenu: ImageButton = root.requireViewById(R.id.profile_menu)
init {
@ -364,6 +367,10 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
private lateinit var profile: LocalProfileInfo
fun setProfile(profile: LocalProfileInfo) {
if (unfilteredProfileListFlow.value) {
profileClassLabel.isVisible = true
profileClass.isVisible = true
}
this.profile = profile
name.text = profile.displayName
@ -375,6 +382,13 @@ open class EuiccManagementFragment : Fragment(), EuiccProfilesChangedListener,
}
)
provider.text = profile.providerName
if (profileClass.isVisible) profileClass.setText(
when (profile.profileClass) {
LocalProfileInfo.Clazz.Testing -> R.string.profile_class_testing
LocalProfileInfo.Clazz.Provisioning -> R.string.profile_class_provisioning
LocalProfileInfo.Clazz.Operational -> R.string.profile_class_operational
}
)
iccid.text = profile.iccid
iccid.transformationMethod = PasswordTransformationMethod.getInstance()
}

View file

@ -62,18 +62,43 @@
android:singleLine="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/state"
app:layout_constraintBottom_toTopOf="@+id/iccid_label"/>
app:layout_constraintBottom_toTopOf="@+id/profile_class_label"/>
<TextView
android:id="@+id/provider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginLeft="7dp"
android:layout_marginStart="7dp"
android:textSize="14sp"
android:singleLine="true"
app:layout_constraintLeft_toRightOf="@id/provider_label"
app:layout_constraintTop_toBottomOf="@id/state"
app:layout_constraintBottom_toTopOf="@+id/profile_class"/>
<TextView
android:id="@+id/profile_class_label"
android:text="@string/profile_class"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textSize="14sp"
android:textStyle="bold"
android:singleLine="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/provider_label"
app:layout_constraintBottom_toTopOf="@+id/iccid_label"/>
<TextView
android:id="@+id/profile_class"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginStart="7dp"
android:textSize="14sp"
android:singleLine="true"
app:layout_constraintLeft_toRightOf="@id/profile_class_label"
app:layout_constraintTop_toBottomOf="@id/provider"
app:layout_constraintBottom_toTopOf="@+id/iccid"/>
<TextView
@ -86,7 +111,7 @@
android:textStyle="bold"
android:singleLine="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/provider_label"
app:layout_constraintTop_toBottomOf="@id/profile_class_label"
app:layout_constraintBottom_toBottomOf="parent"/>
<TextView
@ -94,11 +119,11 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:layout_marginLeft="7dp"
android:layout_marginStart="7dp"
android:textSize="14sp"
android:singleLine="true"
app:layout_constraintLeft_toRightOf="@id/iccid_label"
app:layout_constraintTop_toBottomOf="@id/provider"
app:layout_constraintTop_toBottomOf="@id/profile_class"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -11,7 +11,6 @@
<string name="enabled">有効済み</string>
<string name="disabled">無効済み</string>
<string name="provider">プロバイダー:</string>
<string name="iccid">ICCID:</string>
<string name="enable">有効化</string>
<string name="disable">無効化</string>
<string name="delete">削除</string>

View file

@ -13,7 +13,11 @@
<string name="enabled">Enabled</string>
<string name="disabled">Disabled</string>
<string name="provider">Provider:</string>
<string name="iccid">ICCID:</string>
<string name="profile_class">Class:</string>
<string name="profile_class_testing">Testing</string>
<string name="profile_class_provisioning">Provisioning</string>
<string name="profile_class_operational">Operational</string>
<string name="iccid" translatable="false">ICCID:</string>
<string name="enable">Enable</string>
<string name="disable">Disable</string>