From 98b0ddbf4c6bb92b3cd31bfb8f34d7026cc5798c Mon Sep 17 00:00:00 2001 From: Gregor Santner Date: Sun, 18 Mar 2018 17:09:02 +0100 Subject: [PATCH] md::moduleaction end line with 2 spaces (closes #189) --- CHANGELOG.md | 9 +++++++++ app/build.gradle | 2 +- .../markor/activity/DocumentEditFragment.java | 9 ++++++--- .../moduleactions/MarkdownTextModuleActions.java | 14 +++++++++++++- .../markor/ui/FilesystemDialogCreator.java | 2 +- .../res/drawable/ic_arrow_upward_black_24dp.xml | 9 +++++++++ .../res/drawable/ic_keyboard_return_black_24dp.xml | 9 +++++++++ app/src/main/res/values/arrays.xml | 4 ++-- 8 files changed, 50 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml create mode 100644 app/src/main/res/drawable/ic_keyboard_return_black_24dp.xml diff --git a/CHANGELOG.md b/CHANGELOG.md index 79234651cd..fd751c54ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +### v0.3.3 +- Allow to set document folder outside of internal storage +- Fix import dialog orientation crash +- Add option to start editing on bottom +- Improve project icon +- Trim share-into text +- Improved exporting/sharing + + ### v0.3.2 - Todotxt: Support delete, archive tasks - Todotxt: Try to keep cursor position diff --git a/app/build.gradle b/app/build.gradle index 91f63a9d62..4422980144 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -23,7 +23,7 @@ android { applicationId "net.gsantner.markor" versionName "0.3.2" - versionCode 16 + versionCode 17 } productFlavors { diff --git a/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java b/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java index 30d71504fa..7a97e5c4ff 100644 --- a/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java +++ b/app/src/main/java/net/gsantner/markor/activity/DocumentEditFragment.java @@ -324,9 +324,12 @@ private void checkReloadDisk() { @Override public void onFragmentFirstTimeVisible() { AppSettings as = new AppSettings(getContext()); - if (as.isEditorStartOnBotttom() && (_savedInstanceState == null || !_savedInstanceState.containsKey(SAVESTATE_CURSOR_POS))) { - _hlEditor.requestFocus(); - _hlEditor.setSelection(_hlEditor.length()); + if (_savedInstanceState == null || !_savedInstanceState.containsKey(SAVESTATE_CURSOR_POS)) { + // TODO + if (as.isEditorStartOnBotttom() && _hlEditor.length() > 0) { + _hlEditor.requestFocus(); + _hlEditor.setSelection(_hlEditor.length()); + } } } diff --git a/app/src/main/java/net/gsantner/markor/format/moduleactions/MarkdownTextModuleActions.java b/app/src/main/java/net/gsantner/markor/format/moduleactions/MarkdownTextModuleActions.java index 177323c690..6f73c09f83 100644 --- a/app/src/main/java/net/gsantner/markor/format/moduleactions/MarkdownTextModuleActions.java +++ b/app/src/main/java/net/gsantner/markor/format/moduleactions/MarkdownTextModuleActions.java @@ -195,7 +195,8 @@ else if (((selectionEnd <= (_hlEditor.length() - _action.length())) && private static final int[][] KEYBOARD_EXTRA_ACTIONS_ICONS = { {R.drawable.format_link, 1}, {R.drawable.format_image, 2}, - {CommonTextModuleActions.ACTION_SPECIAL_KEY__ICON, 3} + {CommonTextModuleActions.ACTION_SPECIAL_KEY__ICON, 3}, + {R.drawable.ic_keyboard_return_black_24dp, 4}, }; private static final Pattern LINK_PATTERN = Pattern.compile("(?m)\\[(.*?)\\]\\((.*?)\\)"); @@ -213,6 +214,17 @@ public void onClick(View view) { new CommonTextModuleActions(_activity, _document, _hlEditor).runAction(CommonTextModuleActions.ACTION_SPECIAL_KEY); break; } + case 4: { + if (_hlEditor.length() > 1) { + int start = _hlEditor.getSelectionStart(); + String text = _hlEditor.getText().toString(); + int insertPos = text.indexOf('\n', start); + insertPos = insertPos < 1 ? text.length() : insertPos; + _hlEditor.getText().insert(insertPos, " " + (text.endsWith("\n") ? "" : "\n")); + _hlEditor.setSelection(insertPos + 3); + } + break; + } default: { getAlertDialog(_action); break; diff --git a/app/src/main/java/net/gsantner/markor/ui/FilesystemDialogCreator.java b/app/src/main/java/net/gsantner/markor/ui/FilesystemDialogCreator.java index a9f6bf9208..28a41ef45c 100644 --- a/app/src/main/java/net/gsantner/markor/ui/FilesystemDialogCreator.java +++ b/app/src/main/java/net/gsantner/markor/ui/FilesystemDialogCreator.java @@ -37,7 +37,7 @@ public class FilesystemDialogCreator { opts.searchHint = R.string.search_documents; opts.searchButtonImage = R.drawable.ic_action_search; opts.homeButtonImage = R.drawable.ic_home_black_24dp; - opts.upButtonImage = R.drawable.ic_arrow_back_white_24dp; + opts.upButtonImage = R.drawable.ic_arrow_upward_black_24dp; opts.selectedItemImage = R.drawable.ic_check_black_24dp; opts.upButtonEnable = true; opts.homeButtonEnable = true; diff --git a/app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml b/app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml new file mode 100644 index 0000000000..c64ae35166 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_upward_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/drawable/ic_keyboard_return_black_24dp.xml b/app/src/main/res/drawable/ic_keyboard_return_black_24dp.xml new file mode 100644 index 0000000000..83ccf26869 --- /dev/null +++ b/app/src/main/res/drawable/ic_keyboard_return_black_24dp.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index dc51789975..3bdb356b46 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -32,10 +32,10 @@ @string/key_page_up @string/key_page_down - @string/key_pos_1_document - @string/key_pos_end_document @string/key_pos_1 @string/key_pos_end + @string/key_pos_1_document + @string/key_pos_end_document @string/key_ctrl_a @string/key_tab