Help from other devs needed - webviews, invalidate() and onConfigurationChanged() - G1 Android Development

What does onConfigurationChanged actually do on a webview? (let me clarify that - I know what it's FOR, and I know how to use it and override it, but what does the guts of the original super.onConfigurationChanged do itself?)
The reason I ask is that I'm having problems in my browser mods (see my sig) related to a new feature I've added where it maintains the zoom level across pages (so you don't zoom out to a comfortable reading level only to have it blatted when you move to the next page on a site). I'm doing this by pulling back getScale and then using the value to setInitialScale on the webview. So, when a new page is loaded, it's initial scale has been set to the zoom level/scale that was being used on the previous page. Net result - user doesn't see zoom level change from page to page. So far so hoopy.
The only problem is that there's an odd bug whereby the subsequent page loads into same horizontal width as the previous page. So, if you are reading a really wide page/site, and browse to a new site which is thinner, then you have a horizontal scroll bar and the columns do not reformat as they should if you've got "Auto fit pages" on in the settings. However, if you zoom in and then out again, the reformatting happens fine and you have a comfortable viewing layout.
Now I would have thought that it was just a case of calling invalidate() on the webview at a pertinent point in order to force a redraw (and if I look at the source code for webview that's precisely what they do when they zoom in/out). But for some reason that doesn't seem to do anything in my app. If I call invalidate after a page has finished loading (which seems the best point for a redraw) nothing happens.
The reason I ask about onConfigurationChanged is that flipping orientation to/from landscape again also resolves the issue. So I'm curious to know what it's doing in there that's relevant above and beyond an invalidate().
I freely confess that I really know naff all about Android - my Browser work has largely consisted of me flinging code against a wall to see what sticks - so would appreciate any help from devs who do actually know their Android stuff.
(as an aside, I wonder if this bug in the webview was the reason why the stock Browser was never built to preserve zoom level from page to page? It was easier to settle for merely irritating behaviour in the browser app rather than resolve the bug in the underlying web rendering implementation!)

Related

Android Web Browser

I am in need of a bit of help.
Currently, I am working on a new project which will introduce a web application site for the Android ( You can check additional progress online, (Only viewable by your Google Android Phone) at http://sk8erandroid.hopto.org/Android/Android )[ My apologies if this is advertising, I do not mean to advertise in any form or fashion, just getting a bit of help]...
Anyway, back to the matter at hand.
The Android browser is pretty complex ( IMO [ In my opinion ] ), and I was wondering if there was a way to detect Portrait / Landscape mode.
I tried
Code:
if(document.height != 430){
alert("Error: Please swap your device to Portrait");
}
It works, however, once thrown out of Landscape mode, and the function is called again, it doesn't seem to work.
I want the Web Apps Market to be only viewable in portrait mode ( due to some code configurations, and mainly due to some CSS style configs which aren't very compatible in Landscape mode ( mainly due to the fact where items and such are placed, and the scaling of the Android Web Browser ).
Anyway, sorry to make such a long post, but, thanks in advance.
Keep in mind that G1 won't be the only android-powered device, and probably the new ones won't have the same resolution as G1, so maybe it's a good idea to rework your web interface.
Anyway, as a user I would like the application to allow me to choose how to view it
Hmm, well, currently, just the Android G1 is supported.
I will add in support for other Devices after the G1 device layout is stable.
As for the view, that will also be added a bit later, but, as for now, my current CSS coding is configured to work only in portrait made under certain view points.
The view of the actual web applications is controlled by the creator of the Web Application, but, the actual Web Market's only support is Portrait mode.
I resolved the issue though, I was just being lazy, so I updated my code, and got it working.

User Interface differences with 6.5

As everyone who has been trying the new ROM (or even looking at the screen captures) knows, the UI has been changed significantly. Since most of the providers don't plan on making 6.5 backwards compatible, this isn't a major problem for most users. We aren't most users: So THANK YOU to our chefs.
Anyway, there are a number of UI changes. Some I've figured out, some I have questions on. I'd love to keep a running list, if that makes sense. I'm also happy to move this post elsewhere or acknowledge someone else's work. (I did search.)
So, here is my list thus far. I'm happy to have links to additional information on any of these topics.
Touch. The touch-based actions feel much better. (I get the impression from reading XDA and other forums that AT&T limited access to some of these touch actions. With the "cooked" rom's, this goes away.) The faster I slide my finger, the faster the scrolling in long pages or lists of contacts. It's not perfect, as I sometimes find myself intending to scroll and getting a click instead. (This is not different from before.) On the browser (and other apps?), flick-scrolling gives you any angle, rather than strickly up/down or left/right. I would like a tutorial for all the touch actions, though.
Home page. This is quite variable. The default seems to be CHome, which has large text/graphic bars for each element on CHome. I like that each gives underlying status when they are the selected bar, and then you can go into them further of course: email, friends, weather, etc. Many of the CHome apps have a scrolling functionality that give you additional access without having to open the underlying application. CHome is modifiable with a special editor, called CHome Editor and located in various locations, depending on the build. This lets you set which bars show up on the list and where they are located. (It would be nice if this linked to the Today settings editor and visa versa.) As usual, there are many home page options, and one more graphical option is Manila2D / TouchFLO2D (possibly a standard option). It also takes some getting used to.
Start list. Rather than a simple list, this is now the hexagonal grid of icons. I've seen a number of people say this is a direct response to the iPhone icon / application list. While it may be easier to view, I don't like the UI and lack of flexibility here. I keep forgetting where things like the Photo Album are. My current ROM has three different places to find "settings" type of tools, and there is no way (that I can see) to move things between groupings and explicitly set what icons I want where.
Internet Explorer has a much better experience - mostly. It operates full screen, and a double-tap will zoom into a readable area. (I think it actually zooms into an underlying html section, which I find comforting.) I don't understand why IE seems to shut down when I have only OK'd out to the home screen (not closed it). Big question: on a web page with a data entry field, why won't the text entry area scroll with my typing? Other question: Should I use a different browser?
FYI: The keyboard map for function keys is different than the default for the AT&T Tilt. This can be fixed by following this thread: http://forum.xda-developers.com/showthread.php?t=334911
Camera: The camera has never been anything to write home about, but it seems to have gotten worse. I see a thread on the main section for the Kaiser that talks about a new camera app that looks a lot like the one that comes with WM6.5 (http://forum.xda-developers.com/showthread.php?t=355587). Question: Is there any chance to improve the the options and operation of the camera?
Feedback welcomed.
Jack Vinson
Phone: 8925 / Kaiser
Current setup:
SPL: 3.29
ROM: RPC_Elite_V9 WWE
Radio: 1.59.46.12
Protocol: 25.89.30.08H

[Q] No bookmarklet support?

I understand that the browser in Windows Phones is based on IE6/7. However, I was under the belief that both IE6 and 7 supported bookmarklets, so I was a bit surprised by the fact that I couldn't open "javascript:" addresses from IE, nor could I open a bookmarklet that I had, well, bookmarked. What gives? Does anyone know if this was removed as a security issue, or whether it will be fixed in Mango?
I wanted to use the Readable bookmarklet or look for another one that could reverse the color scheme on websites so that all the white on the internet wouldn't kill the SAMOLED screen and my eyes.
Yea... the rendering engine is based on ie6/7 not the entire browser codebase. The code could be there, however, for speed and bandwith purposes, it is probably all locked down. Can u use bookmarklets in IE9? If u can, then there is hope for the future of mango which uses extremely similar bits of code and the rendering engine is identical across phone and desktop/laptop browser.
Hope u can get that all to work out for u
Mango does support bookmarklets - apparently not to the extent that the IE9 desktop browser does, but javascript: "addresses" can executed, either from the address bar or from Favorites.
For example, if you're missing the "Forward" menu item, try Favoriting
javascript:history.forward();
(Works for me, at least)

Xoom WebKit CSS position:absolute issues

I have a webpage loaded on my Xoom's Android Browser which has 3 absolutely position div's - a header which is 40px in height and spans the entire width of the page, a left menu 200px in width and a main content section filling the remainder of the page.
Inside the content, a number of <select> controls are present and, when the page is posted back, more <select>'s are added to the content page based on the initial selections.
When the page first loads, I am able to select values from the lists and enter values into text fields, etc. When the page is posted back to the server, I am unable to enter any values into any of the form controls on the page; from text fields to lists.
When I click on a control, a focus rectangle appears around the control but also another artifact appears on the page in the position the control is in the content section but relative to the top left corner of the page.
I believe that it may be this artifact and positioning error that is causing my issue but there seems to be no debugging tools available that allow me to inspect the source of a webpage in the Android Browser.
I've loaded Opera Mobile onto my Xoom and this works without any problems. I attempted to use Firefox but this seemed to buggy. All the usual desktop browsers work without fail. Dolphin does not work on the Xoom.
I guess this indicates a problem with WebKit however I wouldn't even know where to begin to fix this (other than change the CSS position attribute, which I can't).
Can anyone offer any advice as to what I could try? Has anyone experienced anything like this? Unfortunately, I really need to get this working on a tablet - preferably a non-Apple unit.
Thanks in advance,
Kev
Are you writing html or just trying to get a certain site to work?
Haven't really read through the entire thread lol
Did you try to get into debug settings in the Xoom? I don't remember how but you can Google it.
Sent from my PC36100 using XDA App
This is not development. Moved to QA. Good luck with the problem, though.

Can't get Internet Browser to size things reasonably [SOLVED sort of]

I found a great article explaining this problem.
http://www.androidpolice.com/2014/0...-webviews-in-kitkat-probably-not-coming-back/
Basically Text Reflow was removed from KitKat 4.4.
Some companies HTC and Opera re-implemented it on their own. Samsung and many others didn't. Most browsers use the same Android library to view web pages.
The article about even used XDA Forum as an example.
==================================================================================
My original Post
==================================================================================
I have tried SBrowser (Samsung), CM Browser from Google Play, and Chrome.
To my eyes they are all the same core browser (and same issues).
I can't for the life me get text sized reasonably for all sites.
For example default settings for XDA, things are way too tiny. I can tweak XDA to look good and zoom good.
But then sites, like Google.Com searching, are a mess. Huge Text.
And Text gets clipped off in any text boxes you enter data in. Text starts to clip in boxes as soon as you set Scaling Text above 100%.
All 3 Browsers did exactly the same thing. Some have more options but didn't solve it.
I have tried tweaking it many ways (Min Font, Text Scaling etc.).
I want Double Tap on a "column" of text (like an article or a listing posts) and expect it to AutoSize and choose a size that is reasonably readable.
There might be a DPI setting in the phone itself that might help. But that might mess up other apps that now look fine.
The Stock HTC Browser I never had an issue with (which probably has some common code as well from core Android Source).
In fact, I never even had to adjust the default settings (except home URL).
I think I found a browser that finally works.
Opera (not the mini version).
Firefox, chrome, chrome beta, stock, aosp were crap
Dolphin might be ok.
Opera knows how to "wrap text" when zooming (much like how htc does).
You need to turn on wrap text in opera for it to work.
I found a great article explaining this problem.
http://www.androidpolice.com/2014/0...-webviews-in-kitkat-probably-not-coming-back/
Basically Text Reflow was removed from KitKat 4.4.
Some companies HTC and Opera re-implemented it on their own. Samsung and many others didn't. Most browsers use the same Android library to view web pages.
The article about even used XDA Forum as an example.
I updated the Opening post with this info.
I think I finally found a browser that meats or beats HTC.
"Opera Beta" just search for it in Google Play
I have tried
Firefox (no text reflow)
Firefox Nightly (which does add Text Reflow)
Dolphin
Opera
Opera Beta
ASOP (no text reflow at all)
Samsung Stock (no text reflow at all)
Puffin (works like Opera Mini and Renders on Servers) this gives pixelated images and odd alignment issues of text and images.
Next
The ones with no reflow are just a joke. You either need a magnifying glass, eyes of a 14 year old or pan back and forth.
Most of the others that do offer Text Reflow are either slow, or give poor feedback that rendering is done, or misses double taps.
What is amazing about the Opera Beta is you can double tap Zoom with Text Reflow WHILE it's still rendering the initial overview layout. So it's extremely quick to use.
All the others you had to wait before you touched the screen or it would confuse it. Or double render or something would go wrong.
It also gives nice accurate feedback when it's busy rendering and is fast to boot.
It also has a built in Blink Feed/Magazine thing called Discovery that is not as nice as HTC Blink Feed but is better than Samsung Magazine/Flipper thingy.
With Opera Beta combined with Adblockplus, I'm in mobile browsing heaven.

Categories

Resources