forked from organicmaps/organicmaps
[android] Use system locale for map size and download progress strings
Signed-off-by: Gonzalo Pesquero <gpesquero@yahoo.es>
This commit is contained in:
parent
db7bc664c5
commit
7c6da4d6ff
3 changed files with 9 additions and 3 deletions
|
@ -192,7 +192,7 @@ public class CountrySuggestFragment extends BaseMwmFragment implements View.OnCl
|
|||
|
||||
private void updateProgress()
|
||||
{
|
||||
String text = StringUtils.formatUsingUsLocale("%1$s %2$.2f%%", getString(R.string.downloader_downloading),
|
||||
String text = StringUtils.formatUsingSystemLocale("%1$s %2$.2f%%", getString(R.string.downloader_downloading),
|
||||
mDownloadingCountry.progress);
|
||||
mTvProgress.setText(text);
|
||||
mWpvDownloadProgress.setProgress(Math.round(mDownloadingCountry.progress));
|
||||
|
|
|
@ -140,7 +140,7 @@ public class OnmapDownloader implements MwmActivity.LeftAnimationTrackListener
|
|||
{
|
||||
mProgress.setPending(false);
|
||||
mProgress.setProgress(Math.round(mCurrentCountry.progress));
|
||||
sizeText = StringUtils.formatUsingUsLocale("%1$s %2$.2f%%",
|
||||
sizeText = StringUtils.formatUsingSystemLocale("%1$s %2$.2f%%",
|
||||
mActivity.getString(R.string.downloader_downloading), mCurrentCountry.progress);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -19,6 +19,11 @@ public class StringUtils
|
|||
return String.format(Locale.US, pattern, args);
|
||||
}
|
||||
|
||||
public static String formatUsingSystemLocale(String pattern, Object... args)
|
||||
{
|
||||
return String.format(Locale.getDefault(), pattern, args);
|
||||
}
|
||||
|
||||
public static native boolean nativeIsHtml(String text);
|
||||
|
||||
public static native boolean nativeContainsNormalized(String str, String substr);
|
||||
|
@ -36,6 +41,7 @@ public class StringUtils
|
|||
/**
|
||||
* Formats size in bytes to "x MB" or "x.x GB" format.
|
||||
* Small values rounded to 1 MB without fractions.
|
||||
* Decimal separator character depends on system locale.
|
||||
*
|
||||
* @param context context for getString()
|
||||
* @param size size in bytes
|
||||
|
@ -53,7 +59,7 @@ public class StringUtils
|
|||
}
|
||||
|
||||
float value = ((float) size / Constants.GB);
|
||||
return formatUsingUsLocale("%1$.1f %2$s", value, MwmApplication.from(context).getString(R.string.gb));
|
||||
return formatUsingSystemLocale("%1$.1f %2$s", value, MwmApplication.from(context).getString(R.string.gb));
|
||||
}
|
||||
|
||||
public static boolean isRtl()
|
||||
|
|
Loading…
Add table
Reference in a new issue