├── app ├── .gitignore ├── src │ ├── main │ │ ├── ic_launcher-web.png │ │ ├── res │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── bold.png │ │ │ │ ├── h1.png │ │ │ │ ├── h2.png │ │ │ │ ├── h3.png │ │ │ │ ├── undo.png │ │ │ │ ├── indent.png │ │ │ │ ├── italic.png │ │ │ │ ├── bullets.png │ │ │ │ ├── numbers.png │ │ │ │ ├── outdent.png │ │ │ │ ├── underline.png │ │ │ │ ├── ic_launcher.png │ │ │ │ ├── justify_center.png │ │ │ │ ├── justify_left.png │ │ │ │ └── justify_right.png │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── widget_preview.jpg │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-hdpi │ │ │ │ ├── ic_add_png.png │ │ │ │ ├── ic_note_add_png.png │ │ │ │ ├── ic_playlist_add_png.png │ │ │ │ └── ic_create_folder_png.png │ │ │ ├── drawable-mdpi │ │ │ │ ├── ic_add_png.png │ │ │ │ ├── ic_note_add_png.png │ │ │ │ ├── ic_playlist_add_png.png │ │ │ │ └── ic_create_folder_png.png │ │ │ ├── drawable-xhdpi │ │ │ │ ├── ic_add_png.png │ │ │ │ ├── ic_note_add_png.png │ │ │ │ ├── ic_create_folder_png.png │ │ │ │ └── ic_playlist_add_png.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── neuronizer.png │ │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ │ ├── ic_add_png.png │ │ │ │ ├── ic_note_add_png.png │ │ │ │ ├── ic_playlist_add_png.png │ │ │ │ └── ic_create_folder_png.png │ │ │ ├── drawable │ │ │ │ ├── separator.xml │ │ │ │ ├── ic_done_128dp.xml │ │ │ │ ├── ic_playlist_add_128dp.xml │ │ │ │ ├── ic_add_white_24dp.xml │ │ │ │ ├── ic_list_gray_24dp.xml │ │ │ │ ├── ic_done_white_24dp.xml │ │ │ │ ├── ic_sort_128dp.xml │ │ │ │ ├── ic_note_gray_22dp.xml │ │ │ │ ├── ic_sort_white_24dp.xml │ │ │ │ ├── ic_redo_128dp.xml │ │ │ │ ├── ic_undo_128dp.xml │ │ │ │ ├── ic_drag_handle_black_24dp.xml │ │ │ │ ├── ic_reorder_128dp.xml │ │ │ │ ├── ic_delete_white_24dp.xml │ │ │ │ ├── ic_expand_more_black_24dp.xml │ │ │ │ ├── ic_note_add_128dp.xml │ │ │ │ ├── ic_expand_less_black_24dp.xml │ │ │ │ ├── ic_playlist_add_white_24dp.xml │ │ │ │ ├── ic_add_box_white_24dp.xml │ │ │ │ ├── ic_edit_128dp.xml │ │ │ │ ├── ic_note_add_white_24dp.xml │ │ │ │ ├── ic_create_new_folder_128dp.xml │ │ │ │ ├── ic_edit_white_24dp.xml │ │ │ │ ├── selector_switch_image_button.xml │ │ │ │ ├── ic_content_copy_white_24dp.xml │ │ │ │ ├── ic_create_new_folder_white_24dp.xml │ │ │ │ ├── ic_content_copy_gray_24dp.xml │ │ │ │ ├── selector_activate_image_button.xml │ │ │ │ ├── ic_lightbulb_128dp.xml │ │ │ │ ├── ic_lightbulb_outline_gray_24dp.xml │ │ │ │ ├── ic_lightbulb_outline_light_gray_24dp.xml │ │ │ │ ├── ic_lightbulb_outline_primary_24dp.xml │ │ │ │ ├── ic_share_black_24dp.xml │ │ │ │ ├── widget_header_inner_shadow.xml │ │ │ │ ├── done_add_white_24dp.xml │ │ │ │ ├── widget_header_outer_shadow.xml │ │ │ │ ├── ic_settings_black_24dp.xml │ │ │ │ └── fab_label_background.xml │ │ │ ├── anim │ │ │ │ ├── slide_in_right.xml │ │ │ │ └── slide_out_left.xml │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ ├── layout │ │ │ │ ├── dialog_rich_text.xml │ │ │ │ ├── spinner_item.xml │ │ │ │ ├── dialog_input.xml │ │ │ │ ├── fragment_imprint.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── widget_todo_list_header.xml │ │ │ │ ├── fragment_about.xml │ │ │ │ ├── widget_todo_list_item.xml │ │ │ │ ├── todo_list_header.xml │ │ │ │ ├── fragment_note.xml │ │ │ │ ├── widget_todo_list.xml │ │ │ │ └── activity_widget_configure.xml │ │ │ ├── xml │ │ │ │ ├── widget_provider_todo.xml │ │ │ │ └── preferences.xml │ │ │ ├── menu │ │ │ │ ├── menu_todo_list.xml │ │ │ │ ├── menu_preview.xml │ │ │ │ ├── menu_action_header.xml │ │ │ │ └── menu_note.xml │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── string_about.xml │ │ │ │ ├── string_imprint.xml │ │ │ │ └── styles.xml │ │ │ ├── values-de │ │ │ │ ├── string_about.xml │ │ │ │ └── string_imprint.xml │ │ │ ├── values-v21 │ │ │ │ └── styles.xml │ │ │ └── drawable-v21 │ │ │ │ └── fab_label_background.xml │ │ ├── assets │ │ │ ├── fonts │ │ │ │ └── Quicksand-Regular.ttf │ │ │ └── css │ │ │ │ ├── About.css │ │ │ │ └── Details.css │ │ ├── java │ │ │ └── de │ │ │ │ └── djuelg │ │ │ │ └── neuronizer │ │ │ │ ├── domain │ │ │ │ ├── comparator │ │ │ │ │ ├── PositionCompareable.java │ │ │ │ │ ├── PreviewCompareable.java │ │ │ │ │ ├── ImportanceComparator.java │ │ │ │ │ ├── PositionComparator.java │ │ │ │ │ ├── AlphabeticComparator.java │ │ │ │ │ ├── CreationDateComparator.java │ │ │ │ │ └── LastChangeComparator.java │ │ │ │ ├── repository │ │ │ │ │ ├── Repository.java │ │ │ │ │ ├── PreviewRepository.java │ │ │ │ │ ├── NoteRepository.java │ │ │ │ │ └── TodoListRepository.java │ │ │ │ ├── interactors │ │ │ │ │ ├── preview │ │ │ │ │ │ ├── AddNoteInteractor.java │ │ │ │ │ │ ├── AddTodoListInteractor.java │ │ │ │ │ │ ├── RenameNoteInteractor.java │ │ │ │ │ │ ├── DeleteNoteInteractor.java │ │ │ │ │ │ ├── DisplayPreviewInteractor.java │ │ │ │ │ │ ├── EditTodoListInteractor.java │ │ │ │ │ │ ├── DeleteTodoListInteractor.java │ │ │ │ │ │ └── impl │ │ │ │ │ │ │ ├── DeleteNoteInteractorImpl.java │ │ │ │ │ │ │ ├── DeleteTodoListInteractorImpl.java │ │ │ │ │ │ │ ├── AddNoteInteractorImpl.java │ │ │ │ │ │ │ ├── DisplayPreviewInteractorImpl.java │ │ │ │ │ │ │ ├── AddTodoListInteractorImpl.java │ │ │ │ │ │ │ ├── RenameNoteInteractorImpl.java │ │ │ │ │ │ │ └── EditTodoListInteractorImpl.java │ │ │ │ │ ├── todolist │ │ │ │ │ │ ├── AddItemInteractor.java │ │ │ │ │ │ ├── AddHeaderInteractor.java │ │ │ │ │ │ ├── DisplayItemInteractor.java │ │ │ │ │ │ ├── EditItemInteractor.java │ │ │ │ │ │ ├── DeleteItemInteractor.java │ │ │ │ │ │ ├── EditHeaderInteractor.java │ │ │ │ │ │ ├── DeleteHeaderInteractor.java │ │ │ │ │ │ ├── DisplayHeadersInteractor.java │ │ │ │ │ │ ├── DisplayTodoListInteractor.java │ │ │ │ │ │ └── impl │ │ │ │ │ │ │ ├── DisplayItemInteractorImpl.java │ │ │ │ │ │ │ ├── DisplayHeadersInteractorImpl.java │ │ │ │ │ │ │ ├── DeleteItemInteractorImpl.java │ │ │ │ │ │ │ ├── DeleteHeaderInteractorImpl.java │ │ │ │ │ │ │ ├── DisplayTodoListInteractorImpl.java │ │ │ │ │ │ │ ├── AddHeaderInteractorImpl.java │ │ │ │ │ │ │ └── EditHeaderInteractorImpl.java │ │ │ │ │ ├── note │ │ │ │ │ │ ├── EditNoteBodyInteractor.java │ │ │ │ │ │ ├── DisplayNoteInteractor.java │ │ │ │ │ │ └── impl │ │ │ │ │ │ │ ├── DisplayNoteInteractorImpl.java │ │ │ │ │ │ │ └── EditNoteBodyInteractorImpl.java │ │ │ │ │ └── base │ │ │ │ │ │ ├── Interactor.java │ │ │ │ │ │ └── AbstractInteractor.java │ │ │ │ ├── model │ │ │ │ │ ├── preview │ │ │ │ │ │ ├── ImportanceComparable.java │ │ │ │ │ │ ├── Preview.java │ │ │ │ │ │ ├── Sortation.java │ │ │ │ │ │ ├── ItemsPerPreview.java │ │ │ │ │ │ ├── Importance.java │ │ │ │ │ │ ├── NotePreview.java │ │ │ │ │ │ └── TodoListPreview.java │ │ │ │ │ ├── BaseModel.java │ │ │ │ │ └── todolist │ │ │ │ │ │ └── TodoListSection.java │ │ │ │ └── executor │ │ │ │ │ ├── MainThread.java │ │ │ │ │ ├── Executor.java │ │ │ │ │ └── impl │ │ │ │ │ └── ThreadExecutor.java │ │ │ │ ├── presentation │ │ │ │ ├── exception │ │ │ │ │ └── ParentNotFoundException.java │ │ │ │ ├── ui │ │ │ │ │ ├── custom │ │ │ │ │ │ ├── MarkdownConverter.java │ │ │ │ │ │ ├── HtmlStripper.java │ │ │ │ │ │ ├── FragmentInteractionListener.java │ │ │ │ │ │ ├── Clipboard.java │ │ │ │ │ │ ├── view │ │ │ │ │ │ │ ├── Animations.java │ │ │ │ │ │ │ ├── TypefaceSpan.java │ │ │ │ │ │ │ └── AppbarCustomizer.java │ │ │ │ │ │ └── RecyclerViewScrollListener.java │ │ │ │ │ ├── widget │ │ │ │ │ │ └── WidgetService.java │ │ │ │ │ ├── dialog │ │ │ │ │ │ ├── FileDialogs.java │ │ │ │ │ │ ├── NoteDialogs.java │ │ │ │ │ │ └── TodoListDialogs.java │ │ │ │ │ ├── flexibleadapter │ │ │ │ │ │ └── SectionableAdapter.java │ │ │ │ │ ├── Constants.java │ │ │ │ │ └── fragments │ │ │ │ │ │ └── ImprintFragment.java │ │ │ │ └── presenters │ │ │ │ │ ├── HeaderPresenter.java │ │ │ │ │ ├── NotePresenter.java │ │ │ │ │ ├── TodoListPresenter.java │ │ │ │ │ ├── DisplayNotePresenter.java │ │ │ │ │ ├── base │ │ │ │ │ ├── AbstractPresenter.java │ │ │ │ │ └── BasePresenter.java │ │ │ │ │ ├── DisplayTodoListPresenter.java │ │ │ │ │ ├── DisplayPreviewPresenter.java │ │ │ │ │ ├── ItemPresenter.java │ │ │ │ │ └── impl │ │ │ │ │ └── NotePresenterImpl.java │ │ │ │ ├── storage │ │ │ │ ├── converter │ │ │ │ │ ├── NoteDAOConverter.java │ │ │ │ │ ├── TodoListDAOConverter.java │ │ │ │ │ ├── TodoListItemDAOConverter.java │ │ │ │ │ └── TodoListHeaderDAOConverter.java │ │ │ │ ├── migration │ │ │ │ │ └── RealmMigrator.java │ │ │ │ ├── RepositoryImpl.java │ │ │ │ └── model │ │ │ │ │ ├── TodoListDAO.java │ │ │ │ │ ├── NoteDAO.java │ │ │ │ │ └── TodoListHeaderDAO.java │ │ │ │ ├── AndroidApplication.java │ │ │ │ └── threading │ │ │ │ └── MainThreadImpl.java │ │ └── AndroidManifest.xml │ ├── debug │ │ └── res │ │ │ ├── values │ │ │ └── strings.xml │ │ │ └── values-de │ │ │ └── strings.xml │ └── test │ │ └── java │ │ └── de │ │ └── djuelg │ │ └── neuronizer │ │ ├── threading │ │ └── TestMainThread.java │ │ └── storage │ │ └── PreviewRepositoryMock.java ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── screenshots.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .idea ├── vcs.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml ├── gradle.xml └── codeStyles │ └── Project.xml ├── QA ├── quality.gradle └── findbugs │ └── findbugs-filter.xml ├── .gitignore ├── gradle.properties └── gradlew.bat /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /screenshots.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/screenshots.png -------------------------------------------------------------------------------- /app/src/main/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/ic_launcher-web.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/bold.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/h1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/h1.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/h2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/h2.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/h3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/h3.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/undo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/indent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/indent.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/italic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/italic.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/bullets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/bullets.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/numbers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/numbers.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/outdent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/outdent.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/underline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/underline.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-hdpi/ic_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-mdpi/ic_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xhdpi/ic_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/neuronizer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxxhdpi/neuronizer.png -------------------------------------------------------------------------------- /app/src/main/assets/fonts/Quicksand-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/assets/fonts/Quicksand-Regular.ttf -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xxhdpi/ic_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/widget_preview.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-hdpi/widget_preview.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/justify_center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/justify_center.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/justify_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/justify_left.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/justify_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxhdpi/justify_right.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_note_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-hdpi/ic_note_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_note_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-mdpi/ic_note_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_note_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xhdpi/ic_note_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_playlist_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-hdpi/ic_playlist_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_playlist_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-mdpi/ic_playlist_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_note_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xxhdpi/ic_note_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_create_folder_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-hdpi/ic_create_folder_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_create_folder_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-mdpi/ic_create_folder_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_create_folder_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xhdpi/ic_create_folder_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_playlist_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xhdpi/ic_playlist_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_playlist_add_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xxhdpi/ic_playlist_add_png.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_create_folder_png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djuelg/Neuronizer/master/app/src/main/res/drawable-xxhdpi/ic_create_folder_png.png -------------------------------------------------------------------------------- /app/src/debug/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | D-Neuronizer 3 | %s [%d] 4 | -------------------------------------------------------------------------------- /app/src/debug/res/values-de/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | D-Neuronizer 3 | %s [%d] 4 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/separator.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/comparator/PositionCompareable.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.comparator; 2 | 3 | /** 4 | * Created by Domi on 06.08.2017. 5 | */ 6 | 7 | public interface PositionCompareable { 8 | 9 | int getPosition(); 10 | } 11 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Mar 16 20:42:06 CET 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/assets/css/About.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: quicksand; 3 | src: url(../fonts/Quicksand-Regular.ttf); 4 | } 5 | 6 | body { 7 | color: #616161; 8 | } 9 | 10 | a { 11 | color: #00D1A2; 12 | } 13 | 14 | h1, h2, h3 { 15 | font-family: quicksand; 16 | font-weight: normal; 17 | color: #FF6200; 18 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_done_128dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/repository/Repository.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.repository; 2 | 3 | /** 4 | * Created by djuelg on 18.10.17. 5 | */ 6 | 7 | public interface Repository { 8 | PreviewRepository preview(); 9 | 10 | TodoListRepository todoList(); 11 | 12 | NoteRepository note(); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/exception/ParentNotFoundException.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.exception; 2 | 3 | /** 4 | * Created by Domi on 03.08.2017. 5 | */ 6 | 7 | public class ParentNotFoundException extends RuntimeException { 8 | public ParentNotFoundException(String message) { 9 | super(message); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_out_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_playlist_add_128dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/comparator/PreviewCompareable.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.comparator; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by Domi on 06.08.2017. 7 | */ 8 | 9 | public interface PreviewCompareable { 10 | 11 | long getImportance(); 12 | 13 | Date getChangedAt(); 14 | 15 | Date getCreatedAt(); 16 | 17 | String getTitle(); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_list_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_done_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sort_128dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_note_gray_22dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sort_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_redo_128dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_undo_128dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_drag_handle_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_reorder_128dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/AddNoteInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | 5 | /** 6 | * Created by djuelg on 09.07.17. 7 | * 8 | */ 9 | 10 | public interface AddNoteInteractor extends Interactor { 11 | interface Callback { 12 | void onNoteAdded(String uuid, String title); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/preview/ImportanceComparable.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.preview; 2 | 3 | /** 4 | * Created by djuelg on 18.10.17. 5 | */ 6 | 7 | public interface ImportanceComparable { 8 | 9 | long getAccessCounter(); 10 | 11 | ImportanceComparable increaseAccessCounter(); 12 | 13 | ImportanceComparable normalizeAccessCounter(); 14 | 15 | long calculateImportance(); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_delete_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_expand_more_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_note_add_128dp.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/assets/css/Details.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: quicksand; 3 | src: url(../fonts/Quicksand-Regular.ttf); 4 | } 5 | 6 | body { 7 | color: #616161; 8 | } 9 | 10 | a { 11 | color: #00D1A2; 12 | } 13 | 14 | h1, h2, h3 { 15 | font-family: quicksand; 16 | font-weight: normal; 17 | color: #00D1A2; 18 | } 19 | 20 | h4, h5, h6 { 21 | font-family: quicksand; 22 | font-weight: normal; 23 | color: #FF6200; 24 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_expand_less_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/AddTodoListInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | 5 | /** 6 | * Created by djuelg on 09.07.17. 7 | * 8 | */ 9 | 10 | public interface AddTodoListInteractor extends Interactor { 11 | interface Callback { 12 | void onTodoListAdded(String uuid, String title); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_playlist_add_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/AddItemInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | 5 | /** 6 | * Created by djuelg on 09.07.17. 7 | * 8 | */ 9 | 10 | public interface AddItemInteractor extends Interactor { 11 | interface Callback { 12 | void onItemAdded(); 13 | 14 | void onParentNotFound(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/AddHeaderInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | 5 | /** 6 | * Created by djuelg on 09.07.17. 7 | * 8 | */ 9 | 10 | public interface AddHeaderInteractor extends Interactor { 11 | interface Callback { 12 | void onHeaderAdded(); 13 | 14 | void onParentNotFound(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/DisplayItemInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | 4 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 5 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 6 | 7 | 8 | public interface DisplayItemInteractor extends Interactor { 9 | 10 | interface Callback { 11 | void onItemRetrieved(TodoListItem item); 12 | 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/test/java/de/djuelg/neuronizer/threading/TestMainThread.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.threading; 2 | 3 | import de.djuelg.neuronizer.domain.executor.MainThread; 4 | 5 | /** 6 | * Created by dmilicic on 1/8/16. 7 | */ 8 | public class TestMainThread implements MainThread { 9 | 10 | @Override 11 | public void post(Runnable runnable) { 12 | // tests can run on this thread, no need to invoke other threads 13 | runnable.run(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/note/EditNoteBodyInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.note; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.preview.Note; 5 | 6 | /** 7 | * Created by djuelg on 10.07.17. 8 | */ 9 | 10 | public interface EditNoteBodyInteractor extends Interactor { 11 | interface Callback { 12 | void onNoteUpdated(Note updatedNote); 13 | } 14 | } -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/BaseModel.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * Created by djuelg on 09.07.17. 7 | * 8 | * This interface contains all mandatory fields for any todolist item 9 | */ 10 | 11 | public interface BaseModel { 12 | String getUuid(); 13 | 14 | String getTitle(); 15 | 16 | Date getCreatedAt(); 17 | 18 | Date getChangedAt(); 19 | 20 | int getPosition(); 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/RenameNoteInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.preview.Note; 5 | 6 | /** 7 | * Created by djuelg on 10.07.17. 8 | */ 9 | 10 | public interface RenameNoteInteractor extends Interactor { 11 | interface Callback { 12 | void onNoteUpdated(Note updatedNote); 13 | } 14 | } -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/repository/PreviewRepository.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.repository; 2 | 3 | import de.djuelg.neuronizer.domain.model.preview.ItemsPerPreview; 4 | import de.djuelg.neuronizer.domain.model.preview.Preview; 5 | 6 | /** 7 | * A repository that is responsible for the landingpage with previews 8 | */ 9 | public interface PreviewRepository { 10 | Iterable getAll(ItemsPerPreview itemsPerPreview); 11 | 12 | int count(); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/base/Interactor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.base; 2 | 3 | 4 | /** 5 | * This is the main interface of an interactor. Each interactor serves a specific use case. 6 | */ 7 | public interface Interactor { 8 | 9 | /** 10 | * This is the main method that starts an interactor. It will make sure that the interactor operation is done on a 11 | * background thread. 12 | */ 13 | void execute(); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/DeleteNoteInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.preview.Note; 5 | 6 | /** 7 | * Created by djuelg on 11.07.17. 8 | */ 9 | 10 | public interface DeleteNoteInteractor extends Interactor { 11 | interface Callback { 12 | void onNoteDeleted(Note deletedNote); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_add_box_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/comparator/ImportanceComparator.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.comparator; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * Created by Domi on 06.08.2017. 7 | */ 8 | 9 | public class ImportanceComparator implements Comparator { 10 | 11 | @Override 12 | public int compare(PreviewCompareable first, PreviewCompareable scnd) { 13 | return Long.compare(scnd.getImportance(), first.getImportance()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/comparator/PositionComparator.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.comparator; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * Created by Domi on 06.08.2017. 7 | */ 8 | 9 | public class PositionComparator implements Comparator { 10 | 11 | @Override 12 | public int compare(PositionCompareable first, PositionCompareable scnd) { 13 | return Integer.compare(scnd.getPosition(), first.getPosition()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/DisplayPreviewInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview; 2 | 3 | 4 | import java.util.List; 5 | 6 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 7 | import de.djuelg.neuronizer.domain.model.preview.Preview; 8 | 9 | 10 | public interface DisplayPreviewInteractor extends Interactor { 11 | 12 | interface Callback { 13 | void onPreviewsRetrieved(List lists); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/note/DisplayNoteInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.note; 2 | 3 | 4 | import com.fernandocejas.arrow.optional.Optional; 5 | 6 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 7 | import de.djuelg.neuronizer.domain.model.preview.Note; 8 | 9 | 10 | public interface DisplayNoteInteractor extends Interactor { 11 | 12 | interface Callback { 13 | void onNoteRetrieved(Optional note); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/EditTodoListInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 5 | 6 | /** 7 | * Created by djuelg on 10.07.17. 8 | */ 9 | 10 | public interface EditTodoListInteractor extends Interactor { 11 | interface Callback { 12 | void onTodoListUpdated(TodoList updatedTodoList); 13 | } 14 | } -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/EditItemInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 5 | 6 | /** 7 | * Created by djuelg on 10.07.17. 8 | */ 9 | 10 | public interface EditItemInteractor extends Interactor { 11 | interface Callback { 12 | void onItemUpdated(TodoListItem updatedItem); 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/DeleteItemInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 5 | 6 | /** 7 | * Created by djuelg on 11.07.17. 8 | */ 9 | 10 | public interface DeleteItemInteractor extends Interactor { 11 | interface Callback { 12 | void onItemDeleted(TodoListItem deletedItem); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/comparator/AlphabeticComparator.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.comparator; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * Created by Domi on 06.08.2017. 7 | */ 8 | 9 | public class AlphabeticComparator implements Comparator { 10 | 11 | @Override 12 | public int compare(PreviewCompareable first, PreviewCompareable scnd) { 13 | return first.getTitle().toLowerCase().compareTo(scnd.getTitle().toLowerCase()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/DeleteTodoListInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 5 | 6 | /** 7 | * Created by djuelg on 11.07.17. 8 | */ 9 | 10 | public interface DeleteTodoListInteractor extends Interactor { 11 | interface Callback { 12 | void onTodoListDeleted(TodoList deletedTodoList); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/EditHeaderInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 5 | 6 | /** 7 | * Created by djuelg on 10.07.17. 8 | */ 9 | 10 | public interface EditHeaderInteractor extends Interactor { 11 | interface Callback { 12 | void onHeaderUpdated(TodoListHeader updatedHeader); 13 | 14 | } 15 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_edit_128dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_note_add_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/comparator/CreationDateComparator.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.comparator; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * Created by Domi on 06.08.2017. 7 | */ 8 | 9 | public class CreationDateComparator implements Comparator { 10 | 11 | @Override 12 | public int compare(PreviewCompareable first, PreviewCompareable scnd) { 13 | return Long.compare(scnd.getCreatedAt().getTime(), first.getCreatedAt().getTime()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/comparator/LastChangeComparator.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.comparator; 2 | 3 | import java.util.Comparator; 4 | 5 | /** 6 | * Created by Domi on 06.08.2017. 7 | */ 8 | 9 | public class LastChangeComparator implements Comparator { 10 | 11 | @Override 12 | public int compare(PreviewCompareable first, PreviewCompareable scnd) { 13 | return Long.compare(scnd.getChangedAt().getTime(), first.getChangedAt().getTime()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/DeleteHeaderInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 4 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 5 | 6 | /** 7 | * Created by djuelg on 11.07.17. 8 | */ 9 | 10 | public interface DeleteHeaderInteractor extends Interactor { 11 | interface Callback { 12 | void onHeaderDeleted(TodoListHeader deletedHeader); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/MarkdownConverter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom; 2 | 3 | import com.overzealous.remark.Options; 4 | import com.overzealous.remark.Remark; 5 | 6 | /** 7 | * Created by djuelg on 20.02.18. 8 | */ 9 | 10 | public class MarkdownConverter { 11 | 12 | public static String convertToMarkdown(String html) { 13 | Remark remark = new Remark(Options.github()); 14 | return remark.convert((html != null) ? html : ""); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_create_new_folder_128dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_edit_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_switch_image_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/DisplayHeadersInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | 4 | import java.util.List; 5 | 6 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 7 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 8 | 9 | 10 | public interface DisplayHeadersInteractor extends Interactor { 11 | 12 | interface Callback { 13 | void onHeadersRetrieved(List headers); 14 | 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_content_copy_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_create_new_folder_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/widget/WidgetService.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.widget; 2 | 3 | import android.content.Intent; 4 | import android.widget.RemoteViewsService; 5 | 6 | /** 7 | * Created by djuelg on 04.11.2016. 8 | */ 9 | 10 | public class WidgetService extends RemoteViewsService { 11 | 12 | @Override 13 | public RemoteViewsFactory onGetViewFactory(Intent intent) { 14 | return (new WidgetListFactory(this.getApplicationContext(), intent)); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_content_copy_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/HeaderPresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters; 2 | 3 | import de.djuelg.neuronizer.presentation.presenters.base.BasePresenter; 4 | 5 | 6 | public interface HeaderPresenter extends BasePresenter { 7 | 8 | void addHeader(String title, String parentTodoListUuid); 9 | 10 | void editHeader(String uuid, String title, int position, boolean expanded); 11 | 12 | interface View { 13 | void onHeaderAdded(); 14 | 15 | void onHeaderEdited(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/NotePresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters; 2 | 3 | import de.djuelg.neuronizer.presentation.presenters.base.BasePresenter; 4 | 5 | 6 | public interface NotePresenter extends BasePresenter { 7 | 8 | void addNote(String title); 9 | 10 | void editNote(String uuid, String title, int position); 11 | 12 | interface View { 13 | 14 | void onNoteAdded(String uuid, String title); 15 | 16 | void onNoteEdited(String uuid, String title); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/DisplayTodoListInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist; 2 | 3 | 4 | import java.util.List; 5 | 6 | import de.djuelg.neuronizer.domain.interactors.base.Interactor; 7 | import de.djuelg.neuronizer.domain.model.todolist.TodoListSection; 8 | 9 | 10 | public interface DisplayTodoListInteractor extends Interactor { 11 | 12 | interface Callback { 13 | void onTodoListRetrieved(List sections); 14 | 15 | void onInvalidTodoListUuid(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_rich_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_activate_image_button.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/spinner_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/preview/Preview.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.preview; 2 | 3 | import de.djuelg.neuronizer.domain.comparator.PositionCompareable; 4 | import de.djuelg.neuronizer.domain.model.BaseModel; 5 | 6 | /** 7 | * Created by djuelg on 15.10.17. 8 | */ 9 | 10 | public interface Preview extends PositionCompareable { 11 | 12 | BaseModel getBaseItem(); 13 | 14 | String getSubtitle(); 15 | 16 | String getDetails(); 17 | 18 | long calculateImportance(); 19 | 20 | @Override 21 | int getPosition(); 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/TodoListPresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters; 2 | 3 | import de.djuelg.neuronizer.presentation.presenters.base.BasePresenter; 4 | 5 | 6 | public interface TodoListPresenter extends BasePresenter { 7 | 8 | void addTodoList(String title); 9 | 10 | void editTodoList(String uuid, String title, int position); 11 | 12 | interface View { 13 | 14 | void onTodoListAdded(String uuid, String title); 15 | 16 | void onTodoListEdited(String uuid, String title); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/HtmlStripper.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom; 2 | 3 | import android.text.Html; 4 | 5 | /** 6 | * Created by Domi on 19.08.2017. 7 | */ 8 | 9 | public class HtmlStripper { 10 | 11 | public static String stripHtml(String html) { 12 | if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { 13 | return Html.fromHtml(html, Html.FROM_HTML_MODE_LEGACY).toString(); 14 | } else { 15 | return Html.fromHtml(html).toString(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/res/xml/widget_provider_todo.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/DisplayNotePresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.model.preview.Note; 6 | import de.djuelg.neuronizer.presentation.presenters.base.BasePresenter; 7 | 8 | 9 | public interface DisplayNotePresenter extends BasePresenter { 10 | 11 | void loadNote(String uuid); 12 | 13 | void editNote(String uuid, String body); 14 | 15 | interface View { 16 | 17 | void onNoteLoaded(Optional note); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /QA/quality.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'findbugs' 2 | 3 | task findbugs(type: FindBugs) { 4 | ignoreFailures = true 5 | effort = "default" 6 | reportLevel = "medium" 7 | excludeFilter = new File("${project.rootDir}/QA/findbugs/findbugs-filter.xml") 8 | classes = files("${project.rootDir}/app/build/intermediates/classes") 9 | source = fileTree('src/main/java/') 10 | classpath = files() 11 | reports { 12 | xml.enabled = false 13 | html.enabled = true 14 | html { 15 | destination "${project.buildDir}/reports/findbugs/findbugs-output.html" 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/repository/NoteRepository.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.repository; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import java.util.List; 6 | 7 | import de.djuelg.neuronizer.domain.model.preview.Note; 8 | 9 | /** 10 | * A repository that is responsible for the single note pages 11 | */ 12 | public interface NoteRepository { 13 | 14 | List getAll(); 15 | 16 | Optional get(String uuid); 17 | 18 | boolean insert(Note note); 19 | 20 | void update(Note updatedNote); 21 | 22 | void delete(Note deletedNote); 23 | } 24 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/executor/MainThread.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.executor; 2 | 3 | /** 4 | * This interface will define a class that will enable interactors to run certain operations on the main (UI) thread. For example, 5 | * if an interactor needs to show an object to the UI this can be used to make sure the show method is called on the UI 6 | * thread. 7 | *

8 | */ 9 | public interface MainThread { 10 | 11 | /** 12 | * Make runnable operation run in the main thread. 13 | * 14 | * @param runnable The runnable to run. 15 | */ 16 | void post(final Runnable runnable); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/converter/NoteDAOConverter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.converter; 2 | 3 | 4 | import com.fernandocejas.arrow.functions.Function; 5 | 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import de.djuelg.neuronizer.domain.model.preview.Note; 9 | import de.djuelg.neuronizer.storage.model.NoteDAO; 10 | 11 | /** 12 | * Created by djuelg on 04.08.17. 13 | */ 14 | 15 | public class NoteDAOConverter implements Function { 16 | 17 | @Nullable 18 | @Override 19 | public Note apply(NoteDAO input) { 20 | return RealmConverter.convert(input); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_input.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_todo_list.xml: -------------------------------------------------------------------------------- 1 |

5 | 6 | 11 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/converter/TodoListDAOConverter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.converter; 2 | 3 | 4 | import com.fernandocejas.arrow.functions.Function; 5 | 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 9 | import de.djuelg.neuronizer.storage.model.TodoListDAO; 10 | 11 | /** 12 | * Created by djuelg on 04.08.17. 13 | */ 14 | 15 | public class TodoListDAOConverter implements Function { 16 | 17 | @Nullable 18 | @Override 19 | public TodoList apply(TodoListDAO input) { 20 | return RealmConverter.convert(input); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_imprint.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/executor/Executor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.executor; 2 | 3 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 4 | 5 | /** 6 | * This executor is responsible for running interactors on background threads. 7 | *

8 | */ 9 | public interface Executor { 10 | 11 | /** 12 | * This method should call the interactor's run method and thus start the interactor. This should be called 13 | * on a background thread as interactors might do lengthy operations. 14 | * 15 | * @param interactor The interactor to run. 16 | */ 17 | void execute(final AbstractInteractor interactor); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_lightbulb_128dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_lightbulb_outline_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /QA/findbugs/findbugs-filter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/converter/TodoListItemDAOConverter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.converter; 2 | 3 | 4 | import com.fernandocejas.arrow.functions.Function; 5 | 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 9 | import de.djuelg.neuronizer.storage.model.TodoListItemDAO; 10 | 11 | /** 12 | * Created by djuelg on 04.08.17. 13 | */ 14 | 15 | public class TodoListItemDAOConverter implements Function { 16 | 17 | @Nullable 18 | @Override 19 | public TodoListItem apply(TodoListItemDAO input) { 20 | return RealmConverter.convert(input); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_lightbulb_outline_light_gray_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_lightbulb_outline_primary_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_preview.xml: -------------------------------------------------------------------------------- 1 |

5 | 6 | 12 | 13 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/converter/TodoListHeaderDAOConverter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.converter; 2 | 3 | 4 | import com.fernandocejas.arrow.functions.Function; 5 | 6 | import org.jetbrains.annotations.Nullable; 7 | 8 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 9 | import de.djuelg.neuronizer.storage.model.TodoListHeaderDAO; 10 | 11 | /** 12 | * Created by djuelg on 04.08.17. 13 | */ 14 | 15 | public class TodoListHeaderDAOConverter implements Function { 16 | 17 | @Nullable 18 | @Override 19 | public TodoListHeader apply(TodoListHeaderDAO input) { 20 | return RealmConverter.convert(input); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/AndroidApplication.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer; 2 | 3 | import android.app.Application; 4 | 5 | import io.realm.Realm; 6 | import io.realm.RealmConfiguration; 7 | 8 | import static de.djuelg.neuronizer.storage.RepositoryManager.createConfiguration; 9 | import static io.realm.Realm.DEFAULT_REALM_NAME; 10 | 11 | public class AndroidApplication extends Application { 12 | 13 | 14 | @Override 15 | public void onCreate() { 16 | super.onCreate(); 17 | 18 | // initiate Realm 19 | Realm.init(this); 20 | RealmConfiguration realmConfiguration = createConfiguration(DEFAULT_REALM_NAME); 21 | Realm.setDefaultConfiguration(realmConfiguration); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_action_header.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_share_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/base/AbstractPresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters.base; 2 | 3 | 4 | import de.djuelg.neuronizer.domain.executor.Executor; 5 | import de.djuelg.neuronizer.domain.executor.MainThread; 6 | 7 | /** 8 | * This is a base class for all presenters which are communicating with interactors. This base class will hold a 9 | * reference to the Executor and MainThread objects that are needed for running interactors in a background thread. 10 | */ 11 | public abstract class AbstractPresenter { 12 | protected Executor mExecutor; 13 | protected MainThread mMainThread; 14 | 15 | public AbstractPresenter(Executor executor, MainThread mainThread) { 16 | mExecutor = executor; 17 | mMainThread = mainThread; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/widget_header_inner_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/DisplayTodoListPresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters; 2 | 3 | import java.util.List; 4 | 5 | import de.djuelg.neuronizer.presentation.presenters.base.BasePresenter; 6 | import eu.davidea.flexibleadapter.FlexibleAdapter; 7 | import eu.davidea.flexibleadapter.items.AbstractFlexibleItem; 8 | 9 | 10 | public interface DisplayTodoListPresenter extends BasePresenter { 11 | 12 | void loadTodoList(String uuid); 13 | 14 | void syncTodoList(FlexibleAdapter adapter); 15 | 16 | void deleteHeader(String uuid); 17 | 18 | void deleteItem(String uuid); 19 | 20 | interface View { 21 | void onTodoListLoaded(List items); 22 | 23 | void onInvalidTodoListUuid(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/DisplayPreviewPresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters; 2 | 3 | import java.util.List; 4 | 5 | import de.djuelg.neuronizer.domain.model.preview.Sortation; 6 | import de.djuelg.neuronizer.presentation.presenters.base.BasePresenter; 7 | import de.djuelg.neuronizer.presentation.ui.flexibleadapter.PreviewViewModel; 8 | 9 | public interface DisplayPreviewPresenter extends BasePresenter { 10 | 11 | void syncPreviews(List previews); 12 | 13 | void deleteTodoList(String uuid); 14 | 15 | void deleteNote(String uuid); 16 | 17 | List applySortation(List previews, Sortation sortation); 18 | 19 | interface View { 20 | void onPreviewsLoaded(List previews); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/dmilicic/Documents/android-sdk-macosx/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Display icons in menu 20 | -keepclassmembers class **.MenuBuilder { void setOptionalIconsVisible(boolean); } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/markdown-navigator.xml 6 | /.idea/codeStyleSettings.xml 7 | /.idea/libraries 8 | /.idea/caches 9 | 10 | /app/src/main/java/de/djuelg/neuronizer/storage/SillySavedRepositoryPassword.java 11 | /app/release 12 | 13 | .DS_Store 14 | /build 15 | /captures 16 | ======= 17 | # Built application files 18 | *.apk 19 | *.ap_ 20 | 21 | # Files for the Dalvik VM 22 | *.dex 23 | 24 | # Java class files 25 | *.class 26 | 27 | # Generated files 28 | bin/ 29 | gen/ 30 | 31 | # Gradle files 32 | .gradle/ 33 | build/ 34 | 35 | # Local configuration file (sdk path, etc) 36 | local.properties 37 | 38 | # Proguard folder generated by Eclipse 39 | proguard/ 40 | 41 | # Log Files 42 | *.log 43 | 44 | # Android Studio Navigation editor temp files 45 | .navigation/ 46 | 47 | # Android Studio captures folder 48 | captures/ 49 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 56dp 7 | 4dp 8 | 8dp 9 | 112dp 10 | 28dp 11 | 20dp 12 | 64dp 13 | 32dp 14 | 2px 15 | 42dp 16 | 34dp 17 | 32dp 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_note.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 12 | 13 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/threading/MainThreadImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.threading; 2 | 3 | import android.os.Handler; 4 | import android.os.Looper; 5 | 6 | import com.fernandocejas.arrow.optional.Optional; 7 | 8 | import de.djuelg.neuronizer.domain.executor.MainThread; 9 | 10 | 11 | /** 12 | * This class makes sure that the runnable we provide will be run on the main UI thread. 13 | */ 14 | public class MainThreadImpl implements MainThread { 15 | 16 | private static MainThread sMainThread; 17 | 18 | private Handler mHandler; 19 | 20 | private MainThreadImpl() { 21 | mHandler = new Handler(Looper.getMainLooper()); 22 | } 23 | 24 | @Override 25 | public void post(Runnable runnable) { 26 | mHandler.post(runnable); 27 | } 28 | 29 | public static MainThread getInstance() { 30 | return Optional.fromNullable(sMainThread).or(new MainThreadImpl()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #00d1a2 4 | #008164 5 | #ff6200 6 | #ff6200 7 | #00d1a4 8 | #000000 9 | #008164 10 | #008164 11 | #616161 12 | #828282 13 | #30dddddd 14 | #bdbdbd 15 | #f5f5f5 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/done_add_white_24dp.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 10 | 13 | 16 | 18 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters.base; 2 | 3 | public interface BasePresenter { 4 | /** 5 | * Method that control the lifecycle of the view. It should be called in the view's 6 | * (Activity or Fragment) onResume() method. 7 | */ 8 | void resume(); 9 | 10 | /** 11 | * Method that controls the lifecycle of the view. It should be called in the view's 12 | * (Activity or Fragment) onPause() method. 13 | */ 14 | void pause(); 15 | 16 | /** 17 | * Method that controls the lifecycle of the view. It should be called in the view's 18 | * (Activity or Fragment) onStop() method. 19 | */ 20 | void stop(); 21 | 22 | /** 23 | * Method that control the lifecycle of the view. It should be called in the view's 24 | * (Activity or Fragment) onDestroy() method. 25 | */ 26 | void destroy(); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/FragmentInteractionListener.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom; 2 | 3 | /** 4 | * This interface must be implemented by activities that contain a 5 | * fragment to allow an interaction in the fragment to be communicated 6 | * to the activity and potentially other fragments contained in that 7 | * activity. 8 | */ 9 | public interface FragmentInteractionListener { 10 | 11 | // called from PreviewFragment 12 | void onTodoListSelected(String uuid, String title); 13 | 14 | void onNoteSelected(String uuid, String title); 15 | 16 | // called from TodoListFragment 17 | 18 | void onAddItem(String todoListUuid); 19 | 20 | void onAddAnotherItem(String todoListUuid); 21 | 22 | void onEditItem(String todoListUuid, String itemUuid); 23 | 24 | void onSettingsSelected(); 25 | 26 | void onImprintSelected(); 27 | 28 | void onAboutSelected(); 29 | 30 | void onUpdateAllWidgets(int delayMillis); 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/preview/Sortation.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.preview; 2 | 3 | /** 4 | * Created by Domi on 22.08.2017. 5 | */ 6 | 7 | public enum Sortation { 8 | IMPORTANCE(0), 9 | LAST_CHANGE(1), 10 | CREATION_DATE(2), 11 | ALPHABETICAL(3); 12 | 13 | private final int position; 14 | 15 | Sortation(int position) { 16 | this.position = position; 17 | } 18 | 19 | public static Sortation parse(int position) { 20 | switch (position) { 21 | case 0: 22 | return IMPORTANCE; 23 | case 1: 24 | return LAST_CHANGE; 25 | case 2: 26 | return CREATION_DATE; 27 | case 3: 28 | return ALPHABETICAL; 29 | default: 30 | break; 31 | } 32 | throw new IllegalArgumentException(position + " is out of bounds."); 33 | } 34 | 35 | public int toInt() { 36 | return position; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/Clipboard.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom; 2 | 3 | import android.content.ClipData; 4 | import android.content.ClipDescription; 5 | import android.content.ClipboardManager; 6 | import android.content.Context; 7 | import android.widget.Toast; 8 | 9 | import de.djuelg.neuronizer.R; 10 | 11 | /** 12 | * Created by djuelg on 18.10.17. 13 | */ 14 | 15 | public class Clipboard { 16 | 17 | public static void copyToClipboard(Context context, String content) { 18 | if (content.isEmpty()){ 19 | Toast.makeText(context, R.string.no_clipboard, Toast.LENGTH_SHORT).show(); 20 | return; 21 | } 22 | ClipboardManager clipboard = (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE); 23 | ClipData clip = ClipData.newPlainText(ClipDescription.MIMETYPE_TEXT_PLAIN, content); 24 | clipboard.setPrimaryClip(clip); 25 | Toast.makeText(context, R.string.added_clipboard, Toast.LENGTH_SHORT).show(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/widget_header_outer_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/migration/RealmMigrator.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.migration; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.support.annotation.NonNull; 5 | 6 | import io.realm.DynamicRealm; 7 | import io.realm.RealmMigration; 8 | import io.realm.exceptions.RealmMigrationNeededException; 9 | 10 | /** 11 | * Created by djuelg on 20.10.2016. 12 | */ 13 | 14 | public class RealmMigrator implements RealmMigration { 15 | 16 | @SuppressLint("DefaultLocale") 17 | @Override 18 | public void migrate(@NonNull DynamicRealm realm, long oldVersion, long newVersion) { 19 | if (oldVersion < newVersion) { 20 | // Unknown migration 21 | throw new RealmMigrationNeededException(realm.getPath(), String.format("Migration missing from v%d to v%d", oldVersion, newVersion)); 22 | } 23 | } 24 | 25 | @Override 26 | public int hashCode() { 27 | return RealmMigrator.class.hashCode(); 28 | } 29 | 30 | @Override 31 | public boolean equals(Object obj) { 32 | return obj instanceof RealmMigrator; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/widget_todo_list_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_settings_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 15 | 16 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/presenters/ItemPresenter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.presenters; 2 | 3 | import java.util.List; 4 | 5 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 6 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 7 | import de.djuelg.neuronizer.presentation.presenters.base.BasePresenter; 8 | 9 | 10 | public interface ItemPresenter extends BasePresenter { 11 | 12 | void addItem(String title, boolean important, String Details, String parentTodoListUuid, String parentHeaderUuid); 13 | 14 | void addItemAndAnother(String title, boolean important, String details, String parentTodoListUuid, String parentHeaderUuid); 15 | 16 | void editItem(String uuid, String title, int position, boolean important, String details, boolean done, String parentTodoListUuid, String parentHeaderUuid); 17 | 18 | void addMode(String todoListUuid); 19 | 20 | void editMode(String itemUuid); 21 | 22 | void expandHeaderOfItem(String uuid, String title, int position); 23 | 24 | interface View { 25 | 26 | void itemSynced(boolean addAnother); 27 | 28 | void onHeadersLoaded(List headers); 29 | 30 | void onItemLoaded(TodoListItem item); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/preview/ItemsPerPreview.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.preview; 2 | 3 | 4 | import java.util.Objects; 5 | 6 | /** 7 | * Created by djuelg on 12.07.17. 8 | * 9 | * Class to avoid messing with item count in preview 10 | */ 11 | 12 | public class ItemsPerPreview { 13 | 14 | private final int count; 15 | 16 | public ItemsPerPreview(int count) { 17 | if(count < 0 ) throw new IllegalArgumentException("Count must be equal or greater than 0!"); 18 | this.count = count; 19 | } 20 | 21 | public int getCount() { 22 | return count; 23 | } 24 | 25 | public boolean areZero() { 26 | return (count == 0); 27 | } 28 | 29 | @Override 30 | public boolean equals(Object o) { 31 | if (this == o) return true; 32 | if (o == null || getClass() != o.getClass()) return false; 33 | final ItemsPerPreview that = (ItemsPerPreview) o; 34 | return count == that.count; 35 | } 36 | 37 | @Override 38 | public int hashCode() { 39 | return Objects.hash(count); 40 | } 41 | 42 | @Override 43 | public String toString() { 44 | return "ItemsPerPreview{" + 45 | "count=" + count + 46 | '}'; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/res/values-de/string_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Intention 5 |

6 | Neuronizer ist die Swap Partition für dein Gehirn. Das bedeutet es hilft dir dabei all 7 | die Informationen zu speichern, die du ansonsten vergessen würdest. Es bietet die 8 | Möglichkeit deine Gedanken zu kategorisieren, damit du die Informationen so schnell wie 9 | möglich wiedererkennst. 10 |

11 |

Privatsphäre

12 |

13 | Deine Daten gehören dir. Alles was in Neuronizer gespeichert wird ist verschlüsselt und nur von deinem Gerät 14 | aus zugreifbar. Die Entwickler sind nicht verantwortlich für den Verlust von Daten. Wenn du 15 | deine Daten auf ein anderes Gerät migrieren möchtest, nutze die Importieren/Exportieren 16 | Funktion aus den Einstellungen. 17 |

18 |

Danksagung

19 |

20 | Ein Dank geht an alle Todolist of Death Nutzer, die mir mit ihrem Feedback geholfen haben. 21 | Außerdem möchte ich allen danken, in der Betaphase mitgearbeitet haben, um Neuronizer zu 22 | verbessern. 23 |

24 | ]]> 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/view/Animations.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom.view; 2 | 3 | import android.view.animation.AlphaAnimation; 4 | import android.view.animation.Animation; 5 | import android.view.animation.TranslateAnimation; 6 | 7 | /** 8 | * Created by Domi on 10.08.2017. 9 | */ 10 | 11 | public class Animations { 12 | 13 | public static Animation fadeIn() { 14 | AlphaAnimation animation = new AlphaAnimation(0, 1); 15 | animation.setDuration(300); 16 | animation.setStartOffset(50); 17 | return animation; 18 | } 19 | 20 | public static Animation fadeOut() { 21 | AlphaAnimation animation = new AlphaAnimation(1, 0); 22 | animation.setDuration(300); 23 | animation.setStartOffset(50); 24 | return animation; 25 | } 26 | 27 | public static Animation slideIn() { 28 | TranslateAnimation animation = new TranslateAnimation(500, 0, 0, 0); 29 | animation.setDuration(400); 30 | animation.setStartOffset(50); 31 | return animation; 32 | } 33 | 34 | public static Animation slideOut() { 35 | TranslateAnimation animation = new TranslateAnimation(0, 500, 0, 0); 36 | animation.setDuration(400); 37 | animation.setStartOffset(50); 38 | return animation; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/res/values/string_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Intention 5 |

6 | Neuronizer is the swap partition for your brain. This means it is here to store all the 7 | information you would forget otherwise. It offers the opportunity to order your thoughts 8 | in categories to recognize the information you need as fast as possible. Whenever you 9 | need more flexibility you can order your content just the way you like. 10 |

11 |

Data Privacy

12 |

13 | Your data is yours. Everything you save to Neuronizer is encrypted and stored locally on your device only! 14 | The developers are not responsible for any kind of data loss. If you want to migrate your 15 | data to a new phone, use Import/Export from the settings. 16 |

17 |

Special Thanks

18 |

19 | Special thanks goes to all the Todolist Of Death users, who gave me a lot of feedback. It 20 | helped me create this improved version of the app. Furthermore I would like to thank all 21 | the people who participated in the beta phase to test and improve Neuronizer. 22 |

23 | ]]> 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/dialog/FileDialogs.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.dialog; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.DialogFragment; 5 | import android.support.v4.app.FragmentActivity; 6 | 7 | import com.rustamg.filedialogs.FileDialog; 8 | import com.rustamg.filedialogs.OpenFileDialog; 9 | import com.rustamg.filedialogs.SaveFileDialog; 10 | 11 | import de.djuelg.neuronizer.R; 12 | 13 | import static de.djuelg.neuronizer.storage.RepositoryManager.REPOSITORY_EXTENSION; 14 | 15 | /** 16 | * Created by Domi on 07.09.2017. 17 | */ 18 | 19 | public class FileDialogs { 20 | 21 | public static void showOpenFileDialog(FragmentActivity activity) { 22 | showFileDialog(activity, new OpenFileDialog()); 23 | } 24 | 25 | public static void showSaveFileDialog(FragmentActivity activity) { 26 | showFileDialog(activity, new SaveFileDialog()); 27 | } 28 | 29 | private static void showFileDialog(FragmentActivity activity, FileDialog dialog) { 30 | Bundle args = new Bundle(); 31 | args.putString(FileDialog.EXTENSION, REPOSITORY_EXTENSION); 32 | dialog.setArguments(args); 33 | dialog.setStyle(DialogFragment.STYLE_NO_TITLE, R.style.AppTheme); 34 | dialog.show(activity.getSupportFragmentManager(), OpenFileDialog.class.getName()); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | -------------------------------------------------------------------------------- /app/src/test/java/de/djuelg/neuronizer/storage/PreviewRepositoryMock.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashSet; 5 | import java.util.Set; 6 | 7 | import de.djuelg.neuronizer.domain.model.preview.ItemsPerPreview; 8 | import de.djuelg.neuronizer.domain.model.preview.Note; 9 | import de.djuelg.neuronizer.domain.model.preview.Preview; 10 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 11 | import de.djuelg.neuronizer.domain.repository.PreviewRepository; 12 | 13 | /** 14 | * Created by djuelg on 10.07.17. 15 | */ 16 | 17 | public class PreviewRepositoryMock implements PreviewRepository { 18 | 19 | public int insertCount; 20 | public int updateCount; 21 | public int deleteCount; 22 | public Set uuids; 23 | private TodoList alwaysSameTodoList; 24 | private Note alwaysSameNote; 25 | 26 | public PreviewRepositoryMock() { 27 | insertCount = 0; 28 | updateCount = 0; 29 | deleteCount = 0; 30 | uuids = new HashSet<>(); 31 | alwaysSameTodoList = new TodoList("In-Database", 0); 32 | alwaysSameNote = new Note("Note", 0); 33 | } 34 | 35 | @Override 36 | public Iterable getAll(ItemsPerPreview itemsPerPreview) { 37 | return new ArrayList<>(0); 38 | } 39 | 40 | @Override 41 | // TODO Test 42 | public int count() { 43 | return 42; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/todolist/TodoListSection.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.todolist; 2 | 3 | import java.util.Objects; 4 | 5 | import de.djuelg.neuronizer.domain.comparator.PositionCompareable; 6 | 7 | /** 8 | * Created by Domi on 23.07.2017. 9 | * 10 | * A TodoListSection contains a Header and it's subitems 11 | */ 12 | 13 | public class TodoListSection implements PositionCompareable { 14 | 15 | private final TodoListHeader header; 16 | private final Iterable items; 17 | 18 | public TodoListSection(TodoListHeader header, Iterable items) { 19 | this.header = header; 20 | this.items = items; 21 | } 22 | 23 | public TodoListHeader getHeader() { 24 | return header; 25 | } 26 | 27 | public Iterable getItems() { 28 | return items; 29 | } 30 | 31 | @Override 32 | public int getPosition() { 33 | return header.getPosition(); 34 | } 35 | 36 | @Override 37 | public boolean equals(Object o) { 38 | if (this == o) return true; 39 | if (!(o instanceof TodoListSection)) return false; 40 | TodoListSection that = (TodoListSection) o; 41 | return Objects.equals(header, that.header) && 42 | Objects.equals(items, that.items); 43 | } 44 | 45 | @Override 46 | public int hashCode() { 47 | return Objects.hash(header, items); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/res/values-de/string_imprint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Impressum und Datenschutz 5 |

Angaben gemäß § 5 TMG:

6 |

7 | Dominik Jülg
8 | Albtalstraße 3
9 | 76137 Karlsruhe 10 |

11 |

Kontakt:

12 |

13 | Telefon: 07841/21590
14 | E-Mail: juelg.dominik@gmail.com 15 |

16 |

17 | Wir sind nicht bereit oder verpflichtet, an Streitbeilegungsverfahren vor einer 18 | Verbraucherschlichtungsstelle teilzunehmen. 19 |

20 | 21 |

Widerspruch Werbe-Mails

22 |

23 | Der Nutzung von im Rahmen der Impressumspflicht veröffentlichten Kontaktdaten zur 24 | Übersendung von nicht ausdrücklich angeforderter Werbung und Informationsmaterialien 25 | wird hiermit widersprochen. Die Betreiber der Seiten behalten sich ausdrücklich 26 | rechtliche Schritte im Falle der unverlangten Zusendung von Werbeinformationen, 27 | etwa durch Spam-E-Mails, vor.

  28 |

29 | 30 |

31 | Quelle: eRecht24 32 |

33 | ]]> 34 |
35 |
-------------------------------------------------------------------------------- /app/src/main/res/values/string_imprint.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Imprint (under German law) 5 |

Disclosures in accordance to § 5 TMG:

6 |

7 | Dominik Jülg
8 | Albtalstraße 3
9 | 76137 Karlsruhe 10 |

11 |

Contact:

12 |

13 | Phone: 07841/21590
14 | E-Mail: juelg.dominik@gmail.com 15 |

16 |

17 | We are not willing or obliged to engage in dispute settlement proceedings of a 18 | Consumer Complaint Office. 19 |

20 | 21 |

Contradiction advertising mails

22 |

23 | The use of contact data published within the scope of the imprint obligation to contact the 24 | sending of unsolicited advertisements and information material 25 | is hereby contradicted. The operators of the pages expressly reserve the right to 26 | legal action in the event of unsolicited mailing of promotional information, 27 | e. g. by spam e-mails. 28 |

29 | 30 |

31 | Source (translated): eRecht24
32 | In case of doubt German version applies. 33 |

34 | ]]> 35 |
36 |
-------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/RepositoryImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage; 2 | 3 | import de.djuelg.neuronizer.domain.repository.NoteRepository; 4 | import de.djuelg.neuronizer.domain.repository.PreviewRepository; 5 | import de.djuelg.neuronizer.domain.repository.Repository; 6 | import de.djuelg.neuronizer.domain.repository.TodoListRepository; 7 | import io.realm.RealmConfiguration; 8 | 9 | import static de.djuelg.neuronizer.storage.RepositoryManager.createConfiguration; 10 | 11 | /** 12 | * Created by djuelg on 18.10.17. 13 | */ 14 | 15 | public class RepositoryImpl implements Repository { 16 | 17 | private final PreviewRepository previewRepository; 18 | private final TodoListRepository todoListRepository; 19 | private final NoteRepository noteRepository; 20 | 21 | public RepositoryImpl(String realmName) { 22 | this(createConfiguration(realmName)); 23 | } 24 | 25 | // RealmConfiguration injectable for testing 26 | RepositoryImpl(RealmConfiguration configuration) { 27 | this.previewRepository = new PreviewRepositoryImpl(configuration); 28 | this.todoListRepository = new TodoListRepositoryImpl(configuration); 29 | this.noteRepository = new NoteRepositoryImpl(configuration); 30 | } 31 | 32 | 33 | @Override 34 | public PreviewRepository preview() { 35 | return previewRepository; 36 | } 37 | 38 | @Override 39 | public TodoListRepository todoList() { 40 | return todoListRepository; 41 | } 42 | 43 | @Override 44 | public NoteRepository note() { 45 | return noteRepository; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/repository/TodoListRepository.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.repository; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import java.util.List; 6 | 7 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 8 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 9 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 10 | import de.djuelg.neuronizer.domain.model.todolist.TodoListSection; 11 | 12 | /** 13 | * A repository that is responsible for the page of a single todolist 14 | */ 15 | public interface TodoListRepository { 16 | 17 | List getAll(); 18 | 19 | Optional getTodoListById(String uuid); 20 | 21 | Optional getHeaderById(String uuid); 22 | 23 | Optional getItemById(String uuid); 24 | 25 | Iterable getSectionsOfTodoListId(String uuid); 26 | 27 | Iterable getHeadersOfTodoListId(String uuid); 28 | 29 | int getHeaderCountOfTodoList(String uuid); 30 | 31 | int getSubItemCountOfHeader(String uuid); 32 | 33 | boolean insert(TodoList todoList); 34 | 35 | boolean insert(TodoListHeader header); 36 | 37 | boolean insert(TodoListItem item); 38 | 39 | void delete(TodoList deletedTodoList); 40 | 41 | /** 42 | * Sub items have to be deleted, too 43 | */ 44 | void delete(TodoListHeader deletedHeader); 45 | 46 | void delete(TodoListItem deletedItem); 47 | 48 | void update(TodoList updatedTodoList); 49 | 50 | void update(TodoListHeader updatedHeader); 51 | 52 | void update(TodoListItem updatedItem); 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/impl/DeleteNoteInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.preview.DeleteNoteInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.Note; 10 | import de.djuelg.neuronizer.domain.repository.Repository; 11 | 12 | /** 13 | * Created by djuelg on 11.07.17. 14 | */ 15 | 16 | public class DeleteNoteInteractorImpl extends AbstractInteractor implements DeleteNoteInteractor { 17 | 18 | private final Callback callback; 19 | private final Repository repository; 20 | private final String uuid; 21 | 22 | public DeleteNoteInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid) { 23 | super(threadExecutor, mainThread); 24 | this.callback = callback; 25 | this.repository = repository; 26 | this.uuid = uuid; 27 | } 28 | 29 | @Override 30 | public void run() { 31 | final Optional deletedItem = repository.note().get(uuid); 32 | if (deletedItem.isPresent()) { 33 | repository.note().delete(deletedItem.get()); 34 | 35 | mMainThread.post(new Runnable() { 36 | @Override 37 | public void run() { 38 | callback.onNoteDeleted(deletedItem.get()); 39 | } 40 | }); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/fab_label_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/widget_todo_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 22 | 23 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/fab_label_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 34 | 35 | 36 | 37 | 38 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/impl/DisplayItemInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.todolist.DisplayItemInteractor; 9 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 10 | import de.djuelg.neuronizer.domain.repository.Repository; 11 | 12 | /** 13 | * Created by djuelg on 09.07.17. 14 | */ 15 | public class DisplayItemInteractorImpl extends AbstractInteractor implements DisplayItemInteractor { 16 | 17 | private final Callback callback; 18 | private final Repository repository; 19 | private final String itemUuid; 20 | 21 | public DisplayItemInteractorImpl(Executor threadExecutor, MainThread mainThread, 22 | Callback callback, Repository repository, String itemUuid) { 23 | super(threadExecutor, mainThread); 24 | this.callback = callback; 25 | this.repository = repository; 26 | this.itemUuid = itemUuid; 27 | } 28 | 29 | private void postHeader(final TodoListItem item) { 30 | mMainThread.post(new Runnable() { 31 | @Override 32 | public void run() { 33 | callback.onItemRetrieved(item); 34 | } 35 | }); 36 | } 37 | 38 | @Override 39 | public void run() { 40 | Optional item = repository.todoList().getItemById(itemUuid); 41 | if (item.isPresent()) postHeader(item.get()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/res/xml/preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 11 | 12 | 16 | 17 | 18 | 19 | 21 | 22 | 25 | 26 | 29 | 30 | 33 | 34 | 35 | 37 | 38 | 41 | 42 | 45 | 46 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/impl/DeleteTodoListInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.preview.DeleteTodoListInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 10 | import de.djuelg.neuronizer.domain.repository.Repository; 11 | 12 | /** 13 | * Created by djuelg on 11.07.17. 14 | */ 15 | 16 | public class DeleteTodoListInteractorImpl extends AbstractInteractor implements DeleteTodoListInteractor { 17 | 18 | private final DeleteTodoListInteractor.Callback callback; 19 | private final Repository repository; 20 | private final String uuid; 21 | 22 | public DeleteTodoListInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid) { 23 | super(threadExecutor, mainThread); 24 | this.callback = callback; 25 | this.repository = repository; 26 | this.uuid = uuid; 27 | } 28 | 29 | @Override 30 | public void run() { 31 | final Optional deletedItem = repository.todoList().getTodoListById(uuid); 32 | if (deletedItem.isPresent()) { 33 | repository.todoList().delete(deletedItem.get()); 34 | 35 | mMainThread.post(new Runnable() { 36 | @Override 37 | public void run() { 38 | callback.onTodoListDeleted(deletedItem.get()); 39 | } 40 | }); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/note/impl/DisplayNoteInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.note.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.note.DisplayNoteInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.Importance; 10 | import de.djuelg.neuronizer.domain.model.preview.Note; 11 | import de.djuelg.neuronizer.domain.repository.Repository; 12 | 13 | /** 14 | * Created by djuelg on 09.07.17. 15 | */ 16 | public class DisplayNoteInteractorImpl extends AbstractInteractor implements DisplayNoteInteractor { 17 | 18 | private final Callback callback; 19 | private final Repository repository; 20 | private final String uuid; 21 | 22 | public DisplayNoteInteractorImpl(Executor threadExecutor, MainThread mainThread, 23 | Callback callback, Repository repository, String uuid) { 24 | super(threadExecutor, mainThread); 25 | this.callback = callback; 26 | this.repository = repository; 27 | this.uuid = uuid; 28 | } 29 | 30 | @Override 31 | public void run() { 32 | final Optional note = repository.note().get(uuid); 33 | if (note.isPresent()) { 34 | Importance.increase(repository, note.get()); 35 | Importance.checkForNormalization(repository, note.get()); 36 | } 37 | 38 | mMainThread.post(new Runnable() { 39 | @Override 40 | public void run() { 41 | callback.onNoteRetrieved(note); 42 | } 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/impl/DisplayHeadersInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist.impl; 2 | 3 | import com.fernandocejas.arrow.collections.Lists; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.todolist.DisplayHeadersInteractor; 9 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 10 | import de.djuelg.neuronizer.domain.repository.Repository; 11 | 12 | /** 13 | * Created by djuelg on 09.07.17. 14 | */ 15 | public class DisplayHeadersInteractorImpl extends AbstractInteractor implements DisplayHeadersInteractor { 16 | 17 | private final Callback callback; 18 | private final Repository repository; 19 | private final String todoListUuid; 20 | 21 | public DisplayHeadersInteractorImpl(Executor threadExecutor, MainThread mainThread, 22 | Callback callback, Repository repository, String todoListUuid) { 23 | super(threadExecutor, mainThread); 24 | this.callback = callback; 25 | this.repository = repository; 26 | this.todoListUuid = todoListUuid; 27 | } 28 | 29 | private void postHeader(final Iterable headers) { 30 | mMainThread.post(new Runnable() { 31 | @Override 32 | public void run() { 33 | callback.onHeadersRetrieved(Lists.newArrayList(headers)); 34 | } 35 | }); 36 | } 37 | 38 | @Override 39 | public void run() { 40 | Iterable headers = repository.todoList().getHeadersOfTodoListId(todoListUuid); 41 | postHeader(headers); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/preview/Importance.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.preview; 2 | 3 | import java.util.List; 4 | 5 | import de.djuelg.neuronizer.domain.repository.Repository; 6 | 7 | /** 8 | * Created by djuelg on 18.10.17. 9 | */ 10 | 11 | public class Importance { 12 | 13 | private static final int ACCESS_PEAK = 180; 14 | 15 | public static void increase(Repository repository, ImportanceComparable importance) { 16 | if (importance instanceof TodoList) { 17 | final TodoList todoList = (TodoList) importance.increaseAccessCounter(); 18 | repository.todoList().update(todoList); 19 | 20 | } else if (importance instanceof Note) { 21 | final Note note = (Note) importance.increaseAccessCounter(); 22 | repository.note().update(note); 23 | } 24 | } 25 | 26 | public static void checkForNormalization(Repository repository, ImportanceComparable importance) { 27 | if (importance.getAccessCounter() >= ACCESS_PEAK) normalizeImportance(repository); 28 | } 29 | 30 | private static void normalizeImportance(Repository repository) { 31 | normalizeTodoListImportance(repository); 32 | normalizeNoteImportance(repository); 33 | } 34 | 35 | private static void normalizeNoteImportance(Repository repository) { 36 | List notes = repository.note().getAll(); 37 | 38 | for (Note note : notes) { 39 | repository.note().update(note.normalizeAccessCounter()); 40 | } 41 | } 42 | 43 | private static void normalizeTodoListImportance(Repository repository) { 44 | List todoLists = repository.todoList().getAll(); 45 | 46 | for (TodoList todoList : todoLists) { 47 | repository.todoList().update(todoList.normalizeAccessCounter()); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/impl/AddNoteInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview.impl; 2 | 3 | import de.djuelg.neuronizer.domain.executor.Executor; 4 | import de.djuelg.neuronizer.domain.executor.MainThread; 5 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 6 | import de.djuelg.neuronizer.domain.interactors.preview.AddNoteInteractor; 7 | import de.djuelg.neuronizer.domain.model.preview.Note; 8 | import de.djuelg.neuronizer.domain.repository.Repository; 9 | 10 | /** 11 | * Created by djuelg on 09.07.17. 12 | */ 13 | 14 | public class AddNoteInteractorImpl extends AbstractInteractor implements AddNoteInteractor { 15 | 16 | private final Callback callback; 17 | private final Repository repository; 18 | private final String title; 19 | 20 | public AddNoteInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String title) { 21 | super(threadExecutor, mainThread); 22 | this.callback = callback; 23 | this.repository = repository; 24 | this.title = title; 25 | } 26 | 27 | @Override 28 | public void run() { 29 | final int position = repository.preview().count(); 30 | // try to insert with new UUID on failure 31 | Note item = new Note(title, position); 32 | while(!repository.note().insert(item)) { 33 | item = new Note(title, position); 34 | } 35 | 36 | final String uuid = item.getUuid(); 37 | final String title = item.getTitle(); 38 | 39 | // notify on the main thread that we have inserted this item 40 | mMainThread.post(new Runnable() { 41 | @Override 42 | public void run() { 43 | callback.onNoteAdded(uuid, title); 44 | } 45 | }); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/preview/NotePreview.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.preview; 2 | 3 | import java.util.Objects; 4 | 5 | import de.djuelg.neuronizer.domain.model.BaseModel; 6 | 7 | import static de.djuelg.neuronizer.presentation.ui.custom.HtmlStripper.stripHtml; 8 | 9 | /** 10 | * Created by djuelg on 09.07.17. 11 | * 12 | * Group of TodoList items to display a preview 13 | */ 14 | 15 | public class NotePreview implements Preview { 16 | 17 | private final Note note; 18 | 19 | public NotePreview(Note note) { 20 | this.note = note; 21 | } 22 | 23 | @Override 24 | public BaseModel getBaseItem() { 25 | return note; 26 | } 27 | 28 | @Override 29 | public String getSubtitle() { 30 | return ""; 31 | } 32 | 33 | @Override 34 | public String getDetails() { 35 | String body = stripHtml(note.getBody()).replaceAll("(?m)^\\s", ""); 36 | return (body.length() < 32) 37 | ? body 38 | : body.substring(0, 32) + "..."; 39 | } 40 | 41 | @Override 42 | public long calculateImportance() { 43 | return note.calculateImportance(); 44 | } 45 | 46 | @Override 47 | public int getPosition() { 48 | return note.getPosition(); 49 | } 50 | 51 | @Override 52 | public String toString() { 53 | return "NotePreview{" + 54 | "note=" + note + 55 | '}'; 56 | } 57 | 58 | @Override 59 | public boolean equals(Object o) { 60 | if (this == o) return true; 61 | if (o == null || getClass() != o.getClass()) return false; 62 | final NotePreview that = (NotePreview) o; 63 | return Objects.equals(note, that.note); 64 | } 65 | 66 | @Override 67 | public int hashCode() { 68 | return Objects.hash(note); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/impl/DisplayPreviewInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview.impl; 2 | 3 | import com.fernandocejas.arrow.collections.Lists; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.preview.DisplayPreviewInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.ItemsPerPreview; 10 | import de.djuelg.neuronizer.domain.model.preview.Preview; 11 | import de.djuelg.neuronizer.domain.repository.Repository; 12 | 13 | /** 14 | * Created by djuelg on 09.07.17. 15 | */ 16 | public class DisplayPreviewInteractorImpl extends AbstractInteractor implements DisplayPreviewInteractor { 17 | 18 | private final static int MAX_DISPLAYED_ITEMS = 4; 19 | 20 | private final DisplayPreviewInteractor.Callback callback; 21 | private final Repository repository; 22 | 23 | public DisplayPreviewInteractorImpl(Executor threadExecutor, 24 | MainThread mainThread, 25 | Callback callback, Repository repository) { 26 | super(threadExecutor, mainThread); 27 | this.callback = callback; 28 | this.repository = repository; 29 | } 30 | 31 | private void postPreviews(final Iterable previews) { 32 | mMainThread.post(new Runnable() { 33 | @Override 34 | public void run() { 35 | callback.onPreviewsRetrieved(Lists.newArrayList(previews)); 36 | } 37 | }); 38 | } 39 | 40 | @Override 41 | public void run() { 42 | Iterable previews = repository.preview().getAll(new ItemsPerPreview(MAX_DISPLAYED_ITEMS)); 43 | postPreviews(previews); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/view/TypefaceSpan.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom.view; 2 | 3 | import android.content.Context; 4 | import android.graphics.Paint; 5 | import android.graphics.Typeface; 6 | import android.support.v4.util.LruCache; 7 | import android.text.Spannable; 8 | import android.text.TextPaint; 9 | import android.text.style.MetricAffectingSpan; 10 | 11 | /** 12 | * Style a {@link Spannable} with a custom {@link Typeface}. 13 | * 14 | * @author Tristan Waddington 15 | */ 16 | public class TypefaceSpan extends MetricAffectingSpan { 17 | /** An LruCache for previously loaded typefaces. */ 18 | private static LruCache sTypefaceCache = 19 | new LruCache(12); 20 | 21 | private Typeface mTypeface; 22 | 23 | /** 24 | * Load the {@link Typeface} and apply to a {@link Spannable}. 25 | */ 26 | public TypefaceSpan(Context context, String typefaceName) { 27 | mTypeface = sTypefaceCache.get(typefaceName); 28 | 29 | if (mTypeface == null) { 30 | mTypeface = Typeface.createFromAsset(context.getApplicationContext() 31 | .getAssets(), String.format("fonts/%s", typefaceName)); 32 | 33 | // Cache the loaded Typeface 34 | sTypefaceCache.put(typefaceName, mTypeface); 35 | } 36 | } 37 | 38 | @Override 39 | public void updateMeasureState(TextPaint p) { 40 | p.setTypeface(mTypeface); 41 | 42 | // Note: This flag is required for proper typeface rendering 43 | p.setFlags(p.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); 44 | } 45 | 46 | @Override 47 | public void updateDrawState(TextPaint tp) { 48 | tp.setTypeface(mTypeface); 49 | 50 | // Note: This flag is required for proper typeface rendering 51 | tp.setFlags(tp.getFlags() | Paint.SUBPIXEL_TEXT_FLAG); 52 | } 53 | } -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/impl/AddTodoListInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview.impl; 2 | 3 | import de.djuelg.neuronizer.domain.executor.Executor; 4 | import de.djuelg.neuronizer.domain.executor.MainThread; 5 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 6 | import de.djuelg.neuronizer.domain.interactors.preview.AddTodoListInteractor; 7 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 8 | import de.djuelg.neuronizer.domain.repository.Repository; 9 | 10 | /** 11 | * Created by djuelg on 09.07.17. 12 | */ 13 | 14 | public class AddTodoListInteractorImpl extends AbstractInteractor implements AddTodoListInteractor { 15 | 16 | private final AddTodoListInteractorImpl.Callback callback; 17 | private final Repository repository; 18 | private final String title; 19 | 20 | public AddTodoListInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String title) { 21 | super(threadExecutor, mainThread); 22 | this.callback = callback; 23 | this.repository = repository; 24 | this.title = title; 25 | } 26 | 27 | @Override 28 | public void run() { 29 | final int position = repository.preview().count(); 30 | // try to insert with new UUID on failure 31 | TodoList item = new TodoList(title, position); 32 | while(!repository.todoList().insert(item)) { 33 | item = new TodoList(title, position); 34 | } 35 | 36 | final String uuid = item.getUuid(); 37 | final String title = item.getTitle(); 38 | 39 | // notify on the main thread that we have inserted this item 40 | mMainThread.post(new Runnable() { 41 | @Override 42 | public void run() { 43 | callback.onTodoListAdded(uuid, title); 44 | } 45 | }); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/model/TodoListDAO.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.model; 2 | 3 | import io.realm.RealmObject; 4 | import io.realm.annotations.Index; 5 | import io.realm.annotations.PrimaryKey; 6 | import io.realm.annotations.Required; 7 | 8 | /** 9 | * Created by Domi on 03.09.2016. 10 | */ 11 | public class TodoListDAO extends RealmObject { 12 | 13 | @Required 14 | @Index 15 | @PrimaryKey 16 | private String uuid; 17 | @Required 18 | private String title; 19 | private long createdAt; 20 | private long changedAt; 21 | private int position; 22 | private long accessCounter; 23 | 24 | public TodoListDAO() { 25 | } 26 | 27 | public TodoListDAO(String uuid, String title, long createdAt, long changedAt, int position, long accessCounter) { 28 | this.uuid = uuid; 29 | this.title = title; 30 | this.createdAt = createdAt; 31 | this.changedAt = changedAt; 32 | this.position = position; 33 | this.accessCounter = accessCounter; 34 | } 35 | 36 | public String getUuid() { 37 | return uuid; 38 | } 39 | 40 | public String getTitle() { 41 | return title; 42 | } 43 | 44 | public long getCreatedAt() { 45 | return createdAt; 46 | } 47 | 48 | public long getChangedAt() { 49 | return changedAt; 50 | } 51 | 52 | public int getPosition() { 53 | return position; 54 | } 55 | 56 | public long getAccessCounter() { 57 | return accessCounter; 58 | } 59 | 60 | public void setTitle(String title) { 61 | this.title = title; 62 | } 63 | 64 | public void setChangedAt(long changedAt) { 65 | this.changedAt = changedAt; 66 | } 67 | 68 | public void setPosition(int position) { 69 | this.position = position; 70 | } 71 | 72 | public void setAccessCounter(long accessCounter) { 73 | this.accessCounter = accessCounter; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/res/layout/todo_list_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 21 | 22 | 32 | 33 | 43 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/impl/DeleteItemInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.todolist.DeleteItemInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 10 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 11 | import de.djuelg.neuronizer.domain.repository.Repository; 12 | 13 | /** 14 | * Created by djuelg on 11.07.17. 15 | */ 16 | 17 | public class DeleteItemInteractorImpl extends AbstractInteractor implements DeleteItemInteractor{ 18 | 19 | private final Callback callback; 20 | private final Repository repository; 21 | private final String uuid; 22 | 23 | public DeleteItemInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid) { 24 | super(threadExecutor, mainThread); 25 | this.callback = callback; 26 | this.repository = repository; 27 | this.uuid = uuid; 28 | } 29 | 30 | @Override 31 | public void run() { 32 | final Optional deletedItem = repository.todoList().getItemById(uuid); 33 | if (deletedItem.isPresent()) { 34 | repository.todoList().delete(deletedItem.get()); 35 | 36 | final Optional todoList = repository.todoList().getTodoListById(deletedItem.get().getParentTodoListUuid()); 37 | if (todoList.isPresent()) repository.todoList().update(todoList.get().updateLastChange()); 38 | 39 | mMainThread.post(new Runnable() { 40 | @Override 41 | public void run() { 42 | callback.onItemDeleted(deletedItem.get()); 43 | } 44 | }); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/impl/DeleteHeaderInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.todolist.DeleteHeaderInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 10 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 11 | import de.djuelg.neuronizer.domain.repository.Repository; 12 | 13 | /** 14 | * Created by djuelg on 11.07.17. 15 | */ 16 | 17 | public class DeleteHeaderInteractorImpl extends AbstractInteractor implements DeleteHeaderInteractor { 18 | 19 | private final Callback callback; 20 | private final Repository repository; 21 | private final String uuid; 22 | 23 | public DeleteHeaderInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid) { 24 | super(threadExecutor, mainThread); 25 | this.callback = callback; 26 | this.repository = repository; 27 | this.uuid = uuid; 28 | } 29 | 30 | @Override 31 | public void run() { 32 | final Optional deletedItem = repository.todoList().getHeaderById(uuid); 33 | if (deletedItem.isPresent()) { 34 | repository.todoList().delete(deletedItem.get()); 35 | 36 | final Optional todoList = repository.todoList().getTodoListById(deletedItem.get().getParentTodoListUuid()); 37 | if (todoList.isPresent()) repository.todoList().update(todoList.get().updateLastChange()); 38 | 39 | mMainThread.post(new Runnable() { 40 | @Override 41 | public void run() { 42 | callback.onHeaderDeleted(deletedItem.get()); 43 | } 44 | }); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/impl/RenameNoteInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.preview.RenameNoteInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.Note; 10 | import de.djuelg.neuronizer.domain.repository.Repository; 11 | 12 | /** 13 | * Created by djuelg on 10.07.17. 14 | */ 15 | 16 | public class RenameNoteInteractorImpl extends AbstractInteractor implements RenameNoteInteractor { 17 | 18 | private final Callback callback; 19 | private final Repository repository; 20 | private final String uuid; 21 | private final String title; 22 | private final int position; 23 | 24 | public RenameNoteInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid, String title, int position) { 25 | super(threadExecutor, mainThread); 26 | this.callback = callback; 27 | this.repository = repository; 28 | this.uuid = uuid; 29 | this.title = title; 30 | this.position = position; 31 | } 32 | 33 | @Override 34 | public void run() { 35 | final Optional outDatedItem = repository.note().get(uuid); 36 | if (outDatedItem.isPresent()) { 37 | 38 | final Note updatedItem = title.equals(outDatedItem.get().getTitle()) 39 | ? outDatedItem.get().update(title, position) 40 | : outDatedItem.get().update(title, position).updateLastChange(); 41 | repository.note().update(updatedItem); 42 | 43 | mMainThread.post(new Runnable() { 44 | @Override 45 | public void run() { 46 | callback.onNoteUpdated(updatedItem); 47 | } 48 | }); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/note/impl/EditNoteBodyInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.note.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.note.EditNoteBodyInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.Importance; 10 | import de.djuelg.neuronizer.domain.model.preview.Note; 11 | import de.djuelg.neuronizer.domain.repository.Repository; 12 | 13 | /** 14 | * Created by djuelg on 10.07.17. 15 | */ 16 | 17 | public class EditNoteBodyInteractorImpl extends AbstractInteractor implements EditNoteBodyInteractor { 18 | 19 | private final Callback callback; 20 | private final Repository repository; 21 | private final String uuid; 22 | private final String body; 23 | 24 | public EditNoteBodyInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid, String body) { 25 | super(threadExecutor, mainThread); 26 | this.callback = callback; 27 | this.repository = repository; 28 | this.uuid = uuid; 29 | this.body = body; 30 | } 31 | 32 | @Override 33 | public void run() { 34 | final Optional outDatedItem = repository.note().get(uuid); 35 | if (outDatedItem.isPresent()) { 36 | 37 | if (!outDatedItem.get().getBody().equals(body)) { 38 | final Note updatedItem = outDatedItem.get().update(body).updateLastChange(); 39 | // repository.note().update(updatedItem); // not needed because of Importance increasing 40 | 41 | Importance.increase(repository, updatedItem); 42 | 43 | mMainThread.post(new Runnable() { 44 | @Override 45 | public void run() { 46 | callback.onNoteUpdated(updatedItem); 47 | } 48 | }); 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/preview/impl/EditTodoListInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.preview.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.preview.EditTodoListInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 10 | import de.djuelg.neuronizer.domain.repository.Repository; 11 | 12 | /** 13 | * Created by djuelg on 10.07.17. 14 | */ 15 | 16 | public class EditTodoListInteractorImpl extends AbstractInteractor implements EditTodoListInteractor { 17 | 18 | private final EditTodoListInteractor.Callback callback; 19 | private final Repository repository; 20 | private final String uuid; 21 | private final String title; 22 | private final int position; 23 | 24 | public EditTodoListInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid, String title, int position) { 25 | super(threadExecutor, mainThread); 26 | this.callback = callback; 27 | this.repository = repository; 28 | this.uuid = uuid; 29 | this.title = title; 30 | this.position = position; 31 | } 32 | 33 | @Override 34 | public void run() { 35 | final Optional outDatedItem = repository.todoList().getTodoListById(uuid); 36 | if (outDatedItem.isPresent()) { 37 | 38 | final TodoList updatedItem = title.equals(outDatedItem.get().getTitle()) 39 | ? outDatedItem.get().update(title, position) 40 | : outDatedItem.get().update(title, position).updateLastChange(); 41 | repository.todoList().update(updatedItem); 42 | 43 | mMainThread.post(new Runnable() { 44 | @Override 45 | public void run() { 46 | callback.onTodoListUpdated(updatedItem); 47 | } 48 | }); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 30 | 31 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/model/NoteDAO.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.model; 2 | 3 | import io.realm.RealmObject; 4 | import io.realm.annotations.Index; 5 | import io.realm.annotations.PrimaryKey; 6 | import io.realm.annotations.Required; 7 | 8 | /** 9 | * Created by Domi on 03.09.2016. 10 | */ 11 | public class NoteDAO extends RealmObject { 12 | 13 | @Required 14 | @Index 15 | @PrimaryKey 16 | private String uuid; 17 | @Required 18 | private String title; 19 | private long createdAt; 20 | private long changedAt; 21 | private int position; 22 | private long accessCounter; 23 | @Required 24 | private String body; 25 | 26 | public NoteDAO() { 27 | } 28 | 29 | public NoteDAO(String uuid, String title, long createdAt, long changedAt, int position, long accessCounter, String body) { 30 | this.uuid = uuid; 31 | this.title = title; 32 | this.createdAt = createdAt; 33 | this.changedAt = changedAt; 34 | this.position = position; 35 | this.accessCounter = accessCounter; 36 | this.body = body; 37 | } 38 | 39 | public String getUuid() { 40 | return uuid; 41 | } 42 | 43 | public String getTitle() { 44 | return title; 45 | } 46 | 47 | public long getCreatedAt() { 48 | return createdAt; 49 | } 50 | 51 | public long getChangedAt() { 52 | return changedAt; 53 | } 54 | 55 | public int getPosition() { 56 | return position; 57 | } 58 | 59 | public String getBody() { 60 | return body; 61 | } 62 | 63 | public long getAccessCounter() { 64 | return accessCounter; 65 | } 66 | 67 | public void setTitle(String title) { 68 | this.title = title; 69 | } 70 | 71 | public void setChangedAt(long changedAt) { 72 | this.changedAt = changedAt; 73 | } 74 | 75 | public void setPosition(int position) { 76 | this.position = position; 77 | } 78 | 79 | public void setBody(String body) { 80 | this.body = body; 81 | } 82 | 83 | public void setAccessCounter(long accessCounter) { 84 | this.accessCounter = accessCounter; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/storage/model/TodoListHeaderDAO.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.storage.model; 2 | 3 | import io.realm.RealmObject; 4 | import io.realm.annotations.PrimaryKey; 5 | import io.realm.annotations.Required; 6 | 7 | /** 8 | * Created by Domi on 03.09.2016. 9 | */ 10 | public class TodoListHeaderDAO extends RealmObject { 11 | @PrimaryKey 12 | private String uuid; 13 | @Required 14 | private String title; 15 | private long createdAt; 16 | private long changedAt; 17 | private int position; 18 | private boolean expanded; 19 | @Required 20 | private String parentTodoListUuid; 21 | 22 | public TodoListHeaderDAO() { 23 | } 24 | 25 | public TodoListHeaderDAO(String uuid, String title, long createdAt, long changedAt, int position, boolean expanded, String parentTodoListUuid) { 26 | this.uuid = uuid; 27 | this.title = title; 28 | this.createdAt = createdAt; 29 | this.changedAt = changedAt; 30 | this.position = position; 31 | this.expanded = expanded; 32 | this.parentTodoListUuid = parentTodoListUuid; 33 | } 34 | 35 | public String getUuid() { 36 | return uuid; 37 | } 38 | 39 | public String getTitle() { 40 | return title; 41 | } 42 | 43 | public long getCreatedAt() { 44 | return createdAt; 45 | } 46 | 47 | public long getChangedAt() { 48 | return changedAt; 49 | } 50 | 51 | public int getPosition() { 52 | return position; 53 | } 54 | 55 | public boolean isExpanded() { 56 | return expanded; 57 | } 58 | 59 | public String getParentTodoListUuid() { 60 | return parentTodoListUuid; 61 | } 62 | 63 | public void setTitle(String title) { 64 | this.title = title; 65 | } 66 | 67 | public void setChangedAt(long changedAt) { 68 | this.changedAt = changedAt; 69 | } 70 | 71 | public void setPosition(int position) { 72 | this.position = position; 73 | } 74 | 75 | public void setExpanded(boolean expanded) { 76 | this.expanded = expanded; 77 | } 78 | 79 | public void setParentTodoListUuid(String parentTodoListUuid) { 80 | this.parentTodoListUuid = parentTodoListUuid; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_note.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 14 | 15 | 20 | 21 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 42 | 43 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/flexibleadapter/SectionableAdapter.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.flexibleadapter; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import java.util.List; 6 | 7 | import eu.davidea.flexibleadapter.FlexibleAdapter; 8 | import eu.davidea.flexibleadapter.items.AbstractFlexibleItem; 9 | import eu.davidea.flexibleadapter.items.IHeader; 10 | 11 | /** 12 | * Created by Domi on 26.09.2017. 13 | */ 14 | 15 | public class SectionableAdapter extends FlexibleAdapter { 16 | 17 | static final boolean STICKY = true; 18 | 19 | public static void setupFlexibleAdapter(Object listener, FlexibleAdapter adapter, boolean permanentDelete) { 20 | adapter.setPermanentDelete(permanentDelete) 21 | .addListener(listener) 22 | .expandItemsAtStartUp() 23 | .setStickyHeaders(true) 24 | .setSwipeEnabled(true) 25 | .setAnimationOnForwardScrolling(true) 26 | .setAnimationOnReverseScrolling(true); 27 | adapter.getItemTouchHelperCallback().setSwipeThreshold(0.666F); 28 | } 29 | 30 | public SectionableAdapter(@NonNull List items) { 31 | super(items); 32 | } 33 | 34 | public TodoListHeaderViewModel evaluateOldHeader(int fromPosition, int toPosition) { 35 | AbstractFlexibleItem item = getItem((fromPosition < toPosition) 36 | ? fromPosition-1 37 | : fromPosition); 38 | if (item instanceof TodoListItemViewModel) return (TodoListHeaderViewModel) getHeaderOf(item); 39 | return (TodoListHeaderViewModel) item; 40 | } 41 | 42 | public int evaluateDistanceToHeader(AbstractFlexibleItem item) { 43 | int relPos = 0; 44 | for (int i = getGlobalPositionOf(item)-1; i > 0; i--) { 45 | if (getItem(i) instanceof TodoListHeaderViewModel) return relPos; 46 | relPos++; 47 | } 48 | return relPos; 49 | } 50 | 51 | public int getHeaderPosition(TodoListHeaderViewModel header) { 52 | List headerList = getHeaderItems(); 53 | for (int i=0; i < getHeaderItems().size(); i++) { 54 | if (header.equals(headerList.get(i))) return i; 55 | } 56 | return -1; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/executor/impl/ThreadExecutor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.executor.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import java.util.concurrent.BlockingQueue; 6 | import java.util.concurrent.LinkedBlockingQueue; 7 | import java.util.concurrent.ThreadPoolExecutor; 8 | import java.util.concurrent.TimeUnit; 9 | 10 | import de.djuelg.neuronizer.domain.executor.Executor; 11 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 12 | 13 | /** 14 | * This singleton class will make sure that each interactor operation gets a background thread. 15 | *

16 | */ 17 | public class ThreadExecutor implements Executor { 18 | 19 | // This is a singleton 20 | private static volatile ThreadExecutor sThreadExecutor; 21 | 22 | private static final int CORE_POOL_SIZE = 3; 23 | private static final int MAX_POOL_SIZE = 5; 24 | private static final int KEEP_ALIVE_TIME = 120; 25 | private static final TimeUnit TIME_UNIT = TimeUnit.SECONDS; 26 | private static final BlockingQueue WORK_QUEUE = new LinkedBlockingQueue(); 27 | 28 | private ThreadPoolExecutor mThreadPoolExecutor; 29 | 30 | private ThreadExecutor() { 31 | mThreadPoolExecutor = new ThreadPoolExecutor( 32 | CORE_POOL_SIZE, 33 | MAX_POOL_SIZE, 34 | (long) KEEP_ALIVE_TIME, 35 | TIME_UNIT, 36 | WORK_QUEUE); 37 | } 38 | 39 | @Override 40 | public void execute(final AbstractInteractor interactor) { 41 | mThreadPoolExecutor.submit(new Runnable() { 42 | @Override 43 | public void run() { 44 | // run the main logic 45 | interactor.run(); 46 | 47 | // mark it as finished 48 | interactor.onFinished(); 49 | } 50 | }); 51 | } 52 | 53 | /** 54 | * Returns a singleton instance of this executor. If the executor is not initialized then it initializes it and returns 55 | * the instance. 56 | */ 57 | public static Executor getInstance() { 58 | return sThreadExecutor = Optional.fromNullable(sThreadExecutor).or(new ThreadExecutor()); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/impl/DisplayTodoListInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist.impl; 2 | 3 | import com.fernandocejas.arrow.collections.Lists; 4 | import com.fernandocejas.arrow.optional.Optional; 5 | 6 | import de.djuelg.neuronizer.domain.executor.Executor; 7 | import de.djuelg.neuronizer.domain.executor.MainThread; 8 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 9 | import de.djuelg.neuronizer.domain.interactors.todolist.DisplayTodoListInteractor; 10 | import de.djuelg.neuronizer.domain.model.preview.Importance; 11 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 12 | import de.djuelg.neuronizer.domain.model.todolist.TodoListSection; 13 | import de.djuelg.neuronizer.domain.repository.Repository; 14 | 15 | /** 16 | * Created by djuelg on 09.07.17. 17 | */ 18 | public class DisplayTodoListInteractorImpl extends AbstractInteractor implements DisplayTodoListInteractor { 19 | 20 | private final Callback callback; 21 | private final Repository repository; 22 | private final String uuid; 23 | 24 | public DisplayTodoListInteractorImpl(Executor threadExecutor, MainThread mainThread, 25 | Callback callback, Repository repository, String uuid) { 26 | super(threadExecutor, mainThread); 27 | this.callback = callback; 28 | this.repository = repository; 29 | this.uuid = uuid; 30 | } 31 | 32 | private void postTodoList(final Iterable sections) { 33 | mMainThread.post(new Runnable() { 34 | @Override 35 | public void run() { 36 | callback.onTodoListRetrieved(Lists.newArrayList(sections)); 37 | } 38 | }); 39 | } 40 | 41 | @Override 42 | public void run() { 43 | Optional todoList = repository.todoList().getTodoListById(uuid); 44 | if (todoList.isPresent()) { 45 | Iterable sections = repository.todoList().getSectionsOfTodoListId(uuid); 46 | postTodoList(sections); 47 | 48 | Importance.increase(repository, todoList.get()); 49 | Importance.checkForNormalization(repository, todoList.get()); 50 | } else { 51 | callback.onInvalidTodoListUuid(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/RecyclerViewScrollListener.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom; 2 | 3 | import android.support.v7.widget.LinearLayoutManager; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | import com.github.clans.fab.FloatingActionButton; 8 | import com.github.clans.fab.FloatingActionMenu; 9 | 10 | /** 11 | * Created by Domi on 28.03.2017. 12 | * 13 | * RecyclerViewScrollListener will show the view button as long as the list is scrolled 14 | * to the end 15 | */ 16 | 17 | public class RecyclerViewScrollListener extends RecyclerView.OnScrollListener { 18 | 19 | private final View view; 20 | 21 | public RecyclerViewScrollListener(View view) { 22 | this.view = view; 23 | } 24 | 25 | @Override 26 | public void onScrollStateChanged(RecyclerView recyclerView, int newState) { 27 | show(view); 28 | if (newState == RecyclerView.SCROLL_STATE_IDLE && recyclerView.getAdapter().getItemCount() != 0) { 29 | int lastVisibleItemPosition = ((LinearLayoutManager) recyclerView.getLayoutManager()).findLastCompletelyVisibleItemPosition(); 30 | int firstVisibleItemPosition = ((LinearLayoutManager) recyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition(); 31 | if (lastVisibleItemPosition != RecyclerView.NO_POSITION 32 | && lastVisibleItemPosition == recyclerView.getAdapter().getItemCount() - 1 && firstVisibleItemPosition != 0) hide(view); 33 | } 34 | super.onScrollStateChanged(recyclerView, newState); 35 | } 36 | 37 | private void hide(View view) { 38 | if (view instanceof FloatingActionButton) { 39 | ((FloatingActionButton)view).hide(true); 40 | } else if (view instanceof FloatingActionMenu) { 41 | ((FloatingActionMenu)view).hideMenu(true); 42 | } else { 43 | view.setVisibility(View.GONE); 44 | } 45 | } 46 | 47 | private void show(View view) { 48 | if (view instanceof FloatingActionButton) { 49 | ((FloatingActionButton)view).show(true); 50 | } else if (view instanceof FloatingActionMenu) { 51 | ((FloatingActionMenu)view).showMenu(true); 52 | } else { 53 | view.setVisibility(View.VISIBLE); 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/custom/view/AppbarCustomizer.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.custom.view; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.support.annotation.ColorRes; 7 | import android.support.annotation.StringRes; 8 | import android.support.v7.app.ActionBar; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.text.Spannable; 11 | import android.text.SpannableString; 12 | 13 | import de.djuelg.neuronizer.R; 14 | 15 | import static de.djuelg.neuronizer.presentation.ui.Constants.FONT_NAME; 16 | 17 | /** 18 | * Created by Domi on 22.07.2017. 19 | */ 20 | 21 | public class AppbarCustomizer { 22 | 23 | public static void configureAppbar(Activity activity, boolean showBackArrow) { 24 | ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar(); 25 | if (actionBar != null) { 26 | actionBar.setDisplayUseLogoEnabled(!showBackArrow); 27 | actionBar.setDisplayShowHomeEnabled(!showBackArrow); 28 | actionBar.setDisplayHomeAsUpEnabled(showBackArrow); 29 | if (!showBackArrow) actionBar.setIcon(R.mipmap.ic_launcher); 30 | } 31 | } 32 | 33 | public static void changeAppbarColor(Activity activity, @ColorRes int id) { 34 | ActionBar actionBar = ((AppCompatActivity) activity).getSupportActionBar(); 35 | if (actionBar != null) actionBar.setBackgroundDrawable(new ColorDrawable(activity.getResources().getColor(id))); 36 | } 37 | 38 | public static void changeAppbarTitle (Activity activity, @StringRes int id) { 39 | changeAppbarTitle(activity, activity.getResources().getString(id)); 40 | } 41 | 42 | public static void changeAppbarTitle(Activity activity, String text) { 43 | ActionBar actionBar = ((AppCompatActivity)activity).getSupportActionBar(); 44 | if (actionBar != null) actionBar.setTitle(fontifyString(activity, text)); 45 | } 46 | 47 | public static SpannableString fontifyString(Context context, String text) { 48 | SpannableString string = new SpannableString(text); 49 | string.setSpan(new TypefaceSpan(context, FONT_NAME), 0, string.length(), 50 | Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); 51 | return string; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'realm-android' 3 | apply from: "${project.rootDir}/QA/quality.gradle" 4 | 5 | android { 6 | compileSdkVersion 27 7 | 8 | defaultConfig { 9 | applicationId "de.djuelg.neuronizer" 10 | minSdkVersion 19 11 | targetSdkVersion 27 12 | versionCode 15 13 | versionName "1.3.3" 14 | vectorDrawables.useSupportLibrary = true 15 | testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' 16 | } 17 | 18 | buildTypes { 19 | release { 20 | minifyEnabled false 21 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 22 | } 23 | 24 | debug { 25 | minifyEnabled false 26 | applicationIdSuffix ".debug" 27 | } 28 | } 29 | } 30 | 31 | dependencies { 32 | implementation fileTree(dir: 'libs', include: ['*.jar']) 33 | 34 | // android 35 | implementation 'com.android.support:support-v4:27.1.1' 36 | implementation 'com.android.support:preference-v7:27.1.1' 37 | implementation 'com.android.support:appcompat-v7:27.1.1' 38 | implementation 'com.android.support:recyclerview-v7:27.1.1' 39 | implementation 'com.android.support:design:27.1.1' 40 | 41 | // general 42 | implementation 'com.jakewharton:butterknife:8.8.1' 43 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' 44 | implementation 'jp.wasabeef:richeditor-android:1.2.2' 45 | implementation 'com.fernandocejas:arrow:1.0.0' 46 | implementation 'com.github.clans:fab:1.6.4' 47 | implementation 'net.xpece.android:support-preference:2.3.2' 48 | implementation 'com.github.rustamg:file-dialogs:1.0' 49 | implementation 'com.github.apl-devs:appintro:v4.2.3' 50 | implementation 'eu.davidea:flexible-adapter:5.0.5' 51 | implementation 'eu.davidea:flexible-adapter-ui:1.0.0-b5' 52 | implementation 'com.overzealous:remark:1.1.0' 53 | 54 | // tests 55 | testImplementation 'junit:junit:4.12' 56 | testImplementation 'org.mockito:mockito-core:2.10.0' 57 | 58 | // instrumented tests 59 | androidTestImplementation 'com.android.support:support-annotations:27.1.1' 60 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 61 | androidTestImplementation 'com.android.support.test:rules:1.0.2' 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/base/AbstractInteractor.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.base; 2 | 3 | import de.djuelg.neuronizer.domain.executor.Executor; 4 | import de.djuelg.neuronizer.domain.executor.MainThread; 5 | 6 | /** 7 | * Created by dmilicic on 8/4/15. 8 | *

9 | * This abstract class implements some common methods for all interactors. Cancelling an interactor, check if its running 10 | * and finishing an interactor has mostly the same code throughout so that is why this class was created. Field methods 11 | * are declared volatile as we might use these methods from different threads (mainly from UI). 12 | *

13 | * For example, when an activity is getting destroyed then we should probably cancel an interactor 14 | * but the request will come from the UI thread unless the request was specifically assigned to a background thread. 15 | */ 16 | public abstract class AbstractInteractor implements Interactor { 17 | 18 | protected Executor mThreadExecutor; 19 | protected MainThread mMainThread; 20 | 21 | protected volatile boolean mIsCanceled; 22 | protected volatile boolean mIsRunning; 23 | 24 | public AbstractInteractor(Executor threadExecutor, MainThread mainThread) { 25 | mThreadExecutor = threadExecutor; 26 | mMainThread = mainThread; 27 | } 28 | 29 | /** 30 | * This method contains the actual business logic of the interactor. It SHOULD NOT BE USED DIRECTLY but, instead, a 31 | * developer should call the execute() method of an interactor to make sure the operation is done on a background thread. 32 | *

33 | * This method should only be called directly while doing unit/integration tests. That is the only reason it is declared 34 | * public as to help with easier testing. 35 | */ 36 | public abstract void run(); 37 | 38 | public void cancel() { 39 | mIsCanceled = true; 40 | mIsRunning = false; 41 | } 42 | 43 | public boolean isRunning() { 44 | return mIsRunning; 45 | } 46 | 47 | public void onFinished() { 48 | mIsRunning = false; 49 | mIsCanceled = false; 50 | } 51 | 52 | public void execute() { 53 | 54 | // mark this interactor as running 55 | this.mIsRunning = true; 56 | 57 | // start running this interactor in a background thread 58 | mThreadExecutor.execute(this); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/impl/AddHeaderInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import de.djuelg.neuronizer.domain.executor.Executor; 6 | import de.djuelg.neuronizer.domain.executor.MainThread; 7 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 8 | import de.djuelg.neuronizer.domain.interactors.todolist.AddHeaderInteractor; 9 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 10 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 11 | import de.djuelg.neuronizer.domain.repository.Repository; 12 | 13 | /** 14 | * Created by djuelg on 09.07.17. 15 | */ 16 | 17 | public class AddHeaderInteractorImpl extends AbstractInteractor implements AddHeaderInteractor { 18 | 19 | private final Callback callback; 20 | private final Repository repository; 21 | private final String title; 22 | private final String parentTodoListUuid; 23 | 24 | public AddHeaderInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String title, String parentTodoListUuid) { 25 | super(threadExecutor, mainThread); 26 | this.callback = callback; 27 | this.repository = repository; 28 | this.title = title; 29 | this.parentTodoListUuid = parentTodoListUuid; 30 | } 31 | 32 | @Override 33 | public void run() { 34 | final Optional todoList = repository.todoList().getTodoListById(parentTodoListUuid); 35 | final int position = repository.todoList().getHeaderCountOfTodoList(parentTodoListUuid); 36 | if (!todoList.isPresent()) { 37 | callback.onParentNotFound(); 38 | return; 39 | } 40 | 41 | // try to insert with new UUID on failure 42 | TodoListHeader header = new TodoListHeader(title, position, parentTodoListUuid); 43 | while(!repository.todoList().insert(header)) { 44 | header = new TodoListHeader(title, position, parentTodoListUuid); 45 | } 46 | 47 | repository.todoList().update(todoList.get().updateLastChange()); 48 | 49 | // notify on the main thread that we have inserted this item 50 | mMainThread.post(new Runnable() { 51 | @Override 52 | public void run() { 53 | callback.onHeaderAdded(); 54 | } 55 | }); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/res/layout/widget_todo_list.xml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 14 | 15 | 32 | 33 | 43 | 44 | 45 | 46 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 47 | 48 | 49 | 52 | 53 | 54 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/model/preview/TodoListPreview.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.model.preview; 2 | 3 | import android.text.TextUtils; 4 | 5 | import com.fernandocejas.arrow.optional.Optional; 6 | 7 | import java.util.Collections; 8 | import java.util.List; 9 | import java.util.Objects; 10 | 11 | import de.djuelg.neuronizer.domain.comparator.PositionComparator; 12 | import de.djuelg.neuronizer.domain.model.BaseModel; 13 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 14 | import de.djuelg.neuronizer.domain.model.todolist.TodoListItem; 15 | 16 | /** 17 | * Created by djuelg on 09.07.17. 18 | * 19 | * Group of TodoList items to display a preview 20 | */ 21 | 22 | public class TodoListPreview implements Preview { 23 | 24 | private final TodoList todoList; 25 | private final TodoListHeader header; 26 | private final List items; 27 | 28 | public TodoListPreview(TodoList todoList, TodoListHeader header, List items) { 29 | this.todoList = todoList; 30 | this.header = header; 31 | this.items = items; 32 | } 33 | 34 | @Override 35 | public BaseModel getBaseItem() { 36 | return todoList; 37 | } 38 | 39 | @Override 40 | public String getSubtitle() { 41 | return Optional.fromNullable(header).or(TodoListHeader.absent()).getTitle(); 42 | } 43 | 44 | @Override 45 | public String getDetails() { 46 | Collections.sort(items, new PositionComparator()); 47 | return TextUtils.join(", ", items); 48 | } 49 | 50 | @Override 51 | public long calculateImportance() { 52 | return todoList.calculateImportance(); 53 | } 54 | 55 | @Override 56 | public int getPosition() { 57 | return todoList.getPosition(); 58 | } 59 | 60 | @Override 61 | public boolean equals(Object o) { 62 | if (this == o) return true; 63 | if (o == null || getClass() != o.getClass()) return false; 64 | final TodoListPreview that = (TodoListPreview) o; 65 | return Objects.equals(todoList, that.todoList) && 66 | Objects.equals(header, that.header) && 67 | Objects.equals(items, that.items); 68 | } 69 | 70 | @Override 71 | public int hashCode() { 72 | return Objects.hash(todoList, header, items); 73 | } 74 | 75 | @Override 76 | public String toString() { 77 | return "TodoListPreview{" + 78 | "todoList=" + todoList + 79 | ", header=" + header + 80 | ", items=" + items + 81 | '}'; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/Constants.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui; 2 | 3 | /** 4 | * Created by Domi on 22.07.2017. 5 | */ 6 | 7 | public class Constants { 8 | 9 | // List of Keys to interact between fragments or activities 10 | public static final String KEY_UUID = "KEY_UUID"; 11 | public static final String KEY_ITEM_UUID = "KEY_ITEM_UUID"; 12 | public static final String KEY_TITLE = "KEY_TITLE"; 13 | public static final String KEY_SWITCH_FRAGMENT = "KEY_SWITCH_FRAGMENT"; 14 | public static final String KEY_PREVIEW = "KEY_PREVIEW"; 15 | public static final String KEY_TODO_LIST = "KEY_TODO_LIST"; 16 | public static final String KEY_WIDGET_REPOSITORY = "KEY_WIDGET_REPOSITORY"; 17 | public static final String KEY_EDITOR_CONTENT = "KEY_EDITOR_CONTENT"; 18 | 19 | // ActionBar 20 | public static final String FONT_NAME = "Quicksand-Regular.ttf"; 21 | public static final String FONT_NAME_FULL = "fonts/Quicksand-Regular.ttf"; 22 | 23 | // Shared prefs 24 | public static final String KEY_PREF_SWITCH = "key_pref_switch_database"; 25 | public static final String KEY_PREF_IMPORT = "key_pref_import_database"; 26 | public static final String KEY_PREF_EXPORT = "key_pref_export_database"; 27 | public static final String KEY_PREF_ACTIVE_REPO = "key_pref_active_repo"; 28 | public static final String KEY_PREF_INTRO = "key_pref_introduction"; 29 | public static final String KEY_PREF_ABOUT = "key_pref_show_about"; 30 | public static final String KEY_PREF_IMPRINT = "key_pref_show_imprint"; 31 | public static final String KEY_PREF_TODO = "key_pref_confirm_delete_todo_list"; 32 | public static final String KEY_PREF_HEADER_OR_ITEM = "key_pref_confirm_delete_header_or_item"; 33 | public static final String KEY_PREF_SORTING = "key_pref_sorting"; 34 | public static final String KEY_PREF_PREVIEW_INTRO_SHOWN = "key_pref_preview_intro_shown"; 35 | public static final String KEY_PREF_TODO_LIST_INTRO_SHOWN = "key_pref_todo_intro_shown"; 36 | public static final String KEY_PREF_WIDGET_UUID_PREFIX = "key_pref_widget_uuid_prefix_"; 37 | public static final String KEY_PREF_WIDGET_REALM_PREFIX = "key_pref_widget_realm_prefix_"; 38 | 39 | // RichEditor 40 | public static final int EDITOR_HEIGHT = 200; 41 | public static final int EDITOR_PADDING = 8; 42 | public static final int EDITOR_FONT_SIZE = 18; 43 | public static final String EDITOR_DETAILS_CSS = "css/Details.css"; 44 | public static final String EDITOR_ABOUT_CSS = "css/About.css"; 45 | 46 | // Permissions 47 | public static final int READ_EXTERNAL_STORAGE = 0; 48 | public static final int WRITE_EXTERNAL_STORAGE = 1; 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/presentation/ui/fragments/ImprintFragment.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.presentation.ui.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.MenuItem; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import butterknife.BindView; 12 | import butterknife.ButterKnife; 13 | import butterknife.Unbinder; 14 | import de.djuelg.neuronizer.R; 15 | import jp.wasabeef.richeditor.RichEditor; 16 | 17 | import static de.djuelg.neuronizer.presentation.ui.Constants.EDITOR_ABOUT_CSS; 18 | import static de.djuelg.neuronizer.presentation.ui.Constants.EDITOR_FONT_SIZE; 19 | import static de.djuelg.neuronizer.presentation.ui.custom.view.AppbarCustomizer.changeAppbarTitle; 20 | import static de.djuelg.neuronizer.presentation.ui.custom.view.AppbarCustomizer.configureAppbar; 21 | 22 | public class ImprintFragment extends Fragment { 23 | 24 | @BindView(R.id.richEditor_imprint) RichEditor richEditor; 25 | private Unbinder mUnbinder; 26 | 27 | public ImprintFragment() { 28 | } 29 | 30 | /** 31 | * Use this factory method to create a new instance of 32 | * this fragment using the provided parameters. 33 | */ 34 | public static ImprintFragment newInstance() { 35 | return new ImprintFragment(); 36 | } 37 | 38 | @Override 39 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, 40 | Bundle savedInstanceState) { 41 | final View view = inflater.inflate(R.layout.fragment_imprint, container, false); 42 | 43 | mUnbinder = ButterKnife.bind(this, view); 44 | configureAppbar(getActivity(), true); 45 | changeAppbarTitle(getActivity(), R.string.imprint); 46 | setHasOptionsMenu(true); 47 | 48 | richEditor.setHtml(getString(R.string.imprint_html)); 49 | richEditor.loadCSS(EDITOR_ABOUT_CSS); 50 | richEditor.setPadding(24, 0, 24, 0); 51 | richEditor.setEditorFontSize(EDITOR_FONT_SIZE); 52 | richEditor.setInputEnabled(false); 53 | richEditor.setFocusable(false); 54 | 55 | return view; 56 | } 57 | 58 | @SuppressWarnings("ConstantConditions") 59 | @Override 60 | public boolean onOptionsItemSelected(MenuItem item) { 61 | switch (item.getItemId()) { 62 | case android.R.id.home: 63 | getFragmentManager().popBackStack(); 64 | return true; 65 | } 66 | return false; 67 | } 68 | 69 | @Override 70 | public void onDestroyView() { 71 | super.onDestroyView(); 72 | mUnbinder.unbind(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/de/djuelg/neuronizer/domain/interactors/todolist/impl/EditHeaderInteractorImpl.java: -------------------------------------------------------------------------------- 1 | package de.djuelg.neuronizer.domain.interactors.todolist.impl; 2 | 3 | import com.fernandocejas.arrow.optional.Optional; 4 | 5 | import java.util.InputMismatchException; 6 | 7 | import de.djuelg.neuronizer.domain.executor.Executor; 8 | import de.djuelg.neuronizer.domain.executor.MainThread; 9 | import de.djuelg.neuronizer.domain.interactors.base.AbstractInteractor; 10 | import de.djuelg.neuronizer.domain.interactors.todolist.EditHeaderInteractor; 11 | import de.djuelg.neuronizer.domain.model.preview.TodoList; 12 | import de.djuelg.neuronizer.domain.model.todolist.TodoListHeader; 13 | import de.djuelg.neuronizer.domain.repository.Repository; 14 | 15 | /** 16 | * Created by djuelg on 10.07.17. 17 | */ 18 | 19 | public class EditHeaderInteractorImpl extends AbstractInteractor implements EditHeaderInteractor { 20 | 21 | private final Callback callback; 22 | private final Repository repository; 23 | private final String uuid; 24 | private final String title; 25 | private final int position; 26 | private final boolean expanded; 27 | 28 | public EditHeaderInteractorImpl(Executor threadExecutor, MainThread mainThread, Callback callback, Repository repository, String uuid, String title, int position, boolean expanded) { 29 | super(threadExecutor, mainThread); 30 | this.callback = callback; 31 | this.repository = repository; 32 | this.uuid = uuid; 33 | this.title = title; 34 | this.position = position; 35 | this.expanded = expanded; 36 | } 37 | 38 | @Override 39 | public void run() { 40 | final Optional outDatedItem = repository.todoList().getHeaderById(uuid); 41 | if (!outDatedItem.isPresent()) { 42 | throw new InputMismatchException("Item not existing!"); 43 | } 44 | 45 | final TodoListHeader updatedItem = outDatedItem.get().update(title, position, expanded); 46 | repository.todoList().update(updatedItem); 47 | 48 | final Optional todoList = repository.todoList().getTodoListById(updatedItem.getParentTodoListUuid()); 49 | final TodoListHeader itemFromUI = new TodoListHeader(uuid, title, outDatedItem.get().getCreatedAt(), outDatedItem.get().getChangedAt(), 50 | position, expanded, outDatedItem.get().getParentTodoListUuid()); 51 | if (todoList.isPresent() && !outDatedItem.get().equals(itemFromUI)) repository.todoList().update(todoList.get().updateLastChange()); 52 | 53 | mMainThread.post(new Runnable() { 54 | @Override 55 | public void run() { 56 | callback.onHeaderUpdated(updatedItem); 57 | } 58 | }); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_widget_configure.xml: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 23 | 24 | 30 | 31 | 38 | 39 |