Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navigation and highlighting improvements #2377

Merged
merged 34 commits into from
Sep 16, 2024

Conversation

harshad1
Copy link
Collaborator

@harshad1 harshad1 commented Jul 29, 2024

This adds several improvements to file browsing and navigation

  1. Better handling + fixes to handling of special / virtual folders
  2. back goes to previous folder (needs to be refined more). Addresses Back button should return to the previous directory instead of the parent directory #2337
  3. Fixed activity back-stack and link navigation

Todo:

  • Fix file dialog subtitle padding and truncation
  • Back should ask before closing markor

I have also added other things to this PR now

  1. Highlighting happens in a separate thread making it less janky when typing fast (especially in very long todo lists)
  2. We had a lot of code which did not check if selection was invalid - added defensive logic everywhere
  3. Several cleanups
  4. Remember share into format as link state from last time

loadFolder(_dopt.startFolder != null ? _dopt.startFolder : _dopt.rootFolder, null);
}

public Map<File, File> getVirtualFolders() {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Populate virtual folders at start

Copy link
Owner

Choose a reason for hiding this comment

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

can't find the issue, but I recall there being topics about virtual lists not outdated

@harshad1 harshad1 changed the title WIP: Navigation improvements Navigation improvements Aug 16, 2024
@harshad1 harshad1 changed the title Navigation improvements WIP: Navigation improvements Aug 16, 2024
@@ -224,7 +224,7 @@ protected void afterOnCreate(Bundle savedInstances, Context context) {
if (_editor != null && _linkCheckBox != null) {
doUpdatePreferences();
_linkCheckBox.setVisibility(hasLinks(_editor.getText()) ? View.VISIBLE : View.GONE);
_linkCheckBox.setChecked(true);
_linkCheckBox.setChecked(_appSettings.getFormatShareAsLink());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Remember share option

@@ -474,36 +474,48 @@ public static void runRegexReplaceAction(final Editable editable, final ReplaceP

private static void runRegexReplaceAction(final Editable editable, final List<ReplacePattern> patterns) {

TextViewUtils.withKeepSelection(editable, (selStart, selEnd) -> {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Got rid of this method - we use it rarely and it replaces 3 lines of code

TextViewUtils.withKeepSelection(editable, (selStart, selEnd) -> {
final int[] sel = TextViewUtils.getSelection(editable);
if (sel[0] < 0) {
return;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sel[0] < 0 means invalid / no selection.

We were not testing for this which means actions were likely silently failing. Added these tests

_title = GsFileUtils.getFilenameWithoutExtension(_file);
_fileExtension = GsFileUtils.getFilenameExtension(_file);
public Document(@NonNull final File f) {
path = getPath(f);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should use the canonical path always. Absolute path can include ../

@@ -299,4 +318,30 @@ public void onStart() {
w.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
}
}

private static void setSubtitleApprearance(final Toolbar toolbar) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Find and set a dialog subtitle appearance. This is a little hacky but it works correctly every time.

@harshad1 harshad1 changed the title Navigation and other improvements Navigation and highlighting improvements Aug 28, 2024
@harshad1
Copy link
Collaborator Author

@gsantner Do you know why this build is failing?

@gsantner
Copy link
Owner

Seems that either a repository went down under, or GitHub actions has network issues (which also happens from time to time). It would be weird if suddenly two libraries would go to nirvana on it's own.

Could not resolve all files for configuration ':app:flavorDefaultDebugRuntimeClasspath'.
Failed to transform library-1.1.8.aar (com.pixplicity.generate:library:1.1.8) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Could not find library-1.1.8.jar (com.pixplicity.generate:library:1.1.8).
Searched in the following locations:
https://jcenter.bintray.com/com/pixplicity/generate/library/1.1.8/library-1.1.8.aar
https://jcenter.bintray.com/com/pixplicity/generate/library/1.1.8/library-1.1.8.jar
Failed to transform om-recorder-1.1.5.aar (com.kailashdabhi:om-recorder:1.1.5) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Could not find om-recorder-1.1.5.jar (com.kailashdabhi:om-recorder:1.1.5).
Searched in the following locations:
https://jcenter.bintray.com/com/kailashdabhi/om-recorder/1.1.5/om-recorder-1.1.5.aar
https://jcenter.bintray.com/com/kailashdabhi/om-recorder/1.1.5/om-recorder-1.1.5.jar

@harshad1
Copy link
Collaborator Author

harshad1 commented Sep 4, 2024

Also now included are fixes for the build failing.

@gsantner this is ready to merge

implementation 'com.github.AppIntro:AppIntro:6.2.0'
implementation 'com.kailashdabhi:om-recorder:1.1.5'
implementation 'com.github.kailash09dabhi:OmRecorder:1.1.5'
implementation 'com.github.mertakdut:EpubParser:1.0.95'
implementation 'com.github.martin-stone:hsv-alpha-color-picker-android:3.1.0'
Copy link
Owner

Choose a reason for hiding this comment

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

Thank you for checking the new installation options and fixing it

@gsantner
Copy link
Owner

Thanks, merging

@gsantner gsantner merged commit c5fe529 into gsantner:master Sep 16, 2024
1 check passed
elyahw pushed a commit to writing-tools/marelias-notepad that referenced this pull request Sep 26, 2024
…ntner#2409 closes gsantner#2410)

* Many fixes to navigation and go back
* Cleanups to fragment handling
* Tweaks to showing keyboard
* Final tweaks to activity stacks
* Removed unnecessary 'synchronized' calls for perf
* Tweaks to highlighting
* Reverted some highlighting changes
* Fix template cursor start
* Improvements to display of file browser dialog / fragment
* Initial set of changes for async
* Using canonical paths and and static members
* Defensive logic for indices
* Batching fixup for reduced computation
* Switching back to start end as it made no difference
* Tweaks to launching; file paths -> canonical
* Fixed wikitext link formatting

(cherry picked from commit c5fe529)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use a single process for the whole app Sharing links from browser to Zim wiki notes
3 participants