Skip to content

Improvements to newfile dialog, open links, other fixes#2277

Merged
gsantner merged 12 commits into
gsantner:masterfrom
harshad1:improvements_to_newfile_dialog
May 19, 2024
Merged

Improvements to newfile dialog, open links, other fixes#2277
gsantner merged 12 commits into
gsantner:masterfrom
harshad1:improvements_to_newfile_dialog

Conversation

@harshad1
Copy link
Copy Markdown
Collaborator

@harshad1 harshad1 commented May 5, 2024

In this PR I have added the ability to format at new file title similarly to how we format snippets.

Additionally, we now remember template and name format per file type.

This should

EDIT:
I have merged in my open links in tags PR so more things have been pulled in here:

  1. Open any link in an html tag (such as our audio attachment format)
  2. Fixes for new files not showing when newfile dialog rotated
  3. Tweaks to prevent screen flashing when file opened in view mode

@harshad1
Copy link
Copy Markdown
Collaborator Author

harshad1 commented May 5, 2024

image

Comment thread app/src/main/assets/templates/cooking-recipe.md
Comment thread app/src/main/assets/templates/hugo-post-front-matter.md
Comment thread app/src/main/java/net/gsantner/markor/format/FormatRegistry.java
Comment thread app/src/main/java/net/gsantner/markor/frontend/NewFileDialog.java
Comment thread app/src/main/java/net/gsantner/markor/activity/MainActivity.java

public static class Format {
public final @StringRes int format, name;
public final String ext;
Copy link
Copy Markdown
Owner

@gsantner gsantner May 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion please make ext / it's handling as regex instead

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are just meant to be a source of truth, not used for matching etc. i.e. this says ' The canonical extension for markdown is ".md" '

Format and FORMATS is not meant to match or detect formats - that is left to the isFileOutOfThisFormat as before.

Comment thread app/src/main/java/net/gsantner/markor/format/FormatRegistry.java
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
try {
if (start < source.length() && dstart <= dest.length() && TextViewUtils.isNewLine(source, start, end)) {
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved some functions from TextViewUtils to GsTextUtils

public Collection<File> favouriteFiles, recentFiles, popularFiles = null;
public GsCallback.a1<CharSequence> setTitle = null, setSubtitle = null;

public GsCallback.a0 refresh = null;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted back to just having collections and added a refresh callback here. The refresh callback is called in loadFolder() and can be used to do whatever.

opts.recentFiles = appSettings.getRecentFiles();
opts.popularFiles = appSettings.getPopularFiles();
};
opts.refresh.callback();
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting the refresh callback to update sorting, fav file lists etc etc.

@gsantner gsantner added this to the Markor v2.13 milestone May 19, 2024
@gsantner gsantner merged commit f35383a into gsantner:master May 19, 2024
gsantner added a commit that referenced this pull request May 19, 2024
@gsantner
Copy link
Copy Markdown
Owner

Broke a few things -> #2297

@harshad1 harshad1 deleted the improvements_to_newfile_dialog branch August 18, 2024 19:16
@gsantner
Copy link
Copy Markdown
Owner

gsantner commented May 23, 2025

Hello @harshad1 , I found commit f35383a which duplicated the samples folder as well.

Now we have the samples here and here.

Which one is or should be the right one, do you know why did we not just keep the original one and have a copy statement to assets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment