Improved large files list

pull/194/merge
M66B 3 years ago
parent 1ea8c5a086
commit 63306fcd1c

@ -39,6 +39,7 @@ import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.style.RelativeSizeSpan; import android.text.style.RelativeSizeSpan;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.text.style.TypefaceSpan;
import android.util.Pair; import android.util.Pair;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
@ -1150,7 +1151,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
@Override @Override
protected void onExecuted(Bundle args, List<File> files) { protected void onExecuted(Bundle args, List<File> files) {
StringBuilder sb = new StringBuilder(); SpannableStringBuilder ssb = new SpannableStringBuilderEx();
final Context context = getContext(); final Context context = getContext();
File dataDir = (Build.VERSION.SDK_INT < Build.VERSION_CODES.N File dataDir = (Build.VERSION.SDK_INT < Build.VERSION_CODES.N
@ -1159,23 +1160,28 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
File cacheDir = context.getCacheDir(); File cacheDir = context.getCacheDir();
if (dataDir != null) if (dataDir != null)
sb.append("Data: ").append(dataDir).append("\r\n"); ssb.append("Data: ").append(dataDir.getAbsolutePath()).append("\r\n");
if (filesDir != null) if (filesDir != null)
sb.append("Files: ").append(filesDir).append("\r\n"); ssb.append("Files: ").append(filesDir.getAbsolutePath()).append("\r\n");
if (cacheDir != null) if (cacheDir != null)
sb.append("Cache: ").append(cacheDir).append("\r\n"); ssb.append("Cache: ").append(cacheDir.getAbsolutePath()).append("\r\n");
sb.append("\r\n"); ssb.append("\r\n");
for (File file : files) for (File file : files) {
sb.append(Helper.humanReadableByteCount(file.length())) int start = ssb.length();
.append(' ') ssb.append(Helper.humanReadableByteCount(file.length()));
ssb.setSpan(new StyleSpan(Typeface.BOLD), start, ssb.length(), 0);
ssb.append(' ')
.append(file.getAbsolutePath()) .append(file.getAbsolutePath())
.append("\r\n"); .append("\r\n");
}
ssb.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_SMALL), 0, ssb.length(), 0);
new AlertDialog.Builder(context) new AlertDialog.Builder(context)
.setIcon(R.drawable.twotone_info_24) .setIcon(R.drawable.twotone_info_24)
.setTitle(title) .setTitle(title)
.setMessage(sb.toString()) .setMessage(ssb)
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {

Loading…
Cancel
Save