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

Implementation changes and extensions #20

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open

Conversation

Mick2nd
Copy link

@Mick2nd Mick2nd commented Apr 24, 2024

  • Enlarged view area for DEBUG output
  • Extended debug view content
  • Html frame based on assets file index.html
  • Enabled script execution and pure text transfer
  • Added assets loader for javascript and css files

Added functionality (flexmark extensions):

  • SubscriptExtension instead of StrikethroughExtension (subscript not working with strikethrough)
  • SuperscriptExtension
  • TocExtension
  • GitlabExtension with Mermaid and Katex support
  • AdmonitionExtension
  • enabled checkboxes in TaskListExtension

- Enlarged view area for DEBUG output
- Extended debug view content
- Html frame based on assets file index.html
- Enabled script execution and pure text transfer
- Added assets loader for javascript and css files

Added functionality (flexmark extensions):
- SubscriptExtension instead of StrikethroughExtension
  (subscript not working with strikethrough)
- SuperscriptExtension
- TocExtension
- GitlabExtension with Mermaid and Katex support
- AdmonitionExtension
- enabled checkboxes in TaskListExtension
@Mick2nd
Copy link
Author

Mick2nd commented Apr 24, 2024

Hi Tiim,
I want to use this nice widget for my own purpose but the functionality should be extended.
Treat this request as proposal how things could be done (see the commit message).
Thanks
Mick2nd

@Mick2nd
Copy link
Author

Mick2nd commented Apr 27, 2024

Hi Tiim,
I do not know, if You got this info. In the mean time I detected that my PR was not fully working. Especially the widgets themselves did not render. But I worked hard to find a solution for this problem and I found one. I will create a new PR with the newest changes soon.
I believe the main disadvantage of my solution (in the PR) is the memory consumption. This must definitely be optimized.
Thanks
Mick2nd

Bug Fixes to properly display widget when
- size modified
- widget created for the first time
Support for userstyle.css styles file
Known problems
- widgets to updating after change of userstyle.css
- update mechanism added, but not functional
@Mick2nd
Copy link
Author

Mick2nd commented May 1, 2024

My first commit was buggy so that the widgets were not displayed properly.
The most important change is the bug fix.

Sample Screenshot with a table, a diagram and a math formula

Screenshot_20240501_091306(3)

Mick2nd added 9 commits May 15, 2024 21:06
new concepts and fixes
- app specific style sheets
- handler for location of userstyle.css in external storage
- added code highlighting library
Bug Fixes to properly display widget when
- size modified
- widget created for the first time
Known problems
- widgets to update after change of userstyle.css
- update mechanism added, but not functional
Dagger integrated for DI
Bug fix
- Correct display of widgets after restart
Known problems
- widgets to update after change of userstyle.css
- update mechanism added, but not functional
- Comments improved
- Preferences as central place for settings
- Other improvements
- Comments improved
- Preferences as central place for settings
- Other improvements
- Begin with unit tests
Problems
- UpdateService not working with Documents folder
- Comments improved
- Begin with unit tests
- DI improved
Problems
- UpdateService not working with Documents folder
- DI improved
- prepared for Hilt
Problems
- UpdateService not working with Documents folder
- use @DisableInstallInCheck to make sources compile
- Debug screen resolution improved
- Added button to revoke permission for user folder
- Added unit tests with and without Hilt support
Problems:
- Widget updates slowly on real tablet
- userstyle.css not working on real tablet although permission was granted
- Widget updates slowly on real tablet
- userstyle.css not working on real tablet although permission was granted
- weird behavior of permission request
Improvements:
- one screen dimension used to define scaling behavior (no longer a MarkdownRenderer parameter)
- preprocessing for $$...$$ delimited math
- additional unit tests for his case
- prepared for configurable zoom
@Mick2nd
Copy link
Author

Mick2nd commented Jun 6, 2024

Improvements Overview

  1. Flexmark Parser extensions and improvements
    1. Use Subscript and Superscript extensions instead of Strikethrough as Strikethrough does not include Subscript (tested).
    2. Configure Tables extension, for instance with html class attribute.
    3. Style Tables, see default.css in assets folder.
    4. Add TOC (Table Of Contents) extension.
    5. Equip with class attribute for further use in CSS.
    6. Equip Task List extension with class attribute.
    7. Make Task items enabled (not grayed out)
    8. Add Admonition extension, added CSS and JS to index.html for styling.
    9. Add GitLab extension.
      1. Katex - CSS and JS library added
      2. Mermaid - CSS and JS library added to assets folder and included in index.html.
    10. Add Code Highlighting by including CSS and JS. Code Fences with language specification like python are recognized and and highlighted. A selection of the most common languages was done.
  2. Web page source code, CSS files, JS files are now located in the assets folder. They are loaded in WebView from there using a assetLoader.shouldInterceptRequest API.
    1. The Asset Loader supports loading from asset folder and from a user defined global folder like the Documents folder.
    2. A user defined userstyle.css file can be used to fine-tune CSS settings.
    3. The user must grant permission to an user selected folder where the CSS file resides.
    4. The Quotes blocks are stylized by CSS (Styles from the Internet).
    5. App wide Zoom setting prepared.
  3. The markdown parser is further equipped by a preparser. It is responsible for transforming the Math delimiters as used by Joplin into the Flexmark compatible ones.
  4. The application is equipped now with the Hilt DI framework, provided by Google.
  5. Add Unit Tests. Full test of markdown parser.

Bugs

  1. FileContentObserver, PackageReplacedReceiver, UpdateService not working. They are intended to recognize changes of the userstyle.css file and update the widgets accordingly.
  2. Some settings should be made configurable like Zoom, usage of userstyle.css etc.

Mick2nd added 11 commits June 7, 2024 07:43
- Preprocessing of md with Parser library Konbini
- ParserTest and other tests adapted
- Html pages from internet can be used in widgets
- A Content Cache speeds up the access
- User interface of Main Activity changed - we have now a Tab Layout with 2 supported fragments and are thus open for extensions.
- In the ConfigureFragment we have:
- a Zoom setting
- a Use Userstyle.css checkbox
- a Revoke Permissions button
- a Refresh Widgets button
Additionally we now wrap the content of a widget and no longer clip it on the right side.
- In the ConfigureFragment we have:
- use binding
- all IO access is now done in an IO thread, leaving the UI from those tasks
-- Internet HTTP
-- MD file io
-- Shared Preferences
- the widget configure activity now uses registerForActivityResult
- zoom setting is now done using a Spinner with fixed Zoom list
- removed some not working services (f.i. UpdateService)
- tests for PendingIntent to invoke our self
- rolled back changes in Manifest, because app icon was not installed
- added additional fragments: Editor and Preview to main activity
- case where tap of app widget invokes MainActivity
- optimization of ContentCache and Preferences
- bug fixing
- optimization of ContentCache and Preferences
- handling of line number synchronization in Editor Fragment improved
- bug fixing
open problems
- web page in Samsung tablet not loading
- tap in AVD not working
- web page in Samsung tablet loading
- (tap in AVD working, no idea how long)
- worked on load method in UriExtensions.kt
- comments improved and warnings fixed
- improved update handling
- round corners
- app widget preview on newer versions of Android
- change of ImageView to ListView enables scroll behavior while retaining other functionality
@Mick2nd
Copy link
Author

Mick2nd commented Jun 25, 2024

Further Progress

In the mean time I made further progress:

  1. The widget can now load md pages from the Internet or another http / https server
  2. The Image View was replaced by a List View thus enabling scroll behavior. The bitmaps are divided into stripes serving as list view items.
  3. The Main Activity was widely extended, it has now 4 Fragments:
    1. The Main fragment with the former link and statement
    2. A Configure fragment containing configuration options and the former Debug sample area
    3. An Editor fragment. The Main Activity can be configured as Intent target and serves as little editor.
    4. A Preview fragment displaying the rendered markdown

Surely, there needs to be done some fine tuning. But the main functionality works in principal.

Mick2nd added 2 commits June 26, 2024 16:24
- bug fix: app could hang
- bug fix: onPageFinished called twice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant