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
@clementwzk
Copy link
Owner

This is a greate update. Btw, i think the bookmark button is too big, it does not fit the app design. In addition, i think we should be able to bookmark a calculation from the history section by left slide for example.

MainActivity.kt
- modified the onSwiped function in setSwipeTouchHelperForRecyclerView(), so that left swipe deletes and right swipe adds history element to bookmarks without deleting it from history

strings.xml
- added "Added to bookmarks" string to show on history tab after right swipe

activity_maina.xml
- made the bookmark icon smaller in all layouts
@SamuelZima
Copy link
Author

I've modified the swiping functionality on the history tab:

  • left swipe deletes the history element
  • right swipe adds the history element to bookmarks without deleting it from history

I've also made the bookmark icon smaller, so that it's not as distracting as before.

@clementwzk
Copy link
Owner

Thanks! I will review this pull requests asap

@clementwzk
Copy link
Owner

The update is good, but I see several details to fix:

  1. We should be able to swipe between history and bookmarks
  2. The buttons "history | bookmarks' are not following the app theme
  3. The bookmark button to add new bookmark is a little bit too big I think (but it's not a big deal)

@SamuelZima
Copy link
Author

Ok, so as for the details you mentioned I would like a few clarifications, so I know what to fix/change:

  1. How do you think the swiping between the history/bookmarks tabs should work ? Because now, the swiping is implemented on the individual elements in history/bookmarks for deletion or adding to bookmarks, so I am not sure what you mean by being able to swipe between history and bookmarks as swiping on the history/bookmarks tabs already has other functionality.
  2. For the history | bookmarks tabs, how do you propose they should look to follow the app theme ? Should I change the background/text colours or add icons, or just use icons without the History/Bookmarks text ?

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.

2 participants