Skip to content

Commit

Permalink
Merge branch 'master' into libraries_update
Browse files Browse the repository at this point in the history
  • Loading branch information
guanglinn authored Nov 16, 2024
2 parents 6e6503a + d10b67d commit 89716a1
Show file tree
Hide file tree
Showing 19 changed files with 164 additions and 302 deletions.
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
- See [Discussions](https://github.com/gsantner/markor/discussions), [Issues](https://github.com/gsantner/markor/issues) and [Project news](https://github.com/gsantner/markor/blob/master/NEWS.md) to see what is going on.
- New Updates also visible here: <https://github.com/gsantner/markor/releases>

### v2.13 series
- [2.13.0](https://github.com/gsantner/markor/compare/v2.12.6...v2.13.0)

### v2.12 series
- [2.12.0](https://github.com/gsantner/markor/compare/v2.11.1...v2.12.0)
- [2.12.1](https://github.com/gsantner/markor/compare/v2.12.0...v2.12.1)
Expand All @@ -11,6 +14,60 @@
- [2.12.5](https://github.com/gsantner/markor/compare/v2.12.4...v2.12.5)
- [2.12.6](https://github.com/gsantner/markor/compare/v2.12.5...v2.12.6)

- Override .org file extension to use text mimetype (*/* unrecognized on older devices) PR#2455
- android-35 Disable window size overlap, closes #2448 #2387 #2451
- orgmode: add more text styling syntax and textactions (PR #2450)
- orgmode: fix action buttons not being loaded correctly (PR #2449)
- Rework /storage mapped folders (PR #2445 by @gsantner)
- FileManager: Remove top submenu to open special folders, load storage overview in filemanager instead (PR #2440 by @gsantner)
- Register chess extension (.fen) for plaintext - https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation closes #2241 (#2439)
- Open .lrc extension as plaintext by default, closes #2322 (#2438)
- TextAction: Add text case changing functionality (closes #2390, PR #2426)
- Bugfix: showAndFlash must be called on UI thread, closes #2427 (#2428)
- Improvements for HeadlineDialog scroll restoration and copy code block button (PR #2406)
- Improvements for the action buttons (closes #2386, PR #2388)
- Create launcher widget for todo (closes #1997, PR #2379)
- Disable multi-window settings option by default (PR #2420)
- Fixed checking for indices (#2421)
- Fix how multiple windows are launched (PR #2419)
- Add Em Space special key for paragraph indent (#2400)
- GitHub Actions CI configuration - upgrade upload step, fixes CI build error (PR #2416 by @gsantner)
- Updated README with dark/light todo.txt format images (PR #2411)
- Navigation and highlighting improvements (PR #2377 closes #2409 closes #2410)
- Filebrowser: Fix file modification time not reloaded, closes #2196 (PR #2385)
- Minor doc improvements
- Fix inject-head js option not applying, closes #2365, closes #2380 (PR #2383)
- Add usual yyyy-MM-dd newfile default option
- DocumentEditAndViewFragment: Fix all warnings, especially related to null pointers
- Zim: Fix link/attachment format (PR #2147 by @mehw)
- Add history scroll restoration for scroll views (#2366)
- Various bugfixes (anchor/toc jumping #2364, snippets folder #2369, wikitext newfile #2362, virtual directory browser #2350) (PR #2370 by @hardhard1)
- New Color picker, bump Android minSdk from 16 to 18, closes #1428 (PR #2203 by @halfdane)
- Latest Android SDK/Gradle fixes, by @gsantner #2360
- Add links to changelog
- SearchReplace dialog: Use full width, closes #2367, by @gsantner
- ShareInto: Fix crash when editor is null
- Appearance improvements (PR #2359 closes #2358)
- Fix notebook directory not being created, fix NewFileDialog when no last used type, by @gsantner closes #2360
- Project configuration: upgrade to Android SDK 35, Gradle 8.7, AGP 8.5, Build tools 35, by @gsantner, (closes #2346, closes #2305 PR #2355)
- Add ACTION_CREATE_NOTE intent filter, closes #2320, by @gsantner
- Highlight file when going back to filebrowser (PR #2351)
- View-Mode: Prism codeblock copy to clipboard button, update Mermaid and dark mode, closes #2336 closes #2335 (#2345)
- File browser: Make Folder and file icons visually better distinct (outlined icon for file), (PR by @wshoy #2331 fixes #2186)
- Jump to correct heading via id, other tweaks, bugfixes (PR #2307 by @harshad1, fixes #2312 #2313)
- FileBrowser: Disable file change options in virtual directories (closes #2287, by @gsantner)
- Format detection fixes, headline dialog improvements (PR #2300 closes #2303 closes #2296 closes #2297)
- Disallow treating openxml (msword) files as textfiles, closes #2285
- ShareInto: Move link checkbox down
- ShareInto: Fix missing text at shared links (PR #2282 closes #2294)
- CI/CD: Update GitHub Actions versions, fixes outdated warnings, force Java from Eclipse
- Fix crash for unknown filetypes, fix EmbedBinary not detected, related to PR #2277
- FileBrowser: Fix file copy file (nullpointer in currentfolder), by @gsantner
- Update year in texts
- Reformat code of PR #2277, closes #2225, closes #2217, closes #2199, closes #2153
- Improvements to newfile dialog, open links, other fixes (PR #2277)


### v2.11 ([Details](https://github.com/gsantner/markor/blob/master/NEWS.md#markor-v211---asciidoc-csv-and-org-mode-todotxt-advanced-search-line-numbers))
- Reworked attachments (PR #2106 by @harshad1)
- Editor/viewer: Side margin improvements 2, closes #2111 (PR #2119 by @guanglinn)
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
defaultConfig {
resValue "string", "manifest_package_id", "net.gsantner.markor"
applicationId "net.gsantner.markor"
versionName "2.12.5"
versionCode 154
versionName "2.13.1"
versionCode 156

multiDexEnabled true
minSdkVersion rootProject.ext.version_minSdk
Expand Down Expand Up @@ -138,7 +138,6 @@ dependencies {
// UI libs
implementation 'com.github.Pixplicity:gene-rate:v1.1.8'
implementation 'com.github.AppIntro:AppIntro:6.2.0'
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'

Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<uses-permission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;

Expand Down Expand Up @@ -95,8 +96,8 @@ private static void launch(
intent = new Intent(activity, DocumentActivity.class);

if (!(activity instanceof DocumentActivity) &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
as.isMultiWindowEnabled()
Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP &&
as.isMultiWindowEnabled()
) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
}
Expand Down Expand Up @@ -254,7 +255,8 @@ public boolean dispatchTouchEvent(MotionEvent event) {
}
try {
return super.dispatchTouchEvent(event);
} catch (IndexOutOfBoundsException ignored) {
} catch (Exception e) {
Log.e(getClass().getName(), "Error in super.dispatchTouchEvent: " + e);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ private String formatShare(final String shared) {
}

// Put the shared text in the right place
parts.add(1, shared);
parts.add(parts.isEmpty() ? 0 : 1, shared);

return TextUtils.join("", parts);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import net.gsantner.markor.model.AppSettings;
import net.gsantner.markor.util.MarkorContextUtils;
import net.gsantner.opoc.format.GsTextUtils;
import net.gsantner.opoc.frontend.GsAudioRecordOmDialog;
import net.gsantner.opoc.frontend.filebrowser.GsFileBrowserOptions;
import net.gsantner.opoc.util.GsFileUtils;
import net.gsantner.opoc.wrapper.GsCallback;
Expand Down Expand Up @@ -99,7 +98,6 @@ public static void showInsertImageOrLinkDialog(
final Button buttonPictureGallery = view.findViewById(R.id.ui__select_path_dialog__gallery_picture);
final Button buttonPictureCamera = view.findViewById(R.id.ui__select_path_dialog__camera_picture);
final Button buttonPictureEdit = view.findViewById(R.id.ui__select_path_dialog__edit_picture);
final Button buttonAudioRecord = view.findViewById(R.id.ui__select_path_dialog__record_audio);

// Extract filepath if using Markdown
if (textFormatId == FormatRegistry.FORMAT_MARKDOWN) {
Expand Down Expand Up @@ -135,11 +133,6 @@ public static void showInsertImageOrLinkDialog(
dialog.setTitle(R.string.insert_image);
browseType = InsertType.IMAGE_BROWSE;
okType = InsertType.IMAGE_DIALOG;
} else if (action == AUDIO_ACTION) {
dialog.setTitle(R.string.audio);
buttonAudioRecord.setVisibility(View.VISIBLE);
browseType = InsertType.AUDIO_BROWSE;
okType = InsertType.AUDIO_DIALOG;
} else {
dialog.setTitle(R.string.insert_link);
buttonSelectSpecial.setVisibility(View.VISIBLE);
Expand All @@ -155,7 +148,6 @@ public static void showInsertImageOrLinkDialog(
buttonSearch.setOnClickListener(v -> _insertItem.callback(InsertType.LINK_SEARCH));
buttonPictureCamera.setOnClickListener(b -> _insertItem.callback(InsertType.IMAGE_CAMERA));
buttonPictureGallery.setOnClickListener(v -> _insertItem.callback(InsertType.IMAGE_GALLERY));
buttonAudioRecord.setOnClickListener(v -> _insertItem.callback(InsertType.AUDIO_RECORDING));
buttonPictureEdit.setOnClickListener(v -> _insertItem.callback(InsertType.IMAGE_EDIT));

dialog.show();
Expand Down Expand Up @@ -368,7 +360,7 @@ private static void insertItem(
if (GsTextUtils.isNullOrEmpty(nameEdit.getText())) {
nameEdit.setText(pathEdit.getText());
}
} else {
} else {
if (pathEdit != null) {
pathEdit.setText(GsFileUtils.relativePath(currentFile, file));
}
Expand Down Expand Up @@ -408,7 +400,7 @@ private static void insertItem(
}
case AUDIO_RECORDING: {
if (!cu.requestAudioRecording(activity, insertFileLink)) {
GsAudioRecordOmDialog.showAudioRecordDialog(activity, R.string.record_audio, insertFileLink);
// noop, OM library is outdated and so voice recording feature removed
}
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
import android.text.Layout;
import android.text.TextWatcher;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Toast;

import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
Expand All @@ -37,6 +39,7 @@

import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -121,7 +124,13 @@ public boolean onPreDraw() {

@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
try {
super.onDraw(canvas);
} catch (Exception e) {
// Hinder drawing from crashing the app
Log.e(getClass().getName(), "HighlightingEdtior onDraw->super.onDraw crash" + e);
Toast.makeText(getContext(), e.toString(), Toast.LENGTH_SHORT).show();
}

if (_numEnabled) {
_lineNumbersDrawer.draw(canvas);
Expand Down Expand Up @@ -162,7 +171,7 @@ private boolean runHighlight(final boolean recompute) {
private void updateHighlighting() {
if (runHighlight(false)) {
// Do not batch as we do not want to reflow
_hl.clearDynamic().applyDynamic(hlRegion());
_hl.clearDynamic().applyDynamic(hlRegion());
_oldHlRect.set(_hlRect);
}
}
Expand All @@ -181,7 +190,10 @@ public void recomputeHighlighting() {
*/
private void recomputeHighlightingAsync() {
if (runHighlight(true)) {
executor.execute(this::_recomputeHighlightingWorker);
try {
executor.execute(this::_recomputeHighlightingWorker);
} catch (RejectedExecutionException ignored) {
}
}
}

Expand Down Expand Up @@ -289,14 +301,12 @@ public boolean bringPointIntoView(int i) {

private int rowStart(final int y) {
final Layout layout = getLayout();
final int line = layout.getLineForVertical(y);
return layout.getLineStart(line);
return layout == null ? 0 : layout.getLineStart(layout.getLineForVertical(y));
}

private int rowEnd(final int y) {
final Layout layout = getLayout();
final int line = layout.getLineForVertical(y);
return layout.getLineEnd(line);
return layout == null ? 0 : layout.getLineEnd(layout.getLineForVertical(y));
}

// Text-Casing
Expand Down Expand Up @@ -398,7 +408,12 @@ public boolean onTextContextMenuItem(int id) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && id == android.R.id.paste) {
id = android.R.id.pasteAsPlainText;
}
return super.onTextContextMenuItem(id);
try {
// i.e. DeadSystemRuntimeException can happen here
return super.onTextContextMenuItem(id);
} catch (Exception ignored) {
return true;
}
}

// Accessibility code is blocked during rapid update events
Expand Down Expand Up @@ -692,7 +707,12 @@ public void draw(final Canvas canvas) {
final int count = layout.getLineCount();
final int offsetY = _editor.getPaddingTop();
for (; i < count; i++) {
final int start = layout.getLineStart(i);
int start;
try {
start = layout.getLineStart(i);
} catch (IndexOutOfBoundsException ex) {
break; // Even though the drawing is against count, might throw IndexOutOfBounds during drawing
}
if (start == 0 || text.charAt(start - 1) == '\n') {
final int y = layout.getLineBaseline(i);
if (y > _lineNumbersArea.bottom) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ public SyntaxHighlighterBase applyStatic() {

boolean hasStatic = false;
for (final SpanGroup group : _groups) {
if (group.isStatic) {
if (group != null && group.isStatic) {
hasStatic = true;
_spannable.setSpan(group.span, group.start, group.end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,7 @@ public boolean isExperimentalFeaturesEnabled() {
}

public boolean isHighlightBiggerHeadings() {
return getBool(R.string.pref_key__editor_markdown_bigger_headings_2, false);
return getBool(R.string.pref_key__editor_markdown_bigger_headings_3, false);
}

public String getViewModeLinkColor() {
Expand Down
Loading

0 comments on commit 89716a1

Please sign in to comment.