Skip to content

Commit

Permalink
Switching to list for ease of use
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed May 22, 2024
1 parent 1a1e487 commit b676364
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
import net.gsantner.markor.model.Document;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;

public class FormatRegistry {
Expand Down Expand Up @@ -90,7 +92,7 @@ public static class Format {
}

// Order here is used to **determine** format by it's file extension and/or content heading
public static final Format[] FORMATS = new Format[]{
public static final List<Format> FORMATS = Arrays.asList(
new Format(FormatRegistry.FORMAT_MARKDOWN, R.string.markdown, ".md", CONVERTER_MARKDOWN),
new Format(FormatRegistry.FORMAT_CSV, R.string.csv, ".csv", CONVERTER_CSV),
new Format(FormatRegistry.FORMAT_TODOTXT, R.string.todo_txt, ".todo.txt", CONVERTER_TODOTXT),
Expand All @@ -100,9 +102,8 @@ public static class Format {
new Format(FormatRegistry.FORMAT_PLAIN, R.string.plaintext, ".txt", CONVERTER_PLAINTEXT),
new Format(FormatRegistry.FORMAT_EMBEDBINARY, R.string.embed_binary, ".jpg", CONVERTER_EMBEDBINARY),
new Format(FormatRegistry.FORMAT_ORGMODE, R.string.orgmode, ".org", CONVERTER_ORGMODE),
new Format(FormatRegistry.FORMAT_UNKNOWN, R.string.none, "", null),
};

new Format(FormatRegistry.FORMAT_UNKNOWN, R.string.none, "", null)
);

public static boolean isFileSupported(final File file, final boolean... textOnly) {
final boolean textonly = textOnly != null && textOnly.length > 0 && textOnly[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,8 @@ private AlertDialog.Builder makeDialog(final File basedir, final boolean allowCr

// Build a list of available formats
// -----------------------------------------------------------------------------------------
final List<FormatRegistry.Format> allFormats = Arrays.asList(FormatRegistry.FORMATS);
final List<FormatRegistry.Format> formats = GsCollectionUtils.map(
NEW_FILE_FORMATS, t -> GsCollectionUtils.selectFirst(allFormats, f -> f.format == t));
NEW_FILE_FORMATS, t -> GsCollectionUtils.selectFirst(FormatRegistry.FORMATS, f -> f.format == t));

// Setup title format spinner and actions
// -----------------------------------------------------------------------------------------
Expand Down

0 comments on commit b676364

Please sign in to comment.