Settings: Improve RAM summary for devices >12GB of RAM

* settings: Improve RAM summary formatting to show one decimal place

* settings: Update RAM formatting to use gigabytes with no decimal places + base 10 units for closer accuracy to advertised RAM sizes
This commit is contained in:
andy
2025-03-06 04:01:32 +11:00
committed by Joey
parent b52dea13a3
commit 96d8d44bcd

View File

@@ -54,26 +54,11 @@ public class TotalRAMPreferenceController extends BasePreferenceController {
actManager.getMemoryInfo(memInfo); actManager.getMemoryInfo(memInfo);
long totRam = memInfo.totalMem; long totRam = memInfo.totalMem;
double gb = (double) totRam / 1073741824.0; double gb = (double) totRam / 1000000000.0;
String aproxRam; DecimalFormat df = new DecimalFormat("#");
if (gb > 0 && gb <= 2) { String formattedRam = df.format(gb);
aproxRam = "2";
} else if (gb <= 3) {
aproxRam = "3";
} else if (gb <= 4) {
aproxRam = "4";
} else if (gb <= 6) {
aproxRam = "6";
} else if (gb <= 8) {
aproxRam = "8";
} else if (gb <= 12) {
aproxRam = "12";
} else {
aproxRam = "12+";
}
String actualRam = aproxRam.concat(" GB"); return formattedRam + " GB";
return actualRam;
} }
} }