AndBible / and-bible

AndBible: Bible Study
https://andbible.org
GNU General Public License v3.0
591 stars 197 forks source link

Differentiate Old/New Testament #2255

Closed GauravCreed closed 2 years ago

GauravCreed commented 2 years ago

@huperniketes

can we differentiate Old Testament and New Testament from "BibleBook" model in book name, chapter and verse selection screen? Thanks (_).

GauravCreed commented 2 years ago

@mjdenham
I want to differentiate these two book testaments in app, is it possible?

Thanks (_)

GauravCreed commented 2 years ago

@mjdenham and @huperniketes

I think we found the solution, but I don't know this is correct or not? val isNewTestament get() = activeWindowPageManagerProvider.activeWindowPageManager.currentVersePage.currentBibleVerse.currentBibleBook.ordinal >= BibleBook.MATT.ordinal

Thanks(_)

timbze commented 2 years ago

@GauravCreed why do you tag random people? People who watch this repository and can help, will help if they have time. I consider it spam to tag random people and am asking you to stop.

I'd say if it works then you probably got it, but I'm not very familiar with that type of code. @tuomas2 might easily know if it's the right practice or not what you've posted, but he sees all issues and will also help when he gets time.

tuomas2 commented 2 years ago

I think we found the solution, but I don't know this is correct or not? val isNewTestament get() = activeWindowPageManagerProvider.activeWindowPageManager.currentVersePage.currentBibleVerse.currentBibleBook.ordinal >= BibleBook.MATT.ordinal

That solution is indeed used in DocumentControl.kt:58.

You could make extension to BibleBook as follows

val BibleBook.isNewTestament get() = this.ordinal >= BibleBook.MATT.ordinal

Then you could use it directly from BibleBook instances:

val book: BibleBook
...
if(book.isNewTestament) {
...
}
GauravCreed commented 2 years ago

Hi @timbze

Sorry for my inconvenient behavior, I will take note for the next time.