自动填充卡槽信息到SIM1备注/SIM2备注(Android 8.0 以下)
This commit is contained in:
parent
3a53f02850
commit
c9312c3c74
|
@ -30,7 +30,6 @@
|
|||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".AboutActivity"
|
||||
android:label="关于" />
|
||||
|
|
|
@ -66,7 +66,12 @@ public class SettingUtil {
|
|||
}
|
||||
|
||||
public static String getAddExtraSim1() {
|
||||
return sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, "");
|
||||
String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM1, "");
|
||||
Log.d(TAG, "res=" + res);
|
||||
if (res == null || res.equals("")) {
|
||||
res = SimUtil.getSimExtra(1);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void setAddExtraSim1(String sim1) {
|
||||
|
@ -77,7 +82,11 @@ public class SettingUtil {
|
|||
}
|
||||
|
||||
public static String getAddExtraSim2() {
|
||||
return sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, "");
|
||||
String res = sp_setting.getString(Define.SP_MSG_KEY_STRING_ADD_EXTRA_SIM2, "");
|
||||
if (res == null || res.equals("")) {
|
||||
res = SimUtil.getSimExtra(2);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public static void setAddExtraSim2(String sim2) {
|
||||
|
|
|
@ -82,4 +82,23 @@ public class SimUtil {
|
|||
//Toast.makeText(MainActivity.this, "获取SIM卡信息失败:请先手动设置", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
|
||||
//获取卡槽备注
|
||||
public static String getSimExtra(int simId) {
|
||||
String res = "";
|
||||
try {
|
||||
for (Map.Entry<String, Map> entry : MyApplication.SimInfo.entrySet()) {
|
||||
Map<String, String> sim = entry.getValue();
|
||||
int sim_id = Integer.parseInt(sim.get("sim_id")) + 1;
|
||||
if (sim_id == simId) {
|
||||
res = sim.get("carrier_name") + "_" + sim.get("phone_number");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "getSimExtra Fail: " + e.getMessage());
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:text="运营商-手机号"
|
||||
android:text="运营商_手机号"
|
||||
android:textSize="9dp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -98,7 +98,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="end"
|
||||
android:text="运营商-手机号"
|
||||
android:text="运营商_手机号"
|
||||
android:textSize="9dp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
|
Loading…
Reference in New Issue