1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-08-13 17:03:48 -04:00
k-9/src/com/fsck/k9/activity/SizeFormatter.java

26 lines
693 B
Java
Raw Normal View History

package com.fsck.k9.activity;
2009-02-12 16:49:20 -05:00
import android.content.Context;
import com.fsck.k9.R;
2009-02-12 16:49:20 -05:00
public class SizeFormatter
{
public static String formatSize(Context context, long size)
{
if (size > 1024000000)
{
return ((float)(size / 102400000) / 10) + context.getString(R.string.abbrev_gigabytes);
}
if (size > 1024000)
{
return ((float)(size / 102400) / 10) + context.getString(R.string.abbrev_megabytes);
}
if (size > 1024)
{
return ((float)(size / 102) / 10) + context.getString(R.string.abbrev_kilobytes);
}
return size + context.getString(R.string.abbrev_bytes);
2009-02-12 16:49:20 -05:00
}
2009-02-12 16:49:20 -05:00
}