Implemented a patch to make GLA load and parse http://lds.org/scriptures url

Discussions around the Android version of the Gospel Library application.
Ryebrye
New Member
Posts: 5
Joined: Sat Feb 26, 2011 8:11 pm

Implemented a patch to make GLA load and parse http://lds.org/scriptures url

Postby Ryebrye » Sat Feb 26, 2011 8:27 pm

What I've done already
I wrote patch yesterday where I implemented a new activity that has an intent filter that listens for http://lds.org/scriptures/ urls and then loads then gives the user the option to load them in GLA instead of viewing them in the browser.

In any case - the basic functionality works (minus the highlighting of the requested verses... which I discuss more below). The activity with the event filters finishes after it launches the scriptureview activity and it doesn't stay in the history stack so a scenario like this works great:

1) you are reading Handbook 2 as a presidency
2) you come to a link
3) you tap that link and GLA comes up with that verse
4) you hit the back button and you go back to the page of the handbook exactly where you were before (albeit now with an empty popup window there since the scriptures are loaded in a popup by default... but that's easy enough to close)

The patch is still a tad messy and I want to clean it up before I submit it - but I will definitely submit the patch in the next little while.

The main reason for this was that my internet connection is slow at church and when I'm reading content that's not in the GLA on the web (such as a teachers manual, or the church handbook, etc) - I would prefer to have it load up in GLA where the content is already preloaded than to have to face a slow network call.

What I'm still wanting to do, but can't seem to figure out how
The functionality of having it pop up the GLA works great - but there's one aspect of it that I'm having a hard time figuring out how to get to work - getting it to use the highlightVerses javascript to highlight the requested verses.

http://lds.org/scriptures/dc-testament/dc/45.3-5?lang=eng#2

translating that to a uri that is used by GLA is pretty easy - the path is a direct translation and the language just gets moved over so it becomes something like this

/en/dc-testament/dc/43.3-5#2

(or if you want to get really technical - it uses file:///android-asset/en/dc-testament/dc/43.3-5#2)

It's easy to parse out ranges and specific verse and construct a list of verses that should be highlighted, and I've already implemented that - but getting the webView to actually highlight them has me stumped.

I can pull up the actual code - but at the end of the loadFromIntent(Intent intent) there is a call to goToMark(<some params>) that uses a webView.loadUrl("javascript:" to call a javascript function.

The way the normal verses that a user has highlighted are handled is in the initial (background) rendering of the view of that chapter from data from the database - but I also saw that after a verse is highlited the first time that a webView.loadUrl("javascript:highlightVerse(".. ) call is made that handles highlighting that newly highlighted verse on the current view - which would be ideal for this kind of transient highlighting...

but... it doesn't work no matter where I seem to call it :( Obviously the view is already loaded since the goToMark calls the javascript method on the page and it works fine - and obviously calling a loadUrl with javascript works (For the same reason - the gotomark method works)

Anyone have any idea where to debug this (or get it to work)?

Additional questions about where / how to post the in-progress patches
Also - what's the best way to post patches like this that are still rough around the edges? (I've gotten too used to git projects where the norm is to just fork the project and send pull requests to the upstream project when you have something that is worth looking at)

DHTreanor
New Member
Posts: 4
Joined: Thu Dec 29, 2011 1:09 pm
Location: USA, Dallas, TX

Postby DHTreanor » Thu Dec 29, 2011 2:03 pm

Just wondering if you've finished the "GLA load and parse http://lds.org/scriptures url" patch you refer to above? I'm trying to figure out how to use a personal scripture list app and refer to the GLA on my Samsung Android device. Thx.

cammorris
New Member
Posts: 1
Joined: Mon Feb 15, 2016 4:28 pm

Re: Implemented a patch to make GLA load and parse http://lds.org/scriptures url

Postby cammorris » Mon Feb 15, 2016 4:30 pm

Yes please! Like. +1. :D :!:


Return to “Android Gospel Library”

Who is online

Users browsing this forum: No registered users and 1 guest