Fix limit data usage dialog body not being translated.
- need to pass the resource id instead of the text when building the dialog in order for it to react to language change. - also remove the unnecessary set/get the body message in the dialog creation since the msg id can be used directly. Change-Id: I399dcda54961fac457fc5f0fad9082f2c1e1a2b2 Fixes: 77897157 Test: run i18nscreenshots
This commit is contained in:
@@ -402,7 +402,6 @@ public class BillingCycleSettings extends DataUsageBase implements
|
|||||||
*/
|
*/
|
||||||
public static class ConfirmLimitFragment extends InstrumentedDialogFragment implements
|
public static class ConfirmLimitFragment extends InstrumentedDialogFragment implements
|
||||||
DialogInterface.OnClickListener {
|
DialogInterface.OnClickListener {
|
||||||
private static final String EXTRA_MESSAGE = "message";
|
|
||||||
@VisibleForTesting static final String EXTRA_LIMIT_BYTES = "limitBytes";
|
@VisibleForTesting static final String EXTRA_LIMIT_BYTES = "limitBytes";
|
||||||
public static final float FLOAT = 1.2f;
|
public static final float FLOAT = 1.2f;
|
||||||
|
|
||||||
@@ -414,16 +413,13 @@ public class BillingCycleSettings extends DataUsageBase implements
|
|||||||
if (policy == null) return;
|
if (policy == null) return;
|
||||||
|
|
||||||
final Resources res = parent.getResources();
|
final Resources res = parent.getResources();
|
||||||
final CharSequence message;
|
|
||||||
final long minLimitBytes = (long) (policy.warningBytes * FLOAT);
|
final long minLimitBytes = (long) (policy.warningBytes * FLOAT);
|
||||||
final long limitBytes;
|
final long limitBytes;
|
||||||
|
|
||||||
// TODO: customize default limits based on network template
|
// TODO: customize default limits based on network template
|
||||||
message = res.getString(R.string.data_usage_limit_dialog_mobile);
|
|
||||||
limitBytes = Math.max(5 * GIB_IN_BYTES, minLimitBytes);
|
limitBytes = Math.max(5 * GIB_IN_BYTES, minLimitBytes);
|
||||||
|
|
||||||
final Bundle args = new Bundle();
|
final Bundle args = new Bundle();
|
||||||
args.putCharSequence(EXTRA_MESSAGE, message);
|
|
||||||
args.putLong(EXTRA_LIMIT_BYTES, limitBytes);
|
args.putLong(EXTRA_LIMIT_BYTES, limitBytes);
|
||||||
|
|
||||||
final ConfirmLimitFragment dialog = new ConfirmLimitFragment();
|
final ConfirmLimitFragment dialog = new ConfirmLimitFragment();
|
||||||
@@ -441,11 +437,9 @@ public class BillingCycleSettings extends DataUsageBase implements
|
|||||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
final CharSequence message = getArguments().getCharSequence(EXTRA_MESSAGE);
|
|
||||||
|
|
||||||
return new AlertDialog.Builder(context)
|
return new AlertDialog.Builder(context)
|
||||||
.setTitle(R.string.data_usage_limit_dialog_title)
|
.setTitle(R.string.data_usage_limit_dialog_title)
|
||||||
.setMessage(message)
|
.setMessage(R.string.data_usage_limit_dialog_mobile)
|
||||||
.setPositiveButton(android.R.string.ok, this)
|
.setPositiveButton(android.R.string.ok, this)
|
||||||
.setNegativeButton(android.R.string.cancel, null)
|
.setNegativeButton(android.R.string.cancel, null)
|
||||||
.create();
|
.create();
|
||||||
|
Reference in New Issue
Block a user