Skip to content
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e66ff2c
Direct launch
Nov 25, 2025
5305eca
Better, faster app start
Nov 26, 2025
ce30b12
Lazy loading of webview
harshad1 Nov 27, 2025
d57b9a1
Reverted to trampoline
harshad1 Nov 27, 2025
2d11e1d
Fixed widget
harshad1 Nov 29, 2025
7f94958
Scheme
harshad1 Nov 29, 2025
f81e780
Merge branch 'tried_reverting_to_trampoline' into faster_start_times
harshad1 Nov 29, 2025
b5ba7de
Removed function
harshad1 Nov 29, 2025
6c9d6c6
Use deep links rather than a trampoline
harshad1 Nov 30, 2025
fa517ad
Revert "Use deep links rather than a trampoline"
harshad1 Nov 30, 2025
940af0d
Removed scheme
harshad1 Nov 30, 2025
3143d6a
Before changing dialog
harshad1 Dec 1, 2025
1480857
More changes to match material
harshad1 Dec 1, 2025
819e616
Added new files
harshad1 Dec 1, 2025
51fae2c
More tweaks to colors
harshad1 Dec 1, 2025
c2ddc3f
Cleanups
harshad1 Dec 1, 2025
d9a47f9
Handling spaces and %20
harshad1 Dec 2, 2025
5e58763
Merge branch 'faster_start_times' into more_modern_ui
harshad1 Dec 2, 2025
9584150
Conditional animation
harshad1 Dec 2, 2025
4483ecb
Merge branch 'faster_start_times' into more_modern_ui
harshad1 Dec 2, 2025
1892739
More conservative preview setting
harshad1 Dec 6, 2025
a27b4d4
Added toast
harshad1 Dec 6, 2025
c7937d6
Merge branch 'faster_start_times' into more_modern_ui
harshad1 Dec 6, 2025
cb67476
Properly clearing
harshad1 Dec 6, 2025
f8d3248
Merge branch 'faster_start_times' into more_modern_ui
harshad1 Dec 6, 2025
8abbebf
Revert "Conditional animation"
harshad1 Dec 6, 2025
d925805
Reverted approach change
harshad1 Dec 6, 2025
a98468f
Merge branch 'faster_start_times' into more_modern_ui
harshad1 Dec 6, 2025
3090da6
Before shadow
harshad1 Dec 7, 2025
056f559
Many tweaks to make default colors nicer
harshad1 Dec 7, 2025
13052f1
Primary color in light mode
harshad1 Dec 13, 2025
d21c751
Better black
harshad1 Dec 14, 2025
01cfc22
Towards black
harshad1 Dec 14, 2025
87f3445
Everything working
harshad1 Dec 14, 2025
457fcde
More cleanups to black
harshad1 Dec 14, 2025
cca4382
Before simplifying
harshad1 Dec 15, 2025
82f6121
Cleanups
harshad1 Dec 17, 2025
2c89b91
Pulled in change to fix removing priority
harshad1 Dec 17, 2025
53d6c9f
Merge branch 'faster_start_times' into more_modern_ui
harshad1 Dec 17, 2025
4e8637d
Fixed issue with webview being null
harshad1 Dec 27, 2025
cc5551c
Merge branch 'faster_start_times' into more_modern_ui
harshad1 Dec 27, 2025
bda3773
Merge remote-tracking branch 'upstream/master' into more_modern_ui
harshad1 Dec 28, 2025
3f8f675
Updating action order activity display
harshad1 Dec 28, 2025
9c64e5c
Revert to previous, not default
harshad1 Dec 28, 2025
967dd1e
Merge branch 'master' into more_modern_ui
gsantner Jan 8, 2026
32163be
Merge branch 'master' into more_modern_ui
gsantner Jan 8, 2026
90ab947
reformat code
gsantner Jan 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,6 @@
android:theme="@style/AppTheme.Unified.StartupFlash"
android:windowSoftInputMode="stateUnchanged|adjustResize"
tools:targetApi="lollipop">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="net.gsantner.markor.activity.MainActivity" />
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="com.google.android.gm.action.AUTO_SEND" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import static androidx.recyclerview.widget.ItemTouchHelper.ACTION_STATE_DRAG;

import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
Expand All @@ -22,6 +21,7 @@

import androidx.annotation.NonNull;
import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
Expand Down Expand Up @@ -86,7 +86,7 @@ public boolean onCreateOptionsMenu(Menu menu) {
final MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.action_order__menu, menu);

_cu.tintMenuItems(menu, true, Color.WHITE);
_cu.tintMenuItems(menu, true, ContextCompat.getColor(this, R.color.bar_content));
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private static void launch(

intent.putExtra(Document.EXTRA_FILE, file);

GsContextUtils.instance.animateToActivity(activity, intent, false, null);
activity.startActivity(intent);
}

public static void askUserIfWantsToOpenFileInThisApp(final Activity activity, final File file) {
Expand Down Expand Up @@ -183,22 +183,23 @@ private void handleLaunchingIntent(final Intent intent) {
if (file == null || !_cu.canWriteFile(this, file, false, true)) {
showNotSupportedMessage();
} else {
Integer startLine = null;
// Open in editor/viewer
final Document doc = new Document(file);
Integer startLine = null;
if (intent.hasExtra(Document.EXTRA_FILE_LINE_NUMBER)) {
startLine = intent.getIntExtra(Document.EXTRA_FILE_LINE_NUMBER, -1);
} else if (intentData != null) {
final String line = intentData.getQueryParameter("line");
startLine = GsTextUtils.tryParseInt(line, -1);
if (line != null) {
startLine = GsTextUtils.tryParseInt(line, -1);
}
}

// Start in a specific mode if required. Otherwise let the fragment decide
Boolean startInPreview = null;
if (startLine != null) {
// If a line is requested, open in edit mode so the line is shown
startInPreview = false;
} else if (intent.getBooleanExtra(Document.EXTRA_DO_PREVIEW, false) || file.getName().startsWith("index.")) {
if (intent.getBooleanExtra(Document.EXTRA_DO_PREVIEW, false) ||
file.getName().startsWith("index.")
) {
startInPreview = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import android.view.SubMenu;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.JavascriptInterface;
Expand All @@ -40,6 +41,7 @@

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;

import net.gsantner.markor.ApplicationObject;
import net.gsantner.markor.BuildConfig;
Expand Down Expand Up @@ -94,6 +96,7 @@ public static DocumentEditAndViewFragment newInstance(final @NonNull Document do

private HighlightingEditor _hlEditor;
private WebView _webView;
private ViewStub _webViewStub;
private MarkorWebViewClient _webViewClient;
private ViewGroup _editorHolder;
private ViewGroup _textActionsBar;
Expand Down Expand Up @@ -139,7 +142,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
_hlEditor = view.findViewById(R.id.document__fragment__edit__highlighting_editor);
_editorHolder = view.findViewById(R.id.document__fragment__edit__editor_holder);
_textActionsBar = view.findViewById(R.id.document__fragment__edit__text_actions_bar);
_webView = view.findViewById(R.id.document__fragment_view_webview);
_webViewStub = view.findViewById(R.id.document__fragment_webview_stub);
_verticalScrollView = view.findViewById(R.id.document__fragment__edit__content_editor__scrolling_parent);
_lineNumbersView = view.findViewById(R.id.document__fragment__edit__line_numbers_view);
_cu = new MarkorContextUtils(activity);
Expand All @@ -159,34 +162,6 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
_lineNumbersView.setup(_hlEditor);
_lineNumbersView.setLineNumbersEnabled(_appSettings.getDocumentLineNumbersEnabled(_document.path));

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && _appSettings.getSetWebViewFulldrawing()) {
WebView.enableSlowWholeDocumentDraw();
}

_webViewClient = new MarkorWebViewClient(_webView, activity);
_webView.setWebChromeClient(new GsWebViewChromeClient(_webView, activity, view.findViewById(R.id.document__fragment_fullscreen_overlay)));
_webView.setWebViewClient(_webViewClient);
_webView.addJavascriptInterface(this, "Android");
_webView.setBackgroundColor(Color.TRANSPARENT);
WebSettings webSettings = _webView.getSettings();
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
webSettings.setTextZoom((int) (_appSettings.getDocumentViewFontSize(_document.path) * VIEW_FONT_SCALE));
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webSettings.setDatabaseEnabled(true);
webSettings.setGeolocationEnabled(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowContentAccess(true);
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(false);
webSettings.setMediaPlaybackRequiresUserGesture(false);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && BuildConfig.IS_TEST_BUILD && BuildConfig.DEBUG) {
WebView.setWebContentsDebuggingEnabled(true); // Inspect on computer chromium browser: chrome://inspect/#devices
}

// Upon construction, the document format has been determined from extension etc
// Here we replace it with the last saved format.
applyTextFormat(_appSettings.getDocumentFormat(_document.path, _document.getFormat()));
Expand Down Expand Up @@ -257,14 +232,14 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
});
}

_verticalScrollView.getViewTreeObserver().addOnGlobalLayoutListener(() -> {
_hlEditor.post(() -> {
final int height = _verticalScrollView.getHeight();
if (height != _hlEditor.getMinHeight()) {
_hlEditor.setMinHeight(height);
}
});
final Runnable ensureMinHeight = () -> _hlEditor.post(() -> {
final int height = _verticalScrollView.getHeight();
if (height > 0 && height != _hlEditor.getMinHeight()) {
_hlEditor.setMinHeight(height);
}
});
_verticalScrollView.addOnLayoutChangeListener((v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> ensureMinHeight.run());
_verticalScrollView.post(ensureMinHeight);
}

@Override
Expand All @@ -289,7 +264,9 @@ protected void onFragmentFirstTimeVisible() {

@Override
public void onResume() {
_webView.onResume();
if (_webView != null) {
_webView.onResume();
}
loadDocument();
if (_editTextUndoRedoHelper != null && _editTextUndoRedoHelper.getTextView() != _hlEditor) {
_editTextUndoRedoHelper.setTextView(_hlEditor);
Expand All @@ -300,7 +277,9 @@ public void onResume() {
@Override
public void onPause() {
saveDocument(false);
_webView.onPause();
if (_webView != null) {
_webView.onPause();
}
_appSettings.addRecentFile(_document.file);
_appSettings.setDocumentPreviewState(_document.path, _isPreviewVisible);
_appSettings.setLastEditPosition(_document.path, TextViewUtils.getSelection(_hlEditor)[0]);
Expand All @@ -321,7 +300,7 @@ public void onSaveInstanceState(@NonNull Bundle outState) {
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.document__edit__menu, menu);
_cu.tintMenuItems(menu, true, Color.WHITE);
_cu.tintMenuItems(menu, true, ContextCompat.getColor(requireContext(), R.color.bar_content));
_cu.setSubMenuIconsVisibility(menu, true);

final boolean isExperimentalFeaturesEnabled = _appSettings.isExperimentalFeaturesEnabled();
Expand Down Expand Up @@ -364,13 +343,17 @@ public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
_menuSearchViewForViewMode.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String text) {
_webView.findNext(true);
if (_webView != null) {
_webView.findNext(true);
}
return true;
}

@Override
public boolean onQueryTextChange(String text) {
_webView.findAllAsync(text);
if (_webView != null) {
_webView.findAllAsync(text);
}
return true;
}
});
Expand Down Expand Up @@ -551,16 +534,18 @@ public boolean onOptionsItemSelected(@NonNull final MenuItem item) {
_nextConvertToPrintMode = true;
setViewModeVisibility(true);
Toast.makeText(activity, R.string.please_wait, Toast.LENGTH_LONG).show();
_webView.postDelayed(() -> {
if (itemId == R.id.action_share_pdf) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
_cu.printOrCreatePdfFromWebview(_webView, _document, getTextString().contains("beamer\n"));
if (_webView != null) {
_webView.postDelayed(() -> {
if (itemId == R.id.action_share_pdf) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
_cu.printOrCreatePdfFromWebview(_webView, _document, getTextString().contains("beamer\n"));
}
} else {
Bitmap bmp = _cu.getBitmapFromWebView(_webView, itemId == R.id.action_share_image);
_cu.shareImage(getContext(), bmp, null);
}
} else {
Bitmap bmp = _cu.getBitmapFromWebView(_webView, itemId == R.id.action_share_image);
_cu.shareImage(getContext(), bmp, null);
}
}, 7000);
}, 7000);
}
}

return true;
Expand Down Expand Up @@ -648,7 +633,9 @@ public void onFsViewerConfig(GsFileBrowserOptions.Options dopt) {
final int current = _isPreviewVisible ? _appSettings.getDocumentViewFontSize(_document.path) : _appSettings.getDocumentFontSize(_document.path);
MarkorDialogFactory.showFontSizeDialog(activity, current, (newSize) -> {
if (_isPreviewVisible) {
_webView.getSettings().setTextZoom((int) (newSize * VIEW_FONT_SCALE));
if (_webView != null) {
_webView.getSettings().setTextZoom((int) (newSize * VIEW_FONT_SCALE));
}
_appSettings.setDocumentViewFontSize(_document.path, newSize);
} else {
_hlEditor.setTextSize(TypedValue.COMPLEX_UNIT_SP, (float) newSize);
Expand All @@ -667,7 +654,6 @@ public void onFsViewerConfig(GsFileBrowserOptions.Options dopt) {
}
}
}

public void checkTextChangeState() {
final boolean isTextChanged = !_document.isContentSame(_hlEditor.getText());
Drawable d;
Expand Down Expand Up @@ -703,12 +689,14 @@ private void showHideActionBar() {
final View parent = activity.findViewById(R.id.document__fragment__edit__text_actions_bar__scrolling_parent);
final View viewScroll = activity.findViewById(R.id.document__fragment_view_webview);

if (bar != null && parent != null && _verticalScrollView != null && viewScroll != null) {
if (bar != null && parent != null && _verticalScrollView != null) {
final boolean hide = _textActionsBar.getChildCount() == 0;
parent.setVisibility(hide ? View.GONE : View.VISIBLE);
final int marginBottom = hide ? 0 : (int) getResources().getDimension(R.dimen.textactions_bar_height);
setMarginBottom(_verticalScrollView, marginBottom);
setMarginBottom(viewScroll, marginBottom);
if (viewScroll != null) {
setMarginBottom(viewScroll, marginBottom);
}
}
}
}
Expand Down Expand Up @@ -865,6 +853,9 @@ private boolean isDisplayedAtMainActivity() {
}

public void updateViewModeText() {
if (_webView == null) {
return;
}
// Don't let text to view mode crash app
try {
_format.getConverter().convertMarkupShowInWebView(_document, getTextString(), getActivity(), _webView, _nextConvertToPrintMode, _lineNumbersView.isLineNumbersEnabled());
Expand All @@ -877,6 +868,37 @@ public void setViewModeVisibility(final boolean show) {
setViewModeVisibility(show, true);
}

private void setupWebViewIfNeeded(final Activity activity) {
if (_webView == null) {
_webView = (WebView) _webViewStub.inflate();
_webView.setWebChromeClient(new GsWebViewChromeClient(_webView, activity, activity.findViewById(R.id.document__fragment_fullscreen_overlay)));
_webView.addJavascriptInterface(this, "Android");
_webView.setBackgroundColor(Color.TRANSPARENT);
WebSettings webSettings = _webView.getSettings();
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
webSettings.setTextZoom((int) (_appSettings.getDocumentViewFontSize(_document.path) * VIEW_FONT_SCALE));
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
webSettings.setDatabaseEnabled(true);
webSettings.setGeolocationEnabled(false);
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webSettings.setAllowFileAccess(true);
webSettings.setAllowContentAccess(true);
webSettings.setAllowFileAccessFromFileURLs(true);
webSettings.setAllowUniversalAccessFromFileURLs(false);
webSettings.setMediaPlaybackRequiresUserGesture(false);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && BuildConfig.IS_TEST_BUILD && BuildConfig.DEBUG) {
WebView.setWebContentsDebuggingEnabled(true); // Inspect on computer chromium browser: chrome://inspect/#devices
}

_webViewClient = new MarkorWebViewClient(_webView, activity);
_webView.setWebViewClient(_webViewClient);
}
}

@SuppressLint({"AddJavascriptInterface", "SetJavaScriptEnabled"})
public void setViewModeVisibility(boolean show, final boolean animate) {
final Activity activity = getActivity();
if (activity == null) {
Expand All @@ -887,13 +909,16 @@ public void setViewModeVisibility(boolean show, final boolean animate) {
_format.getActions().recreateActionButtons(_textActionsBar, show ? ActionButtonBase.ActionItem.DisplayMode.VIEW : ActionButtonBase.ActionItem.DisplayMode.EDIT);
showHideActionBar();
if (show) {
setupWebViewIfNeeded(activity);
updateViewModeText();
_cu.showSoftKeyboard(activity, false, _hlEditor);
_hlEditor.clearFocus();
_hlEditor.postDelayed(() -> _cu.showSoftKeyboard(activity, false, _hlEditor), 300);
GsContextUtils.fadeInOut(_webView, _verticalScrollView, animate);
} else {
_webViewClient.setRestoreScrollY(_webView.getScrollY());
if (_webView != null) {
_webViewClient.setRestoreScrollY(_webView.getScrollY());
}
GsContextUtils.fadeInOut(_verticalScrollView, _webView, animate);
}

Expand Down Expand Up @@ -932,10 +957,12 @@ protected boolean onToolbarLongClicked(View v) {

@Override
public void onDestroy() {
try {
_webView.loadUrl("about:blank");
_webView.destroy();
} catch (Exception ignored) {
if (_webView != null) {
try {
_webView.loadUrl("about:blank");
_webView.destroy();
} catch (Exception ignored) {
}
}
super.onDestroy();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,6 @@ public static class ShareIntoImportOptionsFragment extends GsPreferenceFragmentB
private EditText _editor = null;
private CheckBox _linkCheckBox = null;

@Override
public boolean isDividerVisible() {
return true;
}

public ShareIntoImportOptionsFragment setAttachment(File file) {
attachment = file;
return this;
Expand All @@ -212,6 +207,11 @@ protected AppSettings getAppSettings(Context context) {
return AppSettings.get(context);
}

@Override
public boolean isDividerVisible() {
return false;
}

@Override
protected void afterOnCreate(Bundle savedInstances, Context context) {
super.afterOnCreate(savedInstances, context);
Expand Down
Loading