Android WebView: Display only half of a webpage - java

Currently I have a HTML page with a container containing element A on the left side and element B on the right side. I'm trying to view this page using ViewPager with two tabs ie. have only half of the webpage displayed on Tab1 and the other half on Tab2. This makes it so that even if the user chooses to scroll all the way on Tab1, he can never see the content on the right side unless he swipes to Tab2. The size can be determined by 0-50% and 51% - 100% horizontally if possible.
Any idea how this can be implemented?

Android webview is a kind of browser, it will behave the same as another bowser is doing for showing webpage, as per your requirement ask your Web development team to make it browser compatible, and check their output in Chrome, Firefox browser in your device then integrate into Android Webview.

Related

Webview loads url and then this image

I am trying to open in Webview webpages in same quality as it apears in normal browser. It is ok in most cases, but found one "special" url. Urls loads ok, but then after like 2 secons whole pageview is white with picture of play icon in circle. I can not click on it, just nothing. If I open this website in chrome and other browsers everything is just fine. Im not sure if it is not some kind of javascript, but JS is allowed in Webview.
Website is : https://www.auto.cz/volkswagen-polo-gti-zmena-jako-remen-87481
Image that appears is: https://ibb.co/yh7XPpJ
I have tried a lot of Webview settings but nothing helps. I thing it is causing small javascript ad which will pops-up in bottomside of page when url is opened in phone.
WebSettings wsett = webviewVariable.getSettings();
wsett.setJavaScriptEnabled(true);
wsett.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
wsett.setDomStorageEnabled(true);
wsett.setDatabaseEnabled(true);
wsett.setMinimumFontSize(1);
wsett.setMinimumLogicalFontSize(1);
wsett.setBuiltInZoomControls(true);
wsett.setDisplayZoomControls(false);
wsett.setAppCacheEnabled(true);
webviewVariable.loadUrl(url);
I would like to know what settings is missing.

Elements on Upper part of WebPages goes behind the screen or Disappear from Screen while running Selenium Tests

I am using Selenium web driver with Java in test automation framework of WebApplication which is portlet based using Java.My workflow is...
On Wizard Page-1: a container available having 2-3 input/edit boxes, some dropdown list(using Select class) and few buttons. That is like Wizard. After entering all required data on wizard of page-1. then click to Next button to navigate to Wizard Page-2.
On Wizard Page-2: First option is dropdown list where we use Select class i.e. selectByValue/selectByIndex etc.But during of after this action,application showed like scrolling up. But when we observed, actually it hides the first line of all webelements on Page-2.
I am sharing the screenshots for problem. Shared two images are, one is before action or real screen and second one is which hides few web element after the action.
image can be accessed: https://drive.google.com/open?id=0By2IDRpIvYf7SnphOVB4R1N3aTg

GWT load fragments after application start

I am creating an app in GWT, and I just recently implemented code splitting there. I reduced the application size from 1.1MB to 570kB which is nice, so the startup time of the application is now faster (we are using special server where 500kB really matters... not important for my question though ...). After the application starts (in other words user can see login page, can login and use basic parts of the app), I would like to download the rest of the fragments.
I know the fragment will be downloaded when the code in the fragment is needed. But one of the fragments is about 300kB. So when I click in the menu of my app on an item, that causes this fragment to be downloaded, there is a very noticeable delay (1 - 2s), before the user gets a response.
Now I understand that this will most likely happen only once and then the fragment will be cached for like a year, so it will load faster next time. But for example when I try it again on another device, I will have to download fragment for the first time again.
I just need to be sure, that when user launches my app on a phone/tablet using wifi, then disconnects from the wifi or gets out of its range, he will still be able to launch the code in the fragments, even if he didn't launch the things that cause downloading them while he was still connected to the server.
Now he would have to open 3 menu items, to download all the fragments which is annoying.
So in short:
I want my initial download to stay 570kB, and download the rest of the app as soon as possible on the background (if possible).
EDIT:
I found http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html#sequence where you can setup initial loading sequence, so I guess it is what I am looking for. Not sure though if they are loaded asynchronously, because the login screen appears after the fragments are downloaded.
You can cause all fragments to be downloaded after the login panel is rendered. Simply call some method inside the rest of the code - it does not need to do something visible.
Also, if you plan to load all code this way, you only need to split one fragment - your entry point with the login panel. Each split point (a) slightly increases the overall size of the application, and (b) increases, sometimes significantly, the size of the leftover fragment which still needs to be loaded for the first fragment to show up. Thus, there is no point in having more than the initial fragment and the rest of the app, given your requirements.

Prevent Android Webview to show blank screen while navigating

I created an Android WebView app. Right now, I am facing 1-2 seconds of blank screen when navigate between pages. I cache all the resource (js, css, html), but it still show me the blank screen for few hundred milliseconds. It is very quick, but the blank screen still noticeable.
Is there any way to skip or hold the transition screen? Like prevent the page to refresh until all DOM and resources are fully loaded.
Make it into a single-page app!
Control the transitions yourself with AJAX (or an framework that abstracts it).
This way you can load the site content and only update it when it is done loading (or add your own loader animation)

Java Applets vs Back Button

I noticed that if you're playing a song at http://listen.grooveshark.com/ and you hit the back button Flash is smart enough to keep on playing the music while navigating "back" inside the Flash application.
Is it possible to implement this sort of thing using Java Applets, or do Applets alway shut down when you navigate away from the page (even though the resulting page contains the same applet)?
Looks like grooveshark is being tricky with the URL fragment. They store the search after the # fragment delimiter in the URL, e.g. do a search for ween, and you get this URL
http://listen.grooveshark.com/#/search/songs/?query=ween
Then do a search for bungle and the URL changes to
http://listen.grooveshark.com/#/search/songs/?query=bungle
If you click the back button in your browser, the URL changes to the previous "ween" one, but the browser remains on the same page, because everything before the fragment identifier is the same. There's some javascript that's detecting the changed fragment and updating the UI accordingly.
You could probably do something like this with an applet, but it seems better suited to javascript. The good news is, your applet is going to be cached by the browser, so if you do switch to a different page the applet loading will happen quickly.
http://java.sun.com/docs/books/tutorial/deployment/applet/lifeCycle.html
When the user leaves the page, for
example, to go to another page, the
browser stops and destroys the applet.
The state of the applet is not
preserved. When the user returns to
the page, the browser intializes and
starts a new instance of the applet.
That being said, what you could do is save the state to the server when the applet is stopped and then restore the state from the server when it starts again. If you make it a signed applet it should be able to save the state locally.

Categories

Resources