Skip to content

Conversation

@SamuelZima
Copy link

Added Functionality

  1. History and Bookmarks are separate tabs with separate storage in the sliding panel. Bookmarks are implemented with the same style, structure, separators and functionality (swipe to delete, click to copy) as already existing history.
  2. "No Bookmarks Available" text when bookmarks tab has no saved bookmarks similar as in history.
  3. Bookmark icon on the left side of the calculation line used to toggle (add/remove) the calculation/result from bookmarks. The bookmark icon fills to signal to the user that this calculation has been bookmarked.
  4. Clear bookmarks button in the menu to delete all saved bookmarks. After clicking the "Clear bookmarks" a modal will be shown and user must confirm this deletion to avoid potential missclicks.

Here is a short PDF file containing the aforementioned functionality with added screenshots from the app for better demonstration of the added functionality:
OpenCalc_384_bookmarks.pdf

I tried to implement it correctly across all layouts and with minimal changes to the already existing implementations, but if you find any bugs, weird behaviour or wonky/broken UI feel free to tell me.

- added Bookmark.kt - data class for individual bookmarks, same structure as History.kt

- added BookmarksAdapter.kt - for building the recycler view and listeners, very similar style and structure to HistoryAdapter.kt

- updated MyPreferences.kt - added bookmark constants, setters and CRUD functions
MainActivity.kt
- added Bookmarks RecyclerView setup
- added setSwipeTouchHelperForBookmarks() function to delete a bookmark on swipe as in history
- added addBookmark() function which bookmarks a calculation
- in onResume added runCatching block to refresh bookmarks

layout/activity_main.xml
- added RecyckerView for Bookmarks to layout/activity_main.xml, layout-land/activity_main.xml, layout-sw-720dp-land/activity_main.xml

values/strings.xml - added nothing_to_bookmark and bookmarked string resources
MainActivity.kt
- history/bookmarks tabs setup -> default to History tab
- added showHistoryList(), showBookmarksList() functions

acitivity_main.xml
- changed constraint/borders to the tabs and recycler views in all three layouts

strings.xml
- added bookmarks tab title
MainActivity.kt
- updated History/Bookmarks tabs setup, so the sliding panel recycler view is always rendered on top of the calculator buttons to resolve the late rendering of calculator buttons on collapsing

activity_main.xml for every layout
- added umano overlay and updated paddings

strings.xml
- added string resource for history tab title
MainActivity.kt
- updated addBookmark() function
- added bookmark button setup
- added currentCalcAndResult() and updateBookmarkIcon() helpers
- added updateBookmarkIcon() function call to every place where the calculation is calculated or cleared

activity_main.xml
- added Bookmark ImageButton

- added two bookmark icons to res/drawable/
addBookmark() -> toggleBookmark()
- updated the function to toggle the adding or removing of a bookmark for a calculation by clicking on the bookmark icon
MainActivity.kt
- added clearBookmarks() function which builds and shows an alert modal and after confirmation deletes all saved bookmarks

app_menu.xml
- added Clear bookmarks item

strings.xml
- added strings for the clear bookmarks alert modals
BookmarksAdapter.kt
- fixed incorrect grouping of calculations based on relative time to look exactly like history

MainActivity.kt
- sync the scrollableView with the selected tab, so either history or bookmarks recycler view

activity_main.xml
- updated layouts to fix the weird scrolling on weird collapsing when clicking on the last two elements in the recycler view in the bookmarks tab by using a barrier and updating constraint for the history_sliding_layout_button
MainActivity.kt
- added checkEmptyBookmarksForNoBookmarksLabel() function and updated checkEmptyHistoryForNoHistoryLabel() function to check if we are currently on history or bookmarks tab and if there are no history or bookmark entries
- updated showHistoryList() and showBookmarksList() functions
- added checkEmptyBookmarksForNoBookmarksLabel() calls after every bookmarks list mutation/deletion

activity_main.xml
- added TextView element for the no bookmarks text to all three layouts

strings.xml
- added no bookmarks available string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant