android webview zoom at specific area - java

Is it possible to display a area from a website in webview. without display the whole page.
i have this website http://roosters.gepro-osi.nl/roosters/rooster.php?leerling=116277&type=Leerlingrooster&afdeling=12-13_OVERIG&school=905 .
and i only want to display the table in webview. any help?

Zooming to the right area is a little dirty I think. When the page changes the layout, you'll need to update your app. Also, it might look nice on your screen but ugly on others.
My idea would be to use JavaScript in the context of the loaded page, to manipulate the DOM so only the table is shown (which is a simple <table>). See this question: In Android Webview, am I able to modify a webpage's DOM?
If you can influence the HTML on the page, help yourself and give the desired table an id.

Related

Equivalent/Alternative of HTML <abbr> tag in Android (Java)

If I put the <abbr> tag in an HTML webpage like so in the snippet below, there will be a text WHO, which upon hovering will show its full form World Health Organization in a small box beside it.
<abbr title="World Health Organization">WHO</abbr>
How to replicate the same thing in Android? (I am using Java btw) You may not be able to hover on a mobile device, but can this functionality be replicated on click? If so, how?
For example, I have a paragraph in a TextView like so
HTML is not a programming lang...
I want it so that when the user clicks on the specific word "HTML" its full form should show beside it (In some sort of "floating" box)
Maybe make a small box, position it accordingly and then toggle its visibility on click? I don't know where to start.

Fetching correct news image - JAVA

I am trying to make a small news crawler.
I got every thing working after many tries.
Problem is that approx every HTML news page have more then 50 images.
Many of them are too small. So, i am filtering them simply by checking size.
Only images lager them 200x200 will be taken.
But there are many images on a single page which are large.
and some news articles not have any related image.
Lets take a example -
Link to News - http://timesofindia.indiatimes.com/india/Over-9-3-lakh-TB-patients-in-India-undetected-Report/articleshow/24600851.cms
My code got this image - Image no. 0 http://timesofindia.indiatimes.com/photo/10905539.cms
Image height - 300
Image width - 450
But this image is useless to image topic.
In simple words "How to get correct image dynamically"
I do not want to make code for each website.
A blank image is better then a wrong image.
I would recommend an approach where you identify the proximity of an image based on its position.. so, if an Image comes inside the article its probably an image about the article itself (except for ads which are very wide).
you can findout the source of the image and decide if it should interest you or not. for instance ad images usually come from a different server which doesn't belong to the site. (in your case indiatimes.com).
Consider the alt text. The alt text usually contains either the title completely or some words from the title.
Also, the article does not have any relevant image associated with the title.
I also suggest JSoup:
jsoup: Java HTML Parser
jsoup is a Java library for working with real-world HTML. It provides
a very convenient API for extracting and manipulating data, using the
best of DOM, CSS, and jquery-like methods.
jsoup implements the WHATWG HTML5 specification, and parses HTML to
the same DOM as modern browsers do.
scrape and parse HTML from a URL, file, or string
find and extract data, using DOM traversal or CSS selectors
manipulate the HTML elements, attributes, and text
clean user-submitted content against a safe white-list, to prevent XSS attacks
output tidy HTML

WebView with ViewFlipper w/ one website

I have some html files on my server that are displayed using a WebView. The html files are quite lengthy, meaning they have a lot of text (for example one is a copy of the US Constitution). Instead of letting the user simply scroll down the WebView to display the rest of the HTML file I was wondering if there is some way I could use ViewFlipper to "flip" to the next section of the HTML file's text. Basically what I mean is instead of scrolling, you "flip" the WebView content to view the rest of it. I am not sure if this is even possible and I apologize if what I am trying to do is not clear with my question. I appreciate any help or approaches to take or ideas on how one could do this. Thanks.
I'm using this two library. both are free and opensource.
TurnJs
Booklet
I think this is only possible in case of responsive website's only.
Other websites can't able to scroll because the minimum Desktop resolution screen is 1024 * 768. where as in case of mobile it is as low as 240 * 320 and it goes up to 5 inch , up to 10 inch in case of tablet.

HTML gallery page in Swing with drag-drop functionality

I was asked to write a JDialog separated into left and right panel. The left panel shows a demo HTML template gallery (small sized), and right panel shows series or list of images. I want to make it such that I can drag image on the list and place it on the gallery (or maybe drag out some image from the gallery). The problem is I don't know where to start with this, can anybody give me some idea?
An HTML gallery typically uses JS to do the 'heavy lifting' (I'm guessing it will require a slideshow as well). While Swing components support HTML (to an extent) they do not support JS.
I recommend not trying to render the HTML/JS in the GUI, instead, provide a JList in the GUI of the image+name objects chosen by the user (using JFileChooser). When each image is selected, you can show the 'preferred name' in a JTextField that allows the user to edit it.
Image order can be shown by the order in the list. To change the order, implement Drag'n'Drop. See the Drag and Drop and Data Transfer lesson for more details.
You will probably need a JLabel in the CENTER of the GUI to display the (full size) selected image, and show the order & timing of the slideshow.
Once the user is happy with the image selections, the order, the names & timing. Offer them a button to write all the details to a single directory including the HTML, script & images (easier). Once the HTML is written, invoke Desktop.open(File) to display the finished product to the user.
As to how you do all that, it is really beyond the scope of an answer on SO. You would need to do the tutorial on each part, and come back with more specific questions.

Disabling table structure

I have a comprehensive web application with the use of lots of nested tables.
This app works fine for desktop version / view.
I am in the process of getting it setup for mobile view. Which is nearly done, BUT:
I am using JSP and java to, for example, retrieve search results. All of these are displayed in one row at a time.
I am not able to make this row fit onto a mobile screen, so what I am looking for is a JavaScript function to disable the table structer, and just show the columns underneath each other e.g. - comparable with opera mini MOBILE VIEW, which with the click of a button makes contect fit to any screen size. My web app works fine, except of some tables, such as search results. I do not want to change the JSP, not create new pages - that would be too much work !
All I want is to include a certain JavaScript file if the connected user comes via handheld device (which works) and disable the tables, or make it fit properly to the screen !!
I hope someone is able to come up with a solution, I have tried everything with CSS, and few JavaScript bits (which I am not so familiar with)
I have two seperate CSS files, depending on the medium u conenct with, it chooses the right one.
BUT HOW TO GET RID OF THE TABLE OVERFLOW / that the data will be displayed fine, without having to scroll left and right on a small device, which as u know is very annoying ;) !?!?!?
Best regards
ALEX
Try using an alternative stylesheet:
tr{display:block;}
td{display:inline-block;}
...this should allow cells to float inside their parent row.
Example: http://jsfiddle.net/doktormolle/nu62m/

Categories

Resources