1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-11-27 06:41:15 +00:00

Commented original source of readable file size/transfer rate functions.

This commit is contained in:
Felix Ableitner 2015-07-14 01:30:48 +02:00
parent 512b79fff1
commit 867e5d1ede

View file

@ -509,6 +509,8 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
/** /**
* Converts a number of bytes to a human readable file size (eg 3.5 GiB). * Converts a number of bytes to a human readable file size (eg 3.5 GiB).
*
* Based on http://stackoverflow.com/a/5599842
*/ */
public static String readableFileSize(Context context, long bytes) { public static String readableFileSize(Context context, long bytes) {
final String[] units = context.getResources().getStringArray(R.array.file_size_units); final String[] units = context.getResources().getStringArray(R.array.file_size_units);
@ -521,6 +523,8 @@ public class RestApi implements SyncthingService.OnWebGuiAvailableListener,
/** /**
* Converts a number of bytes to a human readable transfer rate in bytes per second * Converts a number of bytes to a human readable transfer rate in bytes per second
* (eg 100 KiB/s). * (eg 100 KiB/s).
*
* Based on http://stackoverflow.com/a/5599842
*/ */
public static String readableTransferRate(Context context, long bits) { public static String readableTransferRate(Context context, long bits) {
final String[] units = context.getResources().getStringArray(R.array.transfer_rate_units); final String[] units = context.getResources().getStringArray(R.array.transfer_rate_units);