-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bookmark improvements #111
Conversation
…on book name in the bookmark list. (Does not display corresponding translation yet)
…p to that translation when selected.
… previous long click. (Can now quickly select multiple entries)
re-add. This will move bookmark up in date order list.
…en coming from old bookmarks.
It would be helpful if you added screenshot or two to demonstrate the new feature. |
As to the motivation for this change - see this from my feature request: Minimal bookmark enhancement to support verse journal Background: I don't have time/will to type notes in the app, but a chronological list of the verses that stood out for me during Bible reading helps me to meditate for longer on them as I revisit the list. It helps me see patterns on what God is saying to me over time. And Bible supports this to some extent already through bookmarks (thank you!) but it needs improvement. |
wow, good point!
I'd like to remind about quite similar issue: persistent history requests,
see https://github.com/mjdenham/and-bible/pull/54 for details
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea and suggest that this will be merged. Code looks OK and readable. There are some commented out code that needs to be cleaned up. See other small comments too.
(Please note that I'm not throughly familiar with the codebase but wanted to help with this code review. @mjdenham needs to check this too :) )
// | ||
// // create DTO with all required info to display this Translation text | ||
// retval.add(new TranslationDto(book, text, fontFile)); | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget here some commented-out code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some books may need a special font to display. For now I do not cater for this in the bookmark list - not sure that it is necessary. Your input on this will be welcomed.
I copied the corresponding code from CompareTranslationsControl (where the font is supported), but commented it out with a explanatory comment at the start. This can be taken out/modified depending on the way we want to go.
@@ -78,10 +81,12 @@ public boolean toggleBookmarkForVerseRange(VerseRange verseRange) { | |||
} else { | |||
Dialogs.getInstance().showErrorMsg(R.string.error_occurred); | |||
} | |||
} else { | |||
} | |||
if ((bookmarkDto ==null) || (menuItemId == R.id.add_bookmark)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code style (space before null)
bookUsed = bookmark.getBookUsed(); | ||
} catch (Exception e) { | ||
Log.e(TAG, "Error getting book used", e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please be more specific with exception. Or is there a proper reason for catching everything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed the pattern in other parts of the existing code (e.g in Bookmarks.java)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, ok. This is considered generally bad habit but perhaps Martin has reason for this. At least error is logged properly.
//Book book = currentPageControl.getCurrentBible().getSwordDocumentFacade().getDocumentByInitials(abbrev); | ||
Book book = currentBible.getSwordDocumentFacade().getDocumentByInitials(bookUsed); | ||
if (book != null) { | ||
verseText = swordContentFacade.getPlainText(book, bookmark.getConvertibleVerseRange().getVerseRange(((AbstractPassageBook) book).getVersification())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too long line, could you split? Also, readability could be improved by splitting some of this line into variables.
|
||
String bookUsed = bookmark.getBookUsed(); | ||
if ((bookUsed != null) && (!bookUsed.isEmpty()) && !bookUsed.equals(getCurrentBookUsed())) { | ||
//Book book = currentPageControl.getCurrentBible().getSwordDocumentFacade().getDocumentByInitials(abbrev); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
forgot comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes :-)
String bookUsed = bookmarkControl.getBookmarkBookUsed(item); | ||
if (bookUsed != null && !bookUsed.isEmpty()) { | ||
key += " " + bookUsed; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tabs and spaces mixed in the code. I think the codebase uses tabs and not spaces in indentation. Could you fix that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Check all other files that you have changed too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that though the codebase mostly use tabs as indents, it is not true everywhere (not my edits). If required I can change the indents for all the files I touched to be tabs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. Perhaps @mjdenham can comment on this. If this is the case, all files should be checked at some point and changed such that they are consistently indented everywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tended to use tabs, but I can't insist on it.
int iStart = lastPos < position ? lastPos : position; | ||
int iEnd = lastPos < position ? position : lastPos; | ||
for (int i = iStart; i <= iEnd; i++) { | ||
getListView().setItemChecked(i,true);//isItemChecked(lastPos)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clean up commented out code
@@ -165,7 +165,7 @@ public boolean onPrepareActionMode(ActionMode actionMode, Menu menu) { | |||
// if start verse already bookmarked then enable Delete Bookmark menu item else Add Bookmark | |||
Verse startVerse = getStartVerse(); | |||
boolean isVerseBookmarked = startVerse!=null && bookmarkControl.isBookmarkForKey(startVerse); | |||
menu.findItem(R.id.add_bookmark).setVisible(!isVerseBookmarked); | |||
menu.findItem(R.id.add_bookmark).setVisible(true);//!isVerseBookmarked); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean up commented out code
// final TypedArray a = context.obtainStyledAttributes( | ||
// attrs, R.styleable.TwoLineListItem); | ||
// | ||
// a.recycle(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clean up commented out code. And as everything is commented out here, remove redundant function and in above altenrative constructor signatures replace this(
with super(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a copy of the code in TwoLineListItem; if I change this the original should also be changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, then I guess here you could perhaps inherit this new class from TwoLineListItem? And I think you could consider improving TwoLineListItem code too as I suggested.
@@ -12,6 +12,7 @@ | |||
import net.bible.android.control.page.CurrentBiblePage; | |||
import net.bible.android.control.page.CurrentPageManager; | |||
import net.bible.android.control.page.window.ActiveWindowPageManagerProvider; | |||
import net.bible.android.control.versification.ConvertibleVerseRange; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unused import
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jsmitza thanks for this proposal and the ability to not only make a great suggestion but to also make the commitment to code a solution. For me this is one of the key missing features that currently prevent me from using And Bible. In reality it would be nice if there were separate features for "hilighting" and "bookmarking" but your idea is a fine proposal to at least let bookmarks function as hilights.
Thanks for doing this. I love the idea of refreshing bookmarks. Why do we need to save bookUsed? Bookmarks are not book specific. |
Maybe you could split up the pull request into small parts. Maybe:
Parts 1. and 2. should be fairly small pull requests which I can understand and accept quite quickly. |
Why bookUsed: If you use different translations, you want to see your bookmark in the specific translation/language that you used to bookmark the verse. I read different translations (English, Afrikaans, T4T, etc) and often the specific wording in a specific translation is the one that touches my heart. When I review my bookmarks I want to see each bookmarked verse in the list in the translation that was used. See the screenshot at the beginning as an example. So bookUsed need to be saved. |
Splitting Up: I am willing to do this, but it may not be soon, as I now have to work overtime for a month or so to make a deadline. (Which is why I am also slow to comment). Note that the 4 items listed at the top are the only changes done. Part 2 might actually be more intrusive because it needs the database change. |
Unfortunately making bookmarks book specific would not be something I would easily embrace. There are advantages to the bookmarks following whichever translation you are using. |
Take plenty of time - I do! |
What if Would this cover your reservations? I think b) is the best, but then I need an icon :-) It really is a dealbreaker for me to be able to see the actual history of my past encounters with God. (Often the specific wording of one translation can stand out for me, and I miss out on this if a single translation is used in the list). This is why I took the time to do the work. If you will embrace it if I add a) or b), then I plan to do the extra work. |
I don't want to rush this in. I am not sure about it myself and don't like adding unnecessary complexity into the ui and the code. You could start a thread to discuss this functionality in the And Bible discussion forum if you like. |
Ok, I decided to spend a week-end day to try and split up as Martin suggested. Hope I do this right! I added 5 branches, one for each feature. They can be selected/merged individually as needed.
I hope the above facilitates quicker trying/acceptance of some (if not all) of the changes. |
@jsmitza Can you create a new pull request out of each branch and then close this one? |
Hi, I love and-bible! I propose the following changes that will enhance the bookmark side with minimal GUI changes:
Note that the above require a change to the bookmark db table. In my tests it upgrades correctly (i.e. if you save bookmarks beforehand and then restore afterwards).
Regards
Jacques