Fast Scroll in Chapter View (MSA-51)

Discussions around the Android version of the Gospel Library application.
Post Reply
User avatar
jackcholt
New Member
Posts: 34
Joined: Mon Nov 23, 2009 8:55 am
Location: Fallbrook, CA, USA

Fast Scroll in Chapter View (MSA-51)

#1

Post by jackcholt »

If you look at Jira for issue MSA-51, you will see that I added some code to allow an option to turn on the standard zoom controls for the webview so we can use them them to fast scroll a chapter. This works well on my G1 in Android 1.6, but on an HTC Hero on 1.5 it shows the button but tapping it doesn't bring up the zoom box. In an emulator running 2.1 I only get the zoom controls with no button for bringing up the zoom box. We may have to come up with a different way of allowing fast scroll that works on all versions.

Can anyone shed any more light on this for me? Any ideas? :confused:
swliddle
New Member
Posts: 17
Joined: Mon Apr 19, 2010 1:53 pm
Location: Orem, UT, USA

#2

Post by swliddle »

jackcholt wrote:If you look at Jira for issue MSA-51, you will see that I added some code to allow an option to turn on the standard zoom controls for the webview so we can use them them to fast scroll a chapter. This works well on my G1 in Android 1.6, but on an HTC Hero on 1.5 it shows the button but tapping it doesn't bring up the zoom box. In an emulator running 2.1 I only get the zoom controls with no button for bringing up the zoom box. We may have to come up with a different way of allowing fast scroll that works on all versions.

Can anyone shed any more light on this for me? Any ideas? :confused:
My Nexus One behaves the same way as the emulator -- only shows -/+ zoom buttons, not a zoom box. Not sure where that went. I can't recall whether I've seen it recently in the 2.1 web browser either.
User avatar
jackcholt
New Member
Posts: 34
Joined: Mon Nov 23, 2009 8:55 am
Location: Fallbrook, CA, USA

#3

Post by jackcholt »

I'm looking into adding a scroll thumb (like supported in ListViews) so we can use that to quickly scroll a chapter. I have already enabled scroll thumbs on the navigation ListViews in Main so it will improve the seemlessness of the app.
User avatar
jackcholt
New Member
Posts: 34
Joined: Mon Nov 23, 2009 8:55 am
Location: Fallbrook, CA, USA

#4

Post by jackcholt »

In the last meeting with Tom Welch, you Steve, mentioned the possibility of using a transparent layer over the webView to accomplish fast scroll. Could you elaborate here?
svella
New Member
Posts: 6
Joined: Sun Apr 18, 2010 3:49 pm
Location: Orem, UT, USA

#5

Post by svella »

Another possibility would be to inject a floating div into the html and do it all on javascript event handlers. Not sure which would be easier, but I'll play with this idea a little bit and let you know.
svella
New Member
Posts: 6
Joined: Sun Apr 18, 2010 3:49 pm
Location: Orem, UT, USA

#6

Post by svella »

I got to playing with it and ended up looking at the source code for how it is done in listview. I ended up copying what they did there and creating a subclass of WebView that supports the fast scroll thumb so that it looks, feels, and behaves pretty much exactly like the ListView. Check it out and let me know what you think.

We might want to take it a little farther and show an overlay with the verse number at the top, like Contacts does with the alphabet.

Also might want to adjust how large a chapter needs to be before it really needs the thumb to display. Right now it will display when the chapter is 4x the height of the viewport or greater (same as ListView), but I think that might be a little too aggressive.
User avatar
jackcholt
New Member
Posts: 34
Joined: Mon Nov 23, 2009 8:55 am
Location: Fallbrook, CA, USA

#7

Post by jackcholt »

Thank you, thank you Shon. That is exactly what I had in mind. I like it because it is consistent with the way fast scroll works in the listView. Which makes the app internally consistent. Always a plus. This should make the brethren happy. This is the kind of technology that companies usually make employees sign NDA's to protect.
swliddle
New Member
Posts: 17
Joined: Mon Apr 19, 2010 1:53 pm
Location: Orem, UT, USA

#8

Post by swliddle »

Looks great! I think this is a very nice feature, and it basically takes the approach I was talking about (creating a transparent overlay).

I did discover an issue on the Nexus One. It turns out that the fast-scroll thumb is too small on hi-res devices, and I guess it's too big on low-res devices. We need to scale the graphics according to the device resolution. But the API's we want are in Android 1.6, not 1.5. So I made a change to WebViewFastScroller.java to use the reflection API to see if we have density information, and if so to scale on devices that don't use the default density.

This also explains what's been happening on verse positioning. See the bug I posted on JIRA for more info. We need to scale our scroll parameters according to the device display density as well. I'll see if I can find some time to figure this out more. ScriptureViewActivity and WebViewFastScroller both need some work to scale scroll positions appropriately.
Post Reply

Return to “Android Gospel Library”