Can't scroll over Google chart on mobile devices [duplicate] - android

Is there a workaround? I am running my own custom scrollbar script as opposed to using the built in browsers functionality. I prefer to use SVG for my image elements for a number of reasons, but one, pretty major pitfall is the fact that touching or mousewheeling over an svg blocks the event and thus brings the page scrolling to a halt. This is even more noticeable on mobile browsers where the svg might take up the entire width of the document in which case as soon as you get to an SVG element, the user is unable to scroll past it.
I haven't tested in IE, but in Chrome, the touch commands dont work on top of SVG, and on Firefox, the mousewheel events are a problem. I assume it will be both on IE haha.
A decent solution would be to somehow add an event to my SVG elements the catches the events and passes them onto the scrolling events. I can't seem to find a way. An even better solution would be to somehow place the document above the SVG so the SVG doesn't interfere with the scrolling at all. Again, can't seem to find a way.
I embed my SVG elements with object tags, which is important for a variety of reasons. I'm assuming the object tag is actually the culprit.

Per Duopixel's comment. Adding:
object {
pointer-events: none;
}
To the css does solve the problem in both Firefox and Chrome. I still have to test in IE, but for now this seems the best and easiest solution.
A good article that explains the pointer events attribute can be found at http://davidwalsh.name/pointer-events
If the issues mentioned above are an issue in IE, you can use a javascript solution that requires capturing the position of the pointer and passing it to the proper element. A working version that uses jQuery but could very easily be translated into vanilla javascript can be found here: http://jsbin.com/uhuto/1/edit

Related

How use XPath with Accessibility Service Android to interact with an element?

There are several articles/tutorials to use Accessibility service on Android to find elements by id/text but there is None (that I could find) which makes use if XPath.
As far as my understanding goes, Accessibility service would take a snapshot of the current ui hierarchy with corresponding attribute and then would search the id/text.
This is significantly slower than having a direct XPath to the element we already have knowledge of - no need to take snapshot of whole ui or search for text in it. (Please correct me if I'm wrong) and can even interact when the item is below the screen; i.e. it has potential to click item when it's not visible yet and will be so after scrolling.
Android does have support of javax.XPath https://android-doc.github.io/reference/javax/xml/xpath/package-summary.html but I couldn't find any sample to try it on.
Any link/resource/guidance will be appreciated. Use of external libraries is fine as well assuming it doesn't hinder performance. Idea is to click an element (I have XPath for it) as soon as it is inflated/rendered in apps making use of some kind of webview element.

Bad Idea to create HTML content in android app?

I'm creating an app that needs to display a table, with say, 30 columns and 30 rows. I want the user to be able to use swiping to move around the table/spreadsheet. The idea is that probably the entire table will not be visible on the screen, and if it is, it will hardly be readable, so there will have to be some max-columns-on-screen value. Each cell in the table must be capable of being a different color than the rest.
So far, I've looked into TableLayout. This doesn't seem to support different colors or swiping... actually, it does support different colors via .xml, but this isn't changeable at run time, and seems like it would be very messy anyway.
WebView looks to be an option, as I am proficient with HTML/CSS but can't find many resources about creating HTML and CSS content on the fly with android - only loading it; although I can imagine writing a file with the data and then loading it, and deleting the file. Not sure if any of this is good performance wise.
What direction should I head, before I start heading in the wrong direction? :-)
Yes, it is possible (and not difficult) to support different colors and gesture in the tablelayout rows.
I think it is always a wiser choice implementing the native components, once it has a better performance and it has a better layout adjust to different android versions.
Either method can solve the problem, so it's a judgment call based on your goals and requirements.
On the plus side for Android native views:
They are pre-compiled and easier to parse than HTML, so they will load faster, scroll more quickly, and require less memory.
If you intend to write a lot of Android apps you will need to learn them.
If you took this route, a typical approach to draw multiple columns would be a ViewPager with sliding tabs. See for example the Google Play Store app.
It's not the case that coloring native views dynamically is impossible or messy; it's not hard at all but it takes time to learn how, which brings me to the plus side for HTML/webview:
A programmer with expertise in HTML will solve problems faster by just using HTML.
Layouts designed in HTML for an Android web view can be re-used on other platforms.
Again, it's not really hard to load dynamic HTML into a web view. There are a few tricks you will need to learn but that's it.

AS3/AIR: Finger-Scrolling a text document embeded within the app

I'm making my first mobile application on Flash/AS3 for both iOS and Android platforms.
It's been months now that I'm working on the project, and as a final step, I'm making a help document to explain to the fellow users how to use the application.
The problem is: The HELP document is an 8 pages long WORD document (also saved in PDF and HTML format), and I dicovered that displaying a local document (embedded within the app), with finger-scrolling enabled, is a harder task than I thought it would be!!
So far, my researches lead to the following solutions (without a 100% satisfaction though):
I. USING StageWebView or StageWebViewBridge:
I tried StageWebViewBridge on AIR Desktop, it works, and the hyperlinks inside the document work too.
But the display of some characters/letters in HTML file are distorted, and pictures are hard to display..
On android, displaying a local file simply didn't work.
On AIR iOS, I haven't tried it yet.
Also, I haven't figured out how to launch a PDF file using these classes.
Displaying local files on iOS and Android using these classes is a nightmare.
II. USING "scrolling" classes:
These classes enables the finger-scrolling of a movieClip containing text and pictures.
a. Free
a1/ airmobile scroll controller:
https://github.com/freshplanet/Air-Mobile-ScrollController
I gave this one a try, and what happenned was interesting:
First this class works, I created a MovieClip with a textField inside of it, I pasted my text, and with the help of this class, I was able to display the movieClip on screen and scroll it.
BUT, creating such a big movieClip (remember: 8 Pages!) created some unexpected issues.
The compiling time became oddly long, and my PC freezes for a few seconds during the compiling step.
The app starts now with a blank screen with 5 blinking tiny dots, and you'll have to wait for a few seconds before you can use the app.
Clearly, the idea of adding to the project library a huge MovieClip with such long text made the app development a nightmare.
Not to mention that pasting my text inside a movieclip textField makes me lose my text formating, my hyperlinks etc..
a2/ Erichlotto AIRScroll:
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
a3/ TouchScrolling:
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
b. With Charge
b1. Creative FLash Scroller
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
b2. AIR AS3 Touch Scroll
I haven't tried it yet, but I guess I will still have the issues related to a hugely-dimensioned movieClip in my library.
It is somehow frustrating that such an easy and common task (displaying a scrollable local document, in-app embedded for offline use) took me a few days of research (and without a definitive way to solve it).
I'm ready to settle with a class that makes a movieclip scrollable, but without the gigantic movieClip height.
Any ideas?
Thank you!
cannot answer this question, as it's too broad and too little detail, but I can give you some suggestions. a) StageWebView should work on iOS and Android with HTML and PDF with local files. Performance may be an issue. If you encounter a problem regarding local files, check if they are loading correctly. Post some code, if you need help there b) You may consider to open the file in an external "native" app as PDF Reader or Polaris Office. But this may require an Native Extension. c) converting into a movieclip seems to be a bad idea. TextField itself is capable of displaying HTML content, with limitations, though. You could consider to change your document to fit the needs of Flash/AIR rather than the other way round. Hope this helps...
To display local embedded files on Android with StageWebView you will have to copy these files from applicationDirectory to applicationStorageDirectory:
Refer to this article/answer:
https://forums.adobe.com/message/3485503#3485503
Since AIR 3.9 there is no other workaround on Android anymore.
There is a feature request here for it - please feel free to vote for it:
https://bugbase.adobe.com/index.cfm?event=bug&id=3832886

Phonegap app running very slow on android

I am making an app for Android using phonegap and jquery mobile. When I use phonegap build and try it on my Galaxy S3 it is very slow and clicks take over a second for anything to happen. I already tried setting the Android SDK version to 14 but that didn't do anything. This is going to be an app that is going to take massive amounts of data from a large server with 50 items being loaded at one time. I heave read around that Phonegap isn't very good for large scale things like this so is there any way to optimize Phonegap for this? or do I just need to just use something else, and if so what is the best thing to use?
For the click issue, checkout fastclick.js (https://github.com/ftlabs/fastclick)
Most mobile webviews have a 300ms click delay to wait for a double click for zooming in on content. Fastclick.js allows you to bypass this.
Additionally for overall performance issues, you should be mindful of the amount of javascript libraries used. I have made a number of application with phonegap that rely heavily on large amounts of external data and found that trimming down on libraries and using my own JS optimized for my exact purposes has worked best.
I use handlebars.js for templating / view display and always use for loops instead of jquery each. There have been studies that show for being up to 1000x faster than each when loading large sets of data. This is because each recursively finds each instance where as for simply iterates through a set of data.
i know this is a bit late but this answer will be for people who are still facing this issue, i faced the same issue a week ago, and ended up finding that the issue wasn't because of:
hardware acceleration
SDK version
nor the phone hardware specs
which might be the reason sometimes for certain cases, but if u're using jquery,
then its peopably because when the android application use the Webview, it doesnt handle the JQuery animation very well, which will result a big performance issue, so what you should do is to replace the JQuery animation with CSS3 animation,
to help more, if you're using the jquery animate() function to do animation, then you can just add the JQuery.transit library after normal JQuery library, and use the [transit] function instead of the [animate] function. no need to modify parameters, just replace the function name and thats all.
you can find the library in this link:
jquery.transit
after using the library you'll notice a huge performance jump, and everything will work smoothly after that.

WebView slow scrolling

For some reason the WebView I am using is quite slow, I don't have to much of a problem with the loading times for web pages, although if there is a way to improve that I would appreciate it. But my main concern is the jagged laggy scrolling. I'm reasonably sure there must be a way to get it working more smoothly, as other apps using (I assume) the WebView don't have this problem. I suppose it may be possible that these other apps are using some private web client although it seems to me very unlikely that all of them would. Others have asked similar questions on SO, but none of the answers are particularly effective.
i think you have this code in your manifests
android:hardwareAccelerated="false"
android:largeHeap="true"
you have to delete if you have it.
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
This work for me.
It's really hard to guess what your problem might be given the amount of information you have provided:
Did you declare that you want software rendering in your application's manifest (or by
setting the WebView's layer type)? Maybe try hardware mode.
What is the page that you're trying to load? Maybe there's tons of CSS/JavaScript going on there? Does a simpler page scroll well?
Which version of Android are you seeing this on, have you tried others? Maybe this is specific to a device?
Is the scroll not smooth (are you not hitting 60fps) or is there a large lag between the finger moving an the page moving? If it's the latter - maybe you have touch handlers slowing things down.
The above is just stuff from the top of my head. There are great articles out there on the topic, such as this one. Also, if you're using the Chromium WebView you can use the profiling tools via remote debugging

Categories

Resources