Skip to content

Commit

Permalink
Cleanups, removed option
Browse files Browse the repository at this point in the history
  • Loading branch information
harshad1 committed Dec 24, 2024
1 parent 3754f1c commit aba8578
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ private static void launch(
return;
}

if (GsFileUtils.getFilenameExtension(file).equals("apk")) {
if (GsFileUtils.getFilenameExtension(file).equals(".apk")) {
GsContextUtils.instance.requestApkInstallation(activity, file);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ public void runJumpBottomTopAction(ActionItem.DisplayMode displayMode) {
}

public boolean onReceiveKeyPress(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_TAB && _appSettings.isIndentWithTabKey()) {
if (keyCode == KeyEvent.KEYCODE_TAB) {
runIndentLines(event.isShiftPressed());
runRenumberOrderedListIfRequired();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ protected void renumberOrderedList() {

@Override
public boolean onReceiveKeyPress(final int keyCode, final KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_TAB && _appSettings.isIndentWithTabKey()) {
if (keyCode == KeyEvent.KEYCODE_TAB) {
if (event.isShiftPressed()) {
runRegexReplaceAction(WikitextReplacePatternGenerator.deindentOneTab());
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ private CharSequence autoIndent(final CharSequence source, final CharSequence de

final OrderedListLine oLine = new OrderedListLine(dest, dstart, _patterns);
final UnOrderedOrCheckListLine uLine = new UnOrderedOrCheckListLine(dest, dstart, _patterns);

final int iEnd = Math.min(Math.max(oLine.textOffset, 0), oLine.line.length());
final String indent = oLine.line.substring(0, iEnd);
final String indent = oLine.line.substring(0, oLine.indentEnd);

final String result;
if (oLine.isOrderedList && oLine.lineEnd != oLine.groupEnd && dend >= oLine.groupEnd) {
Expand Down Expand Up @@ -82,9 +80,8 @@ public static class ListLine {
protected final FormatPatterns patterns;
protected final CharSequence text;

public final int lineStart, lineEnd;
public final int lineStart, lineEnd, indentEnd;
public final String line;
public final int textOffset;
public final boolean isEmpty;
public final boolean isTopLevel;
public final int indent;
Expand All @@ -95,10 +92,11 @@ public ListLine(CharSequence text, int position, FormatPatterns patterns) {

lineStart = TextViewUtils.getLineStart(text, position);
lineEnd = TextViewUtils.getLineEnd(text, position);
textOffset = TextViewUtils.getNextNonWhitespace(text, lineStart);
line = text.subSequence(lineStart, lineEnd).toString();
isEmpty = line.trim().isEmpty();
final int[] counts = GsTextUtils.countChars(line, 0, textOffset, ' ', '\t');

indentEnd = isEmpty ? 0 : TextViewUtils.getFirstNonWhitespace(line);
final int[] counts = GsTextUtils.countChars(line, 0, indentEnd, ' ', '\t');
indent = counts[0] + counts[1] * 4;
isTopLevel = indent <= patterns.indentSlack;
}
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/net/gsantner/markor/model/AppSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -852,10 +852,6 @@ public synchronized boolean isExtOpenWithThisApp(String ext) {
return _extSettingCache.contains(ext) || _extSettingCache.contains("*");
}

public boolean isIndentWithTabKey() {
return getBool(R.string.pref_key__editor_tab_to_indent, false);
}

public boolean isExperimentalFeaturesEnabled() {
return getBool(R.string.pref_key__is_enable_experimental_features, BuildConfig.IS_TEST_BUILD);
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/string-not_translatable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<string name="pref_key__is_only_first_content_match" translatable="false">pref_key__is_only_first_content_match</string>
<string name="pref_key__restore_settings" translatable="false">pref_key__restore_settings</string>
<string name="pref_key__backup_settings" translatable="false">pref_key__backup_settings</string>
<string name="pref_key__editor_tab_to_indent" translatable="false">pref_key__editor_tab_to_indent</string>
<string name="hidden_password" translatable="false">****</string>
<string name="pref_key__todotxt__additional_projects_contexts" translatable="false">"pref_key__todotxt__additional_projects_contexts"</string>
<string name="pref_key__todotxt__due_date_offset" translatable="false">pref_key__todotxt_due_date_offset</string>
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -482,5 +482,4 @@ work. If not, see <https://creativecommons.org/publicdomain/zero/1.0/>.
<string name="switch_case">Switch Case (Ex: CaSe->cAsE)</string>
<string name="capitalize_words">Capitalize Words (Ex: a note->A Note)</string>
<string name="capitalize_sentences">Capitalize Sentences (Ex: case->Case)</string>
<string name="use_tab_to_indent">Indent lines with TAB key</string>
</resources>
5 changes: 0 additions & 5 deletions app/src/main/res/xml/preferences_master.xml
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,6 @@
android:key="@string/pref_key__editor_start_editing_on_bottom"
android:summary="@string/start_on_bottom_when_loading_document"
android:title="@string/start_on_bottom" />
<CheckBoxPreference
android:defaultValue="true"
android:icon="@drawable/ic_keyboard_tab_black_24dp"
android:key="@string/pref_key__editor_tab_to_indent"
android:title="@string/use_tab_to_indent" />
<ListPreference
android:defaultValue="-"
android:dialogTitle="@string/theme"
Expand Down

0 comments on commit aba8578

Please sign in to comment.