xiongzhu 11 maanden geleden
bovenliggende
commit
d9b63d1c16

+ 9 - 0
app/src/main/java/com/example/uicceditor/MainActivity.kt

@@ -273,6 +273,15 @@ class MainActivity : AppCompatActivity() {
             apduChannel.close()
         }
 
+        binding.btnReadSpn.setOnClickListener {
+            val apduChannel = ApduChannel(telephonyManager, AID)
+            apduChannel.select(SIMView.FID_MF)
+            apduChannel.select(SIMView.FID_DF_GSM)
+            apduChannel.select(SIMView.FID_EF_SPN)
+            binding.etSpn.setText(apduChannel.readBinary(30))
+            apduChannel.close()
+        }
+
         binding.btnReset.setOnClickListener {
             telephonyManager.rebootModem()
         }

+ 34 - 0
app/src/main/res/layout/activity_main.xml

@@ -348,6 +348,40 @@
                     android:text="WRITE" />
             </LinearLayout>
 
+            <com.google.android.material.textfield.TextInputLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="16dp"
+                android:hint="SPN">
+
+                <com.google.android.material.textfield.TextInputEditText
+                    android:id="@+id/et_spn"
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:lines="1" />
+            </com.google.android.material.textfield.TextInputLayout>
+
+            <LinearLayout
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:layout_marginTop="8dp"
+                android:gravity="center"
+                android:orientation="horizontal">
+
+                <com.google.android.material.button.MaterialButton
+                    android:id="@+id/btn_read_spn"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:text="READ" />
+
+                <com.google.android.material.button.MaterialButton
+                    android:id="@+id/btn_write_spn"
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_marginLeft="16dp"
+                    android:text="WRITE" />
+            </LinearLayout>
+
             <com.google.android.material.textfield.TextInputLayout
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"