This commit is contained in:
Victor Shcherb 2020-01-20 17:44:08 +01:00
parent d005712d00
commit b172932478
6 changed files with 8 additions and 10 deletions

View file

@ -234,7 +234,7 @@ public class AndroidUtils {
if(ctx == null) {
return size + " " + numSuffix;
}
return ctx.getString(R.string.ltr_or_rtl_combine_via_colon, size, numSuffix);
return ctx.getString(R.string.ltr_or_rtl_combine_via_space, size, numSuffix);
}
return "";
}

View file

@ -8,6 +8,7 @@ import android.os.Build;
import android.os.StatFs;
import android.support.v7.preference.Preference;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmAndAppCustomization;
import net.osmand.plus.OsmandPlugin;
@ -306,13 +307,12 @@ public class MultimediaNotesFragment extends BaseSettingsFragment {
if (value != size) {
gbList.add((int) size);
}
MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
String[] entries = new String[gbList.size()];
Integer[] entryValues = new Integer[gbList.size()];
int i = 0;
for (int v : gbList) {
entryValues[i] = v;
entries[i] = formatGb.format(new Object[] {(float) v});
entries[i] = AndroidUtils.formatSize(getActivity(), v * (1l << 30));
i++;
}

View file

@ -11,6 +11,7 @@ import android.preference.ListPreference;
import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen;
import net.osmand.AndroidUtils;
import net.osmand.PlatformUtil;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
@ -272,13 +273,12 @@ public class SettingsAudioVideoActivity extends SettingsBaseActivity {
if (value != size) {
gbList.add((int) size);
}
MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
entries = new String[gbList.size()];
intValues = new Integer[gbList.size()];
i = 0;
for (int v : gbList) {
intValues[i] = v;
entries[i] = formatGb.format(new Object[]{(float) v});
entries[i] = AndroidUtils.formatSize(this, v * (1l << 30));
i++;
}

View file

@ -57,7 +57,6 @@ public class DashChooseAppDirFragment {
public static final int VERSION_DEFAULTLOCATION_CHANGED = 19;
private TextView locationPath;
private TextView locationDesc;
MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
private View copyMapsBtn;
private ImageView editBtn;
private View dontCopyMapsBtn;
@ -93,8 +92,7 @@ public class DashChooseAppDirFragment {
private String getFreeSpace(File dir) {
if (dir.canRead()) {
StatFs fs = new StatFs(dir.getAbsolutePath());
return formatGb
.format(new Object[] { (float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30) });
return AndroidUtils.formatSize(activity, (long) fs.getAvailableBlocks()) * fs.getBlockSize() );
}
return "";
}

View file

@ -5,6 +5,7 @@ import java.io.IOException;
import java.text.DateFormat;
import java.util.Date;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants;
import net.osmand.PlatformUtil;
import net.osmand.map.OsmandRegions;

View file

@ -77,7 +77,6 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
private View view;
private DownloadIndexesThread downloadThread;
private DownloadValidationManager validationManager;
private MessageFormat formatGb = new MessageFormat("{0, number,#.##} GB", Locale.US);
private static WizardType wizardType;
private static final WizardType DEFAULT_WIZARD_TYPE = WizardType.SEARCH_LOCATION;
@ -739,7 +738,7 @@ public class FirstUsageWizardFragment extends BaseOsmAndFragment implements OsmA
private String getFreeSpace(File dir) {
if (dir.canRead()) {
StatFs fs = new StatFs(dir.getAbsolutePath());
return formatGb.format(new Object[]{(float) (fs.getAvailableBlocks()) * fs.getBlockSize() / (1 << 30)});
return AndroidUtils.formatSize(getActivity(), (long) fs.getAvailableBlocks()) * fs.getBlockSize() );
}
return "";
}