5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/DatabaseType.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | public enum DatabaseType {
14 | SQL, XML, MULTI
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_color_picker_24.xml:
--------------------------------------------------------------------------------
1 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/lt/ffda/sourcherry/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package lt.ffda.sourcherry;
2 |
3 | import android.content.Context;
4 |
5 | import androidx.test.platform.app.InstrumentationRegistry;
6 | import androidx.test.ext.junit.runners.AndroidJUnit4;
7 |
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * Instrumented test, which will execute on an Android device.
15 | *
16 | * @see Testing documentation
17 | */
18 | @RunWith(AndroidJUnit4.class)
19 | public class ExampleInstrumentedTest {
20 | @Test
21 | public void useAppContext() {
22 | // Context of the app under test.
23 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
24 | assertEquals("com.ffda.sourcherry", appContext.getPackageName());
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/res/menu/options_menu_fragment_with_home_button.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/database/DatabaseVacuum.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.database;
12 |
13 | public interface DatabaseVacuum {
14 | /**
15 | * Vacuums SQL database to reduce it's size
16 | */
17 | void vacuum();
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/table_border.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/table_data_cell.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/MenuItemAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | public enum MenuItemAction {
14 | DISMISS, ADD_SIBLING_NODE, ADD_SUBNODE, ADD_TO_BOOKMARKS, REMOVE_FROM_BOOKMARKS, MOVE_NODE, DELETE_NODE, PROPERTIES
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/table_header_cell.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/fragments/NodeContentEditorMenuBackAction.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.fragments;
12 |
13 | public interface NodeContentEditorMenuBackAction {
14 |
15 | /**
16 | * Returns to previous node content editor menu
17 | */
18 | void back();
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF000000
4 | #FFFFFFFF
5 | #FFFFFF
6 | #CA2A2A
7 | #F6F8FA
8 | #7f7f7f
9 | #E68B7F
10 | #E54D3A
11 | #AC1111
12 | #750000
13 | #58A5F0
14 | #0277BD
15 | #004C8C
16 | #07841B
17 | #8B691C
18 | #7F7F8D
19 | #FFFFFFFF
20 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/ScApplication.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry;
12 |
13 | import android.app.Application;
14 |
15 | /**
16 | * Application class that is available to all Activities
17 | */
18 | public class ScApplication extends Application {
19 | public AppContainer appContainer = new AppContainer();
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/URLSpanWebs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.text.style.URLSpan;
14 |
15 | /**
16 | * Span used to show website links
17 | */
18 | public class URLSpanWebs extends URLSpan {
19 | public URLSpanWebs(String url) {
20 | super(url);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_node_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_in.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/slide_out.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | /.idea/caches
3 | /.idea/libraries
4 | /.idea/modules.xml
5 | /.idea/workspace.xml
6 | /.idea/navEditor.xml
7 | /.idea/assetWizardSettings.xml
8 | .DS_Store
9 | /captures
10 | .externalNativeBuild
11 | .cxx
12 |
13 | # Built application files
14 | *.apk
15 | *.ap_
16 |
17 | # Files for the Dalvik VM
18 | *.dex
19 |
20 | # Java class files
21 | *.class
22 |
23 | # Gradle files
24 | .gradle/
25 | build/
26 | */build/
27 | /build
28 | .gradle
29 |
30 | # Local configuration name (sdk path, etc)
31 | local.properties
32 | /local.properties
33 |
34 | # Proguard folder generated by Eclipse
35 | proguard/
36 |
37 | # Log Files
38 | *.log
39 |
40 | .idea
41 | .idea/libraries/
42 | .idea/workspace.xml
43 | app/app.iml
44 | app/build.gradle
45 |
46 | # Keystore files
47 | *.jks
48 | *.keystore
49 |
50 | # Google Services (e.g. APIs or Firebase)
51 | google-services.json
52 |
53 | # Android Profiling
54 | *.hprof
55 |
56 | # Android Studio generated files and folders
57 | captures/
58 | .externalNativeBuild/
59 | .cxx/
60 | *.apk
61 | output.json
62 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | public class Constants {
14 | public final static String DATABASE_EXPORT_NOTI = "DATABASE_EXPORT_NOTI";
15 |
16 | public final static String PREFERENCE_DARK_MODE = "preferences_dark_mode";
17 | public final static String PREFERENCE_DISABLE_LINEWRAP = "preferences_linewrap";
18 | }
19 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/TypefaceSpanFamily.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.text.style.TypefaceSpan;
14 |
15 | import androidx.annotation.Nullable;
16 |
17 | /**
18 | * Span used to display monospace text
19 | */
20 | public class TypefaceSpanFamily extends TypefaceSpan {
21 | public TypefaceSpanFamily(@Nullable String family) {
22 | super(family);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/monospace.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/StyleSpanBold.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.graphics.Typeface;
14 | import android.text.style.StyleSpan;
15 |
16 | /**
17 | * Span used to show Bold typeface
18 | */
19 | public class StyleSpanBold extends StyleSpan {
20 | public StyleSpanBold() {
21 | super(Typeface.BOLD);
22 | }
23 |
24 | public StyleSpanBold(int style) {
25 | super(style);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_format_italic_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_create_node_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/options_menu_node_editor_fragment.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/StyleSpanItalic.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.graphics.Typeface;
14 | import android.text.style.StyleSpan;
15 |
16 | /**
17 | * Span used to show Italic typeface
18 | */
19 | public class StyleSpanItalic extends StyleSpan {
20 | public StyleSpanItalic() {
21 | super(Typeface.ITALIC);
22 | }
23 |
24 | public StyleSpanItalic(int style) {
25 | super(style);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/model/ScNodeContent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.model;
12 |
13 | public interface ScNodeContent {
14 | /**
15 | * Get ScNodeContent type
16 | * @return 0 - text to set into TextView, 1 - table content
17 | */
18 | byte getContentType();
19 |
20 | /**
21 | * Set node content type
22 | * @param type 0 - text to set into TextView, 1 - table content
23 | */
24 | void setContentType(byte type);
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/runnables/FindInNodeRunnableCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.runnables;
12 |
13 | public interface FindInNodeRunnableCallback {
14 | /**
15 | * Callback method that will be executed after running search for findInNode function
16 | */
17 | void searchFinished();
18 |
19 | /**
20 | * Callback method that will be executed before running search for findInNode function
21 | */
22 | void searchStarted();
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_arrow_up_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/options_menu_main_activity.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/BackgroundColorSpanCustom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.text.style.BackgroundColorSpan;
14 |
15 | /**
16 | * Span to mark background color. Needed to separate between CodeBox, Background and Monospace font
17 | * background spans.
18 | */
19 | public class BackgroundColorSpanCustom extends BackgroundColorSpan {
20 | public BackgroundColorSpanCustom(int color) {
21 | super(color);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_arrow_back_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/preferences/PreferencesFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.preferences;
12 |
13 | import android.os.Bundle;
14 |
15 | import androidx.preference.PreferenceFragmentCompat;
16 |
17 | import lt.ffda.sourcherry.R;
18 |
19 | public class PreferencesFragment extends PreferenceFragmentCompat {
20 |
21 | @Override
22 | public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
23 | setPreferencesFromResource(R.xml.preferences, rootKey);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/MonospaceBackgroundColorSpan.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.text.style.BackgroundColorSpan;
14 |
15 | /**
16 | * Span to mark background color of the monospace font spans. Needed to separate between CodeBox,
17 | * Background and Monospace font background spans.
18 | */
19 | public class MonospaceBackgroundColorSpan extends BackgroundColorSpan {
20 | public MonospaceBackgroundColorSpan(int color) {
21 | super(color);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_arrow_back_ios_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
18 |
19 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/fragments/NodeContentEditorInsertMenuActions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.fragments;
12 |
13 | public interface NodeContentEditorInsertMenuActions {
14 | /**
15 | * Attaches file to the node
16 | */
17 | void attachFile();
18 |
19 | /**
20 | * Inserts image into the node
21 | */
22 | void insertImage();
23 |
24 | /**
25 | * Shows fragment with options to customize the table before creation
26 | */
27 | void startInsertTable();
28 | }
29 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/runnables/NodesCollectedCallback.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.runnables;
12 |
13 | /**
14 | * Callback to execute commands after collecting all the nodes from Multifile database into
15 | * drawer_menu.xml file.
16 | */
17 | public interface NodesCollectedCallback {
18 | /**
19 | * Callback method to proceed after collect of failing to collect drawer_menu.xml
20 | * @param result 0 - success, 1 - failed, 2 - canceled
21 | */
22 | void onNodesCollected(int result);
23 | }
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_outline_close_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_format_color_text_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_format_underlined_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/outline_image_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/ColorPickerPresets.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | public enum ColorPickerPresets {
14 | BLUE(-10313494),
15 | GREEN(-11017335),
16 | YELLOW(-465828),
17 | ORANGE(-23736),
18 | RED(-630447),
19 | VIOLET(-2323747),
20 | BROWN(-3298417),
21 | WHITE(-1),
22 | BLACK(-8948101);
23 |
24 | private final int color;
25 |
26 | ColorPickerPresets(int color) {
27 | this.color = color;
28 | }
29 |
30 | public int getColor() {
31 | return color;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_edit_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_background_color_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_save_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_add_circle_outline_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/custom_edittext.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_menu_item_action_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_bookmarks_on_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_image_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/database/MultiDbFileShare.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.database;
12 |
13 | import android.net.Uri;
14 | public interface MultiDbFileShare {
15 |
16 | /**
17 | * Returns Uri of the file inside multi file database
18 | * @param nodeUniqueID unique id of the node
19 | * @param filename filename of the file attached to the node
20 | * @param control sha256sum sum of the file when "Use embedded file name on disk" is not turned on
21 | * @return uri of the file
22 | */
23 | public Uri getAttachedFileUri(String nodeUniqueID, String filename, String control);
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_format_bold_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/fragments/NodeContentEditorTableMenuActions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.fragments;
12 |
13 | public interface NodeContentEditorTableMenuActions {
14 | /**
15 | * Deletes focused column
16 | */
17 | void deleteColumn();
18 |
19 | /**
20 | * Deletes focused row
21 | */
22 | void deleteRow();
23 |
24 | /**
25 | * Deletes focused table
26 | */
27 | void deleteTable();
28 |
29 | /**
30 | * Inserts column to the right of the focused column
31 | */
32 | void insertColumn();
33 |
34 | /**
35 | * Inserts row bellow the focused row
36 | */
37 | void insertRow();
38 | }
39 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Enables namespacing of each library's R class so that its R class includes only the
19 | # resources declared in the library itself and none from the library's dependencies,
20 | # thereby reducing the size of the R class for that library
21 | android.nonTransitiveRClass=true
22 | android.nonFinalResIds=false
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_outline_bookmarks_off_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/alert_dialog_unsaved_changes.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
17 |
18 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_table_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_baseline_export_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_attachment_button_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_search_activity_result.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
22 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_node_editor.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
18 |
19 |
24 |
25 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_strikethrough_s_24.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
21 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_fragment_collect_nodes.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
21 |
22 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/AppContainer.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry;
12 |
13 | import android.os.Handler;
14 | import android.os.Looper;
15 |
16 | import java.util.concurrent.Executors;
17 | import java.util.concurrent.ScheduledThreadPoolExecutor;
18 |
19 | /**
20 | * Dependencies container class where all dependencies available for all the classes are stored.
21 | */
22 | public class AppContainer {
23 | public ScheduledThreadPoolExecutor executor = getExecutor();
24 | public Handler handler = getHandler();
25 |
26 | private ScheduledThreadPoolExecutor getExecutor() {
27 | ScheduledThreadPoolExecutor executor = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(2);
28 | executor.setRemoveOnCancelPolicy(true);
29 | return executor;
30 | }
31 |
32 | private Handler getHandler() {
33 | return new Handler(Looper.getMainLooper());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_fragment_open_database_progress.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
21 |
22 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/CheckBoxSwitch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | /**
14 | * Enum of checkbox states
15 | */
16 | public enum CheckBoxSwitch {
17 | EMPTY(9744, "☐"), // U+2610
18 | CHECKED(9745, "☑"), // U+2611
19 | CROSSED(9746, "☒"); // U+2612
20 |
21 | private final int code;
22 | private final String string;
23 |
24 | CheckBoxSwitch(int code, String string) {
25 | this.code = code;
26 | this.string = string;
27 | }
28 |
29 | /**
30 | * Returns unicode decimal code of the checkbox
31 | * @return unicode decimal code
32 | */
33 | public int getCode() {
34 | return code;
35 | }
36 |
37 | /**
38 | * Returns CharSequence value of CheckBox that can be used in replace method
39 | * @return CharSequence value of CheckBox
40 | */
41 | public String getString() {
42 | return string;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
18 |
19 |
25 |
26 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/PreferencesUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | import android.content.SharedPreferences;
14 |
15 | import androidx.annotation.NonNull;
16 |
17 | /**
18 | * Class holds commands to disable specific preferences at one
19 | */
20 | public class PreferencesUtils {
21 |
22 | /**
23 | * Disables MirrorDatabase preferences
24 | * @param sharedPreferences apps SharedPreferences instance
25 | */
26 | public static void disableMirrorDatabase(@NonNull SharedPreferences sharedPreferences) {
27 | SharedPreferences.Editor sharedPreferencesEditor = sharedPreferences.edit();
28 | sharedPreferencesEditor.putBoolean("mirror_database_switch", false);
29 | sharedPreferencesEditor.putBoolean("mirror_database_auto_export_switch", false);
30 | sharedPreferencesEditor.remove("mirrorDatabaseFilename");
31 | sharedPreferencesEditor.remove("mirrorDatabaseLastModified");
32 | sharedPreferencesEditor.commit();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/outline_table_edit_delete_col.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/dialog_fragment_save_open.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
18 |
26 |
27 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_drawer_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
20 |
21 |
27 |
28 |
37 |
38 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/values/arrays.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 |
14 | Light
15 | Dark
16 | System
17 |
18 |
19 |
20 | Ask
21 | Save
22 | Open
23 |
24 |
25 |
26 | Ask
27 | Exit without saving
28 | Save and exit
29 |
30 |
31 |
32 | ask
33 | exit
34 | save
35 |
36 |
37 |
38 | Default
39 | DejaVuSansMono
40 | Comfortaa
41 | Merriweather
42 | Caladea
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/outline_table_edit_delete_row.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/fragments/NodeContentEditorListsMenuActions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.fragments;
12 |
13 | public interface NodeContentEditorListsMenuActions {
14 |
15 | /**
16 | * Starts checklist at the current line. Insert empty checkbox ant the beginning of the current
17 | * line. If there is a checkbox at the start of the line - removes it.
18 | */
19 | void startChecklist();
20 |
21 | /**
22 | * Starts unordered list at the current line. If the line is already an unordered list line -
23 | * makes it a normal line.
24 | */
25 | void startUnordered();
26 |
27 | /**
28 | * Starts ordered list at the current line. If the line is already an ordered list line -
29 | * makes it a normal line.
30 | */
31 | void startOrdered();
32 |
33 | /**
34 | * Decreases list item indentation. Changes list items symbol if necessary.
35 | */
36 | void decreaseListItemIndentation();
37 |
38 | /**
39 | * Increases list item indentation. Changes list items symbol if necessary.
40 | */
41 | void increaseListItemIndentation();
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/model/FileInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.model;
12 |
13 | import android.net.Uri;
14 |
15 | /**
16 | * Holds data for the MirrorDatabase file found in MirrorDatabase folder set in settings
17 | */
18 | public class FileInfo {
19 | private long modified = 0;
20 | private Uri uri;
21 |
22 | /**
23 | * Get last modified date if the file
24 | * @return last modified of the database file, 0 - if database file was not found
25 | */
26 | public long getModified() {
27 | return modified;
28 | }
29 |
30 | /**
31 | * Get Uri of found mirror database
32 | * @return Uri of file
33 | */
34 | public Uri getUri() {
35 | return uri;
36 | }
37 |
38 | /**
39 | * Set last modified date of the file
40 | * @param modified last modified date
41 | */
42 | public void setModified(long modified) {
43 | this.modified = modified;
44 | }
45 |
46 | /**
47 | * Set Uri of the mirror database
48 | * @param uri Uri of file
49 | */
50 | public void setUri(Uri uri) {
51 | this.uri = uri;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/outline_table_edit_insert_col.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/outline_table_edit_insert_row.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/baseline_backup_delete_table.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
21 |
25 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/ClickableSpanLink.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.text.style.ClickableSpan;
14 |
15 | /**
16 | * Span used to display links to folders and files.
17 | * Holds additional values of link type and link itself
18 | */
19 | public abstract class ClickableSpanLink extends ClickableSpan {
20 | private String linkType;
21 | private String base64Link;
22 |
23 | /**
24 | * Sets link type
25 | * @return link type. For folder - "fold", files - "file"
26 | */
27 | public String getLinkType() {
28 | return this.linkType;
29 | }
30 |
31 | /**
32 | * Sets link type
33 | * @param linkType link type. For folder - "fold", files - "file"
34 | */
35 | public void setLinkType(String linkType) {
36 | this.linkType = linkType;
37 | }
38 |
39 | /**
40 | * Returns link encrypted in base64
41 | * @return link url/path in base64
42 | */
43 | public String getBase64Link() {
44 | return this.base64Link;
45 | }
46 |
47 | /**
48 | * Set link url/path
49 | * @param base64Link link url/path in base64
50 | */
51 | public void setBase64Link(String base64Link) {
52 | this.base64Link = base64Link;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/Calculations.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | import android.content.res.Resources;
14 |
15 | public class Calculations {
16 | /**
17 | * Converts provided PX value to DP and returns it
18 | * @param paddingInPX padding value in PX to be converted
19 | * @return padding value in DP
20 | */
21 | public static int pxToDp(int paddingInPX) {
22 | return (int) (paddingInPX / Resources.getSystem().getDisplayMetrics().density);
23 | }
24 |
25 | /**
26 | * Converts provided DP value to PX and returns it
27 | * @param paddingInDP padding value in DP to be converted
28 | * @return padding value in PX
29 | */
30 | public static int dpToPx(int paddingInDP) {
31 | return (int) (paddingInDP * Resources.getSystem().getDisplayMetrics().density);
32 | }
33 |
34 | /**
35 | * Calculates position to scroll horizontally to display FindInNode result to the user
36 | * @param scrollToX primary horizontal position
37 | * @return posittion to scroll horizontally
38 | */
39 | public static int adjustScrollToX(float scrollToX) {
40 | if (Resources.getSystem().getDisplayMetrics().density < scrollToX) {
41 | scrollToX -= 40; // Arbitrary position adjustment
42 | }
43 | return (int) scrollToX;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | }
4 |
5 | android {
6 | compileSdk 35
7 |
8 | defaultConfig {
9 | applicationId 'lt.ffda.sourcherry'
10 | minSdk 24
11 | targetSdk 35
12 | versionCode 16
13 | versionName "1.8.0"
14 |
15 | base.archivesName = "SourCherry_" + versionName
16 |
17 | testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
18 | }
19 | buildFeatures {
20 | buildConfig = true
21 | }
22 | buildTypes {
23 | release {
24 | minifyEnabled false
25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26 | }
27 | }
28 | compileOptions {
29 | sourceCompatibility JavaVersion.VERSION_1_8
30 | targetCompatibility JavaVersion.VERSION_1_8
31 | }
32 | namespace 'lt.ffda.sourcherry'
33 | }
34 |
35 | dependencies {
36 | implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.22"))
37 | implementation 'androidx.appcompat:appcompat:1.7.1'
38 | implementation 'com.google.android.material:material:1.12.0'
39 | implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
40 | implementation 'androidx.drawerlayout:drawerlayout:1.2.0'
41 | implementation 'androidx.recyclerview:recyclerview:1.4.0'
42 | implementation 'androidx.recyclerview:recyclerview-selection:1.2.0'
43 | implementation 'androidx.activity:activity:1.10.1'
44 | implementation 'androidx.fragment:fragment:1.8.9'
45 | implementation 'androidx.lifecycle:lifecycle-viewmodel:2.9.2'
46 | implementation 'androidx.preference:preference:1.2.1'
47 | implementation 'ru.noties:jlatexmath-android:0.2.0'
48 | testImplementation 'junit:junit:4.13.2'
49 | androidTestImplementation 'androidx.test.ext:junit:1.3.0'
50 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
51 | implementation 'com.github.omicronapps:7-Zip-JBinding-4Android:Release-16.02-2.02'
52 | implementation 'me.jfenn.ColorPickerDialog:base:0.2.2'
53 | }
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/model/ScNodeContentText.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.model;
12 |
13 | import android.text.SpannableStringBuilder;
14 |
15 | public class ScNodeContentText implements ScNodeContent {
16 | private byte type;
17 | private SpannableStringBuilder content;
18 |
19 | /**
20 | * Constructor for ScNodeContent object that holds node content (or a part of it)
21 | * in StringBuilder object. It holds everything except tables of the node.
22 | * @param type 0 - text to set into TextView, 1 - table content
23 | * @param content node text content
24 | */
25 | public ScNodeContentText(byte type, SpannableStringBuilder content) {
26 | this.type = type;
27 | this.content = content;
28 | }
29 |
30 | /**
31 | * Get node text content
32 | * @return node text content
33 | */
34 | public SpannableStringBuilder getContent() {
35 | return this.content;
36 | }
37 |
38 | /**
39 | * Set node text content
40 | * @param content node text content
41 | */
42 | public void setContent(SpannableStringBuilder content) {
43 | this.content = content;
44 | }
45 |
46 | @Override
47 | public byte getContentType() {
48 | return this.type;
49 | }
50 |
51 | @Override
52 | public void setContentType(byte type) {
53 | this.type = type;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences_general.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
14 |
15 |
20 |
21 |
25 |
26 |
33 |
34 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_move_node_fragment.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
21 |
22 |
28 |
29 |
35 |
36 |
45 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
18 |
19 |
24 |
25 |
30 |
31 |
35 |
39 |
40 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/options_menu_node_content_fragment.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/ClickableSpanFile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.text.style.ClickableSpan;
14 |
15 | /**
16 | * Span used to detect clicks on attached file in node content
17 | */
18 | public abstract class ClickableSpanFile extends ClickableSpan {
19 | private int newOffset;
20 | private String justification;
21 |
22 | /**
23 | * Get new offset of the element. It shows location where the element has to be inserted back
24 | * into the node content when it is being recreated.
25 | * @return element's offset
26 | */
27 | public int getNewOffset() {
28 | return this.newOffset;
29 | }
30 |
31 | /**
32 | * Set new offset of the element. It has to be calculated using the location of the span in the
33 | * node content.
34 | * @param newOffset element's offset
35 | */
36 | public void setNewOffset(int newOffset) {
37 | this.newOffset = newOffset;
38 | }
39 |
40 | /**
41 | * Get justification of the element
42 | * @return justification of the elements
43 | */
44 | public String getJustification() {
45 | return this.justification;
46 | }
47 |
48 | /**
49 | * Set justification of the element
50 | * @param justification element's justification ("left", "right", "center", "fill")
51 | */
52 | public void setJustification(String justification) {
53 | this.justification = justification;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences_database.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
14 |
15 |
21 |
22 |
27 |
28 |
33 |
34 |
39 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/ClickableSpanNode.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.text.style.ClickableSpan;
14 |
15 | /**
16 | * Span used to show link to another node
17 | * Holds additional values
18 | */
19 | public abstract class ClickableSpanNode extends ClickableSpan {
20 | // Unique ID of the node to open when link is tapped
21 | private String nodeUniqueID;
22 | // Anchor name that view scrolls to. This value has no affect in SourCherry
23 | private String linkAnchorName;
24 |
25 | /**
26 | * Get anchor name that view has to scroll to when
27 | * linked node is opened
28 | * @return anchor name
29 | */
30 | public String getLinkAnchorName() {
31 | return this.linkAnchorName;
32 | }
33 |
34 | /**
35 | * Set anchor name that view has to scroll to when
36 | * linked node is opened
37 | * @param linkAnchorName anchor name
38 | */
39 | public void setLinkAnchorName(String linkAnchorName) {
40 | this.linkAnchorName = linkAnchorName;
41 | }
42 |
43 | /**
44 | * Get unique ID of the node the link leads to
45 | * @return unique ID of the node
46 | */
47 | public String getNodeUniqueID() {
48 | return this.nodeUniqueID;
49 | }
50 |
51 | /**
52 | * Set unique ID of the node the link leads to
53 | * @param nodeUniqueID unique ID of the node
54 | */
55 | public void setNodeUniqueID(String nodeUniqueID) {
56 | this.nodeUniqueID = nodeUniqueID;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/customUiElements/ScTableLayout.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.customUiElements;
12 |
13 | import android.content.Context;
14 | import android.widget.TableLayout;
15 |
16 | public class ScTableLayout extends TableLayout {
17 | private String colWidths;
18 | private byte lightInterface;
19 | public ScTableLayout(Context context) {
20 | super(context);
21 | }
22 |
23 | /**
24 | * Getting what column widths should be used in CherryTree
25 | * @return comma separated values for each column. 0 - default value, otherwise - user set value
26 | */
27 | public String getColWidths() {
28 | return colWidths;
29 | }
30 |
31 | /**
32 | * Setting what column widths should be used in CherryTree. This value has no effect in SourCherry
33 | * @param colWidths comma separated values for each column. 0 - default value, otherwise - user set value
34 | */
35 | public void setColWidths(String colWidths) {
36 | this.colWidths = colWidths;
37 | }
38 |
39 | /**
40 | * Is table table using lightweight interface in CherryTree
41 | * @return 1 - if table using lightweight interface, 0 - otherwise
42 | */
43 | public byte getLightInterface() {
44 | return this.lightInterface;
45 | }
46 |
47 | /**
48 | * Setting what interface should be used in CherryTree
49 | * @param light 1 - if table using lightweight interface, 0 - otherwise
50 | */
51 | public void setLightInterface(byte light) {
52 | this.lightInterface = light;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_foreground_monochrome.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/OrderedSwitch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | /**
14 | * Enum for ordered/numbered list items
15 | */
16 | public enum OrderedSwitch {
17 | FULL_STOP(46, "."), // First level ordered list item's mark
18 | RIGHT_PARENTHESIS(29, ")"), // Second level ordered list item's mark
19 | HYPHEN_MINUS(45, "-"), // Third level ordered list item's mark
20 | GREATER_THAN_SIGN(62, ">"); // Fourth level ordered list item's mark
21 |
22 | private final int code;
23 | private final String string;
24 |
25 | OrderedSwitch(int code, String string) {
26 | this.code = code;
27 | this.string = string;
28 | }
29 |
30 | /**
31 | * Returns unicode decimal code of the ordered list item
32 | * @return unicode decimal code
33 | */
34 | public int getCode() {
35 | return code;
36 | }
37 |
38 | /**
39 | * Returns CharSequence value of ordered list item that can be used in replace method
40 | * @return CharSequence value of ordered list item
41 | */
42 | public String getString() {
43 | return string;
44 | }
45 |
46 | /**
47 | * Returns ordered list item string value for a specific level. Ordered lists have 4 levels
48 | * @param level item's level
49 | * @return ordered list string item
50 | */
51 | public static String getItemForLevel(int level) {
52 | switch (level) {
53 | case 1:
54 | return RIGHT_PARENTHESIS.string;
55 | case 2:
56 | return HYPHEN_MINUS.string;
57 | case 3:
58 | return GREATER_THAN_SIGN.string;
59 | default:
60 | return FULL_STOP.string;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_imported_databases.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
20 |
21 |
35 |
36 |
44 |
45 |
53 |
--------------------------------------------------------------------------------
/app/src/main/res/xml-v28/preferences_database.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
25 |
26 |
32 |
33 |
38 |
39 |
44 |
45 |
50 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/RegexPatterns.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | import java.util.regex.Pattern;
14 |
15 | /**
16 | * Holds all regex patterns used in the app for efficiency
17 | */
18 | public class RegexPatterns {
19 | private RegexPatterns() {}
20 |
21 | /**
22 | * Should match all list starts available in CherryTree with any amount of spaces in front of
23 | * list symbol and any space after it, but not new line.
24 | */
25 | public static final Pattern allListStarts = Pattern.compile(
26 | "^([ \\t\\f\\r]*)(([\\u2610\\u2611\\u2612\\u2022\\u25C7\\u25AA\\u002D\\u2192\\u21D2])|(\\d+[\\.\\)\\->]))[ \\t\\f\\r]*"
27 | );
28 |
29 | /**
30 | * Matches all checkboxes
31 | */
32 | public static final Pattern allCheckbox = Pattern.compile("\\s*[\\u2610\\u2611\\u2612]");
33 |
34 | /**
35 | * Matches checked and crossed checkboxes
36 | */
37 | public static final Pattern checkedCheckbox = Pattern.compile("\\s*[\\u2611\\u2612]");
38 |
39 | /**
40 | * Matches new line char
41 | */
42 | public static final Pattern lastNewline = Pattern.compile("\\n", Pattern.DOTALL);
43 |
44 | /**
45 | * Matches oldered list and it's digit as a group(1) at the start of the string
46 | */
47 | public static final Pattern orderdList = Pattern.compile("^(\\s*)(\\d+)[\\.\\)\\->]");
48 |
49 | /**
50 | * Matches oldered list and it's digit as a group(1) at any place of the string
51 | */
52 | public static final Pattern orderdListItem = Pattern.compile("\\n([ \\t\\f\\r]*)(\\d+)[\\.\\)\\->].*");
53 |
54 | /**
55 | * Matches unordered list items
56 | */
57 | public static final Pattern unorderedList = Pattern.compile("^\\s*([\\u2022\\u25C7\\u25AA\\u002D\\u2192\\u21D2])");
58 |
59 | /**
60 | * Matches ordered list items
61 | */
62 | public static final Pattern orderedList = Pattern.compile("^\\s*(\\d+[\\.\\)\\->])");
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/customUiElements/CustomTextEdit.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | /*
12 | * This file is part of SourCherry.
13 | *
14 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
15 | *
16 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
19 | */
20 |
21 | package lt.ffda.sourcherry.customUiElements;
22 |
23 | import android.content.Context;
24 | import android.util.AttributeSet;
25 |
26 | import androidx.annotation.NonNull;
27 | import androidx.annotation.Nullable;
28 | import androidx.appcompat.widget.AppCompatEditText;
29 |
30 | /**
31 | * Used with custom_edittext.xml to display editable text in nodeContentEditor fragment.
32 | * Has a boolean to mark it as a table cell. Defaults to reporting that it is not a
33 | * table cell.
34 | */
35 | public class CustomTextEdit extends AppCompatEditText {
36 | private boolean tableCell = false;
37 |
38 | public CustomTextEdit(@NonNull Context context, @Nullable AttributeSet attrs) {
39 | super(context, attrs);
40 | }
41 |
42 | /**
43 | * Check if CustomTextEdit is marked as a table cell
44 | * @return true - table cell, false - otherwise
45 | */
46 | public boolean isTableCell() {
47 | return tableCell;
48 | }
49 |
50 | /**
51 | * Mark CustomTextEdit as a table cell. Defaults as false when creating a new CustomTextEdit.
52 | * @param tableCell true - is a table cell, false - otherwise
53 | */
54 | public void setTableCell(boolean tableCell) {
55 | this.tableCell = tableCell;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/UnorderedSwitch.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.utils;
12 |
13 | /**
14 | * Enum for unordered/bulleted list items
15 | */
16 | public enum UnorderedSwitch {
17 | BULLTET(8226, "•"), // First level bullet point U+2022
18 | DIAMOND(9671, "◇"), // Second level bullet point U+25C7
19 | BLACK_SMALL_SQUERE(9642, "▪"), // Third level bullet point U+25AA
20 | HYPHEN_MINUS(45, "-"), // Forth level bullet point U+002D
21 | RIGHTWARDS_ARROW(8594, "→"), // Fifth level bullter point U+2192
22 | RIGHTWARDS_DOUBLE_ARROW(8658, "⇒"); // Sixth level bullter point U+21D2
23 |
24 | private final int code;
25 | private final String string;
26 |
27 | UnorderedSwitch(int code, String string) {
28 | this.code = code;
29 | this.string = string;
30 | }
31 |
32 | /**
33 | * Returns unicode decimal code of the unordered list item
34 | * @return unicode decimal code
35 | */
36 | public int getCode() {
37 | return code;
38 | }
39 |
40 | /**
41 | * Returns CharSequence value of unordered list item that can be used in replace method
42 | * @return CharSequence value of unordered list item
43 | */
44 | public String getString() {
45 | return string;
46 | }
47 |
48 | /**
49 | * Returns unordered list item string value for a specific level. Unordered lists have 6 levels
50 | * @param level item's level
51 | * @return unordered list string item
52 | */
53 | public static String getItemForLevel(int level) {
54 | switch (level) {
55 | case 1:
56 | return DIAMOND.string;
57 | case 2:
58 | return BLACK_SMALL_SQUERE.string;
59 | case 3:
60 | return HYPHEN_MINUS.string;
61 | case 4:
62 | return RIGHTWARDS_ARROW.string;
63 | case 5:
64 | return RIGHTWARDS_DOUBLE_ARROW.string;
65 | default:
66 | return BULLTET.string;
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/fragments/NodeContentEditorMainMenuActions.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.fragments;
12 |
13 | public interface NodeContentEditorMainMenuActions {
14 |
15 | /**
16 | * Changes selected text background color
17 | */
18 | void changeBackgroundColor();
19 |
20 | /**
21 | * Changes selected text foreground color
22 | */
23 | void changeForegroundColor();
24 |
25 | /**
26 | * Clears some formatting of selected text
27 | */
28 | void clearFormatting();
29 |
30 | /**
31 | * Set color that will be used to set background/foreground color of a text
32 | */
33 | void setColor(int color);
34 |
35 | /**
36 | * Shows fragment with insert/attach actions menu in nodeEditContent button row
37 | */
38 | void showInsertRow();
39 |
40 | /**
41 | * Shows fragment with list actions menu in nodeEditContent button row
42 | */
43 | void showListsRow();
44 |
45 | /**
46 | * Makes selected font bold if there isn't any bold text in selection.
47 | * Otherwise it will remove bold text property of the in selected part of the text.
48 | */
49 | void toggleFontBold();
50 |
51 | /**
52 | * Makes selected font italic if there isn't any italic text in selection.
53 | * Otherwise it will remove italic property of the text in selected part of the text.
54 | */
55 | void toggleFontItalic();
56 |
57 | /**
58 | * Changes selected font to monospace if selected text does not have any monospaced font in it.
59 | * Otherwise it will remove monospace font property of the selected part of the text.
60 | */
61 | void toggleFontMonospace();
62 |
63 | /**
64 | * Makes selected text strikethrough if there isn't any struckthrough text in selection.
65 | * Otherwise it will remove strikethrough property of the text in selected part of the text.
66 | */
67 | void toggleFontStrikethrough();
68 |
69 | /**
70 | * Makes selected text underlined if there isn't any underlined text in selection.
71 | * Otherwise it will remove underlined property of the text in selected part of the text.
72 | */
73 | void toggleFontUnderline();
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/ImageSpanLatex.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.graphics.drawable.Drawable;
14 | import android.text.style.ImageSpan;
15 |
16 | import androidx.annotation.NonNull;
17 |
18 | /**
19 | * Image span used to display compiled latex image
20 | * from latex code. Contains code that was used to compile
21 | * latex image saved in it.
22 | */
23 | public class ImageSpanLatex extends ImageSpan {
24 | private String latexCode;
25 | private int newOffset;
26 | private String justification;
27 | public ImageSpanLatex(@NonNull Drawable drawable) {
28 | super(drawable);
29 | }
30 |
31 | /**
32 | * Get justification of the element
33 | * @return justification of the elements
34 | */
35 | public String getJustification() {
36 | return this.justification;
37 | }
38 |
39 | /**
40 | * Set justification of the element
41 | * @param justification element's justification ("left", "right", "center", "fill")
42 | */
43 | public void setJustification(String justification) {
44 | this.justification = justification;
45 | }
46 |
47 | /**
48 | * Get latex code that was used to compile latex image
49 | * @return latex code
50 | */
51 | public String getLatexCode() {
52 | return this.latexCode;
53 | }
54 |
55 | /**
56 | * Set latex code that was used to compile latex image
57 | * @param latexCode latex code
58 | */
59 | public void setLatexCode(String latexCode) {
60 | this.latexCode = latexCode;
61 | }
62 |
63 | /**
64 | * Get new offset of the element. It shows location where the element has to be inserted back
65 | * into the node content when it is being recreated.
66 | * @return element's offset
67 | */
68 | public int getNewOffset() {
69 | return this.newOffset;
70 | }
71 |
72 | /**
73 | * Set new offset of the element. It has to be calculated using the location of the span in the
74 | * node content.
75 | * @param newOffset element's offset
76 | */
77 | public void setNewOffset(int newOffset) {
78 | this.newOffset = newOffset;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences_appearance.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
14 |
15 |
22 |
23 |
30 |
31 |
35 |
36 |
43 |
44 |
48 |
54 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_outline_broken_latex_48.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
23 |
26 |
29 |
32 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/utils/ReturnSelectedFileUriForSaving.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | /*
12 | * This file is part of SourCherry.
13 | *
14 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
15 | *
16 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 | *
18 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
19 | */
20 |
21 | package lt.ffda.sourcherry.utils;
22 |
23 | import android.app.Activity;
24 | import android.content.Context;
25 | import android.content.Intent;
26 |
27 | import androidx.activity.result.contract.ActivityResultContract;
28 | import androidx.annotation.NonNull;
29 | import androidx.annotation.Nullable;
30 |
31 | public class ReturnSelectedFileUriForSaving extends ActivityResultContract {
32 | // Almost standard Intent.ACTION_CREATE_DOCUMENT, just adds some extra data that is needed to find file in database
33 | private String nodeUniqueID;
34 | private String filename;
35 | private String time;
36 |
37 | @NonNull
38 | @Override
39 | public Intent createIntent(@NonNull Context context, String[] strings) {
40 | // String[] has to be [FileMimeType, nodeUniqueID, attachedFileFilename, time]
41 | nodeUniqueID = strings[1];
42 | filename = strings[2];
43 | time = strings[3];
44 | Intent intent = new Intent(Intent.ACTION_CREATE_DOCUMENT);
45 | intent.setType(strings[0]);
46 | intent.putExtra(Intent.EXTRA_TITLE, filename);
47 | return intent;
48 | }
49 |
50 | @Override
51 | public Intent parseResult(int resultCode, @Nullable Intent result) {
52 | // Returns selected file Uri with attached data needed to retrieve data from database
53 | if (resultCode != Activity.RESULT_OK || result == null) {
54 | return null;
55 | }
56 | result.putExtra("nodeUniqueID", nodeUniqueID);
57 | result.putExtra("filename", filename);
58 | result.putExtra("time", time);
59 | return result;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/ImageSpanImage.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.content.Context;
14 | import android.graphics.drawable.Drawable;
15 | import android.net.Uri;
16 | import android.text.style.ImageSpan;
17 |
18 | import androidx.annotation.NonNull;
19 |
20 | /**
21 | * Span used to display images in node
22 | */
23 | public class ImageSpanImage extends ImageSpan {
24 | private int newOffset;
25 | private String justification;
26 | private String sha256sum;
27 |
28 | public ImageSpanImage(@NonNull Drawable drawable) {
29 | super(drawable);
30 | }
31 |
32 | public ImageSpanImage(@NonNull Context context, @NonNull Uri uri) {
33 | super(context, uri);
34 | }
35 |
36 | /**
37 | * Get justification of the element
38 | * @return justification of the elements
39 | */
40 | public String getJustification() {
41 | return this.justification;
42 | }
43 |
44 | /**
45 | * Set justification of the element
46 | * @param justification element's justification ("left", "right", "center", "fill")
47 | */
48 | public void setJustification(String justification) {
49 | this.justification = justification;
50 | }
51 |
52 | /**
53 | * Get new offset of the element. It shows location where the element has to be inserted back
54 | * into the node content when it is being recreated.
55 | * @return element's offset
56 | */
57 | public int getNewOffset() {
58 | return this.newOffset;
59 | }
60 |
61 | /**
62 | * Set new offset of the element. It has to be calculated using the location of the span in the
63 | * node content.
64 | * @param newOffset element's offset
65 | */
66 | public void setNewOffset(int newOffset) {
67 | this.newOffset = newOffset;
68 | }
69 |
70 | /**
71 | * Get sha256sum value of the file. It is only used in Multifile databases as a filename in filesystem
72 | * @return sha256sum value of the file
73 | */
74 | public String getSha256sum() {
75 | return sha256sum;
76 | }
77 |
78 | /**
79 | * Set sha256sum value of the file. It is only used in Multifile databases as a filename in filesystem
80 | * @param sha256sum sha256sum value of the file
81 | */
82 | public void setSha256sum(String sha256sum) {
83 | this.sha256sum = sha256sum;
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences_database_mirror_database.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
14 |
15 |
20 |
21 |
26 |
27 |
32 |
33 |
38 |
39 |
45 |
46 |
52 |
53 |
57 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/java/lt/ffda/sourcherry/spans/ImageSpanAnchor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * This file is part of SourCherry.
3 | *
4 | * SourCherry is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
5 | *
6 | * SourCherry is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
7 | *
8 | * You should have received a copy of the GNU General Public License along with SourCherry. If not, see .
9 | */
10 |
11 | package lt.ffda.sourcherry.spans;
12 |
13 | import android.graphics.drawable.Drawable;
14 | import android.text.style.ImageSpan;
15 |
16 | import androidx.annotation.NonNull;
17 |
18 | /**
19 | * Span used to show anchor image placeholder.
20 | * Holds anchor attribute value, that does not have
21 | * any affect in SourCherry
22 | */
23 | public class ImageSpanAnchor extends ImageSpan {
24 | // Anchor attribute value of the encoded_png tag
25 | // It's anchor name that CherryTree used to scroll view to
26 | private final String anchorName;
27 | private int newOffset;
28 | private String justification;
29 |
30 | /**
31 | * Constructor to create anchor image to be inserted into node content
32 | * @param drawable drawable of the anchor
33 | * @param verticalAlignment alignment of the image in the line
34 | * @param anchorName Anchor attribute value of the encoded_png tag
35 | */
36 | public ImageSpanAnchor(@NonNull Drawable drawable, int verticalAlignment, String anchorName) {
37 | super(drawable, verticalAlignment);
38 | this.anchorName = anchorName;
39 | }
40 |
41 | /**
42 | * Get anchor attribute value of the encoded_png tag
43 | * @return anchor attribute value
44 | */
45 | public String getAnchorName() {
46 | return this.anchorName;
47 | }
48 |
49 | /**
50 | * Get justification of the element
51 | * @return justification of the elements
52 | */
53 | public String getJustification() {
54 | return this.justification;
55 | }
56 |
57 | /**
58 | * Set justification of the element
59 | * @param justification element's justification ("left", "right", "center", "fill")
60 | */
61 | public void setJustification(String justification) {
62 | this.justification = justification;
63 | }
64 |
65 | /**
66 | * Get new offset of the element. It shows location where the element has to be inserted back
67 | * into the node content when it is being recreated.
68 | * @return element's offset
69 | */
70 | public int getNewOffset() {
71 | return this.newOffset;
72 | }
73 |
74 | /**
75 | * Set new offset of the element. It has to be calculated using the location of the span in the
76 | * node content.
77 | * @param newOffset element's offset
78 | */
79 | public void setNewOffset(int newOffset) {
80 | this.newOffset = newOffset;
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_outline_broken_image_48.xml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
17 |
20 |
23 |
26 |
29 |
32 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_search.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
26 |
27 |
32 |
33 |
40 |
41 |
46 |
47 |
51 |
52 |
56 |
57 |
64 |
65 |
70 |
71 |
72 |
--------------------------------------------------------------------------------