Fix mvno data field summary not update issue

With current code logic, whenever user changing
mvno type, it only updates mvno data field text,
but the summary is not get updated.
For example, there is an apn configured as mvno
type 'GID' and mvno data 'FF', and user changes
mvno type to:
1. 'none' then save, the APN is saved with mvno
   type 'none' and mvno data 'FF' while it is
   better to save mvno data as empty value.
2. 'imsi', although the APN can be saved with mvno
   type 'imsi' and mvno data 'mcc + mnc + x',
   the UI still display mvno data field as 'FF'
   unchanged(until user edit mvno data then save)
   while the mvno data text is already changed to
   'mcc + mnc + x'. It is better to also update
   mvno data summary as 'mcc + mnc + x'

With current patch, either adding new apn or edit
exist apn, the mvno data field summary is always
consistent with latest mvno data field text, which
won't make user feel confused.

Test: Build and manual test on device.
Change-Id: Ica72e246296c20a6d20283b315e6e6c46e80ac08
Signed-off-by: Wei Huang <hwbest.v@gmail.com>
Signed-off-by: Honggang Luo <luo.loky@gmail.com>
Signed-off-by: Chao Yuan <chaoyuanx@gmail.com>
This commit is contained in:
Wei Huang
2020-07-03 04:33:45 +08:00
parent b1cea4f1bc
commit 012c5858c9

View File

@@ -754,6 +754,9 @@ public class ApnEditor extends SettingsPreferenceFragment
telephonyManager = telephonyManagerForSubId;
}
mMvnoMatchData.setText(telephonyManager.getGroupIdLevel1());
} else {
// mvno type 'none' case. At this time, mvnoIndex should be 0.
mMvnoMatchData.setText("");
}
}
@@ -805,6 +808,7 @@ public class ApnEditor extends SettingsPreferenceFragment
}
mMvnoType.setValue((String) newValue);
mMvnoType.setSummary(mvno);
mMvnoMatchData.setSummary(checkNull(mMvnoMatchData.getText()));
} else if (KEY_PASSWORD.equals(key)) {
mPassword.setSummary(starify(newValue != null ? String.valueOf(newValue) : ""));
} else if (KEY_CARRIER_ENABLED.equals(key)) {