Closes #61
And also affects #60 (solving it for NotesFragment-list at least)
Some notes related bugs have been fixed and a feature to select and delete multiple items of the RecyclerListView in NotesFragment has been added.
Affects
Since some things are related to database (NoteModel has been created etc.) and the list of notes connected to a book is a similar case (and therefore my changes might be important for that, too) @SarahKurek is assigned.
Notes for Reviewer
Here are some explainations to my changes:
TextNoteEditor:
Text lines overlapped when a text format was applied sometimes: This was caused by the way the span start position was declared in the onTextChanged. It is now declared as one index number lower than the current cursor position (so used formatting options are basically applied onTextChange on the last character that has been inserted). If the last user input is a deleting a charcter instead of inserting (checked by text length before and after input) the format is not applied of course.
Empty notes were saved when an already existing note has been editted: This was caused by the way the text was checked for being empty: the html string containing tags (linebreaks etc.) was checked and this has been changed to now only checking the raw text using jsoup.
The underline text format was not correctly applied and unapplied. Wrong continue statements in quoteValid and quoteInvalid are now return statements.
Adjusted apply-cases for the toolbar features for the RichTextEditor in TextNoteEditorFragment: instead of using a default boolean to declare selected and unselected items, which was causing bugs in complicated cases, the toolbar icon views are now declared selected or not (using view-method isSelected()) and their booleans are passed onClick to RichTextEditor. Only undo and redo are exceptions and only get backgroundcolor-changes on click and automatically switch back after a short time.
Fix the quote span appearance (color, stripewidth, gapwidth between stripe and first character) and small bugs on its appliance.
Fix a bug where applied text formats did get applied to the entire rest of the text, which was causing bugs whenver text format has been changed and new text has been added somewhere in between the existing text. The endOfString-variable in onTextChanged is adjusted now.
NoteDAO:
Current time values for createDate and modDate assignments are wrong (always showed any date in 1970): usage of "System.currentTimeMillis() / 1_000L" is replaced by Date.getTime(); .
Clean-up:
Data and UI were not cleanly separated in note-related classes: a NoteModel with necessary methods has been created and is now used for any data-handling in other note-related classes.
Note-Object params (createDate and modDate) were declared manually and are now automatically assigned whenever creating a new note-row in the database.
Added feature:
Selecting and deleting multiple note items from recyclerListView (in NotesFragment): On longClick an item is selected. If at least one item is selected a panel with red background is shown on the bottom (bottom-up animation) and hidden (by bottom-down-animation) whenever selected items are removed or all items are deselected. The panel contains an ImageButton (delete-icon as drawable) that removes all selected items from the database and the recyclerViewList onClick.
Description
Closes #61 And also affects #60 (solving it for NotesFragment-list at least)
Some notes related bugs have been fixed and a feature to select and delete multiple items of the RecyclerListView in NotesFragment has been added.
Affects
Since some things are related to database (NoteModel has been created etc.) and the list of notes connected to a book is a similar case (and therefore my changes might be important for that, too) @SarahKurek is assigned.
Notes for Reviewer
Here are some explainations to my changes:
TextNoteEditor:
Text lines overlapped when a text format was applied sometimes: This was caused by the way the span start position was declared in the onTextChanged. It is now declared as one index number lower than the current cursor position (so used formatting options are basically applied onTextChange on the last character that has been inserted). If the last user input is a deleting a charcter instead of inserting (checked by text length before and after input) the format is not applied of course.
Empty notes were saved when an already existing note has been editted: This was caused by the way the text was checked for being empty: the html string containing tags (linebreaks etc.) was checked and this has been changed to now only checking the raw text using jsoup.
The underline text format was not correctly applied and unapplied. Wrong continue statements in quoteValid and quoteInvalid are now return statements.
Adjusted apply-cases for the toolbar features for the RichTextEditor in TextNoteEditorFragment: instead of using a default boolean to declare selected and unselected items, which was causing bugs in complicated cases, the toolbar icon views are now declared selected or not (using view-method isSelected()) and their booleans are passed onClick to RichTextEditor. Only undo and redo are exceptions and only get backgroundcolor-changes on click and automatically switch back after a short time.
Fix the quote span appearance (color, stripewidth, gapwidth between stripe and first character) and small bugs on its appliance.
Fix a bug where applied text formats did get applied to the entire rest of the text, which was causing bugs whenver text format has been changed and new text has been added somewhere in between the existing text. The endOfString-variable in onTextChanged is adjusted now.
NoteDAO:
Clean-up:
Data and UI were not cleanly separated in note-related classes: a NoteModel with necessary methods has been created and is now used for any data-handling in other note-related classes.
Note-Object params (createDate and modDate) were declared manually and are now automatically assigned whenever creating a new note-row in the database.
Added feature:
Please review & comment/approve.