Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d43eff23 authored by Roman Birg's avatar Roman Birg
Browse files

Settings: update Data Usage summary multi sim title



Change tab names to match the About SIM tabs and Mobile networks tabs as
well.

Change-Id: I401a7a9e57a0f87fd99f6835d5a91b26ff930ad9
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 5c24a3d4
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2562,7 +2562,8 @@ public class DataUsageSummary extends Fragment {
        if (i <= 0) {
            return "";
        } else {
            return getText(R.string.data_usage_tab_slot).toString() + i;
            String label = MultiSimSettings.getFormattedSimName(getActivity(), i - 1);
            return getString(R.string.multi_sim_entry_format, operatorName, i);
        }
    }

+19 −13
Original line number Diff line number Diff line
@@ -194,21 +194,9 @@ public class MultiSimSettings extends PreferenceActivity implements DialogInterf
    }

    private int updateSimNameEntries()  {
        MSimTelephonyManager tm = MSimTelephonyManager.getDefault();
        int i = 0;
        for (i = 0; i < MAX_SUBSCRIPTIONS; i++) {
            String label = Settings.Global.getSimNameForSubscription(this, i, null);
            if (TextUtils.isEmpty(label)) {
                String operatorName = tm.getSimOperatorName(i);
                if (tm.getSimState(i) == SIM_STATE_ABSENT || tm.getSimState(i) != SIM_STATE_READY
                        || TextUtils.isEmpty(operatorName)) {
                    label = getString(R.string.multi_sim_entry_format_no_carrier, i + 1);
                } else {
                    label = getString(R.string.multi_sim_entry_format, operatorName, i + 1);
                }
            } else {
                label = getString(R.string.multi_sim_entry_format, label, i + 1);
            }
            String label = getFormattedSimName(this, i);
            entries[i] = summaries[i] = label;
            entriesPrompt[i] = summariesPrompt[i] = label;
            entryValues[i] = Integer.toString(i);
@@ -733,4 +721,22 @@ public class MultiSimSettings extends PreferenceActivity implements DialogInterf
        return Settings.Global.getInt(getApplicationContext().getContentResolver(),
                Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
    }

    public static String getFormattedSimName(Context context, int subscription) {
        String label = Settings.Global.getSimNameForSubscription(context, subscription, null);
        if (TextUtils.isEmpty(label)) {
            MSimTelephonyManager tm = MSimTelephonyManager.getDefault();
            String operatorName = tm.getSimOperatorName(subscription);
            if (tm.getSimState(subscription) == SIM_STATE_ABSENT
                    || tm.getSimState(subscription) != SIM_STATE_READY
                    || TextUtils.isEmpty(operatorName)) {
                label = context.getString(R.string.multi_sim_entry_format_no_carrier, subscription + 1);
            } else {
                label = context.getString(R.string.multi_sim_entry_format, operatorName, subscription + 1);
            }
        } else {
            label = context.getString(R.string.multi_sim_entry_format, label, subscription + 1);
        }
        return label;
    }
}