Crosswalk (xwalk) pull to refresh not working - android

I'm using Crosswalk (XwalkView) instead of the default Webview on Android but it seems that the defalt pull-to-refresh functionality doesn't work on Android 4.3. I've tested it on 5.0 and it's ok, but on 4.3 and 4.2.2 it doesn't work. I'm guessing it has to do with < 5.0 ?!
I've tried something like this to enable it, but it failed to work:
//Disable the edge effect and try to enable pull to refresh in case we're using xwalk webviews
if (BuildConfig.IS_XWALK) {
final String INIT_SWITCHES[] = {"Xwalk", "--enable-pull-to-refresh-effect", "--disable-overscroll-edge-effect"};
if (!CommandLine.isInitialized()) {
CommandLine.init(INIT_SWITCHES);
}
}
Any ideas ?

Actually, we already have a JIRA about this feature, please track it here: https://crosswalk-project.org/jira/browse/XWALK-6277.
It has some block issue before, but we will continue investigating how to implement it.

Related

Android webview can't draw canvas after chrome updated to 76+

My webview has drawing functionality inside a canvas which was working fine. But after upgradation of Chrome it stopped drawing inside canvas. I have a work around, by setting hardware acceleration true it works perfectly, but issue is my app's memory consumption increased rapidly. Is there any solution of this problem?
I am using Cordova for cross platform.
Well, I don't know about Cordova, but I think this can also help you. I found that the key to solving the HTML5 canvas issue in Android webview is within AndroidManifest.xml. What did I have to do? I kept the strategy of using a hybrid (custom) webview, because as I develop in Xamarin Forms for both iOS and Android, I needed the same solution on both platforms. On Android I did:
// Java (or similar [laughs])
// Enable hardware acceleration using code (>= level 19)
if (Build.VERSION.SDK_INT >= 19) {
yourWebviewObj.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
yourWebviewObj.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
yourSettingsObj.setRenderPriority(WebSettings.RenderPriority.HIGH);
yourSettingsObj.setCacheMode(WebSettings.LOAD_NO_CACHE);
// Xamarin for Android
// Enable hardware acceleration using code (>= level 19)
if (Build.VERSION.SdkInt >= 19)
{
yourWebviewObj.SetLayerType (LayerType.Hardware, null);
}
else
{
yourWebviewObj.SetLayerType (LayerType.Software, null);
}
yourWebviewObj.Settings.SetRenderPriority(WebSettings.RenderPriority.High);
yourWebviewObj.Settings.CacheMode = CacheModes.NoCache;
And finally, within AndroidManifest.xml find for android:handwareAccelerated="false" and you can change the value from false to true. This tip (additionally) works for both the Java universe and Xamarin.
Had another person with the same problem at Android WebView with layer_type_software not showing HTML5 canvas content where I also posted the same solution. Sorry if my help was not enough, but today I develop applications using Xamarin. Anyway I believe that following this path will help you.

Google has changed Linkify implementation with custom links in Android 5

We've got some custom links in our application that look like that bar.foo://var?parameter=value
Prior Android 5.0.0 bar.foo was not recognised as a link. However in Android 5.0.0 it is recognized as a link and Android will try to open it in the default browser if you click anywhere on bar.foo:. If you however click on //var?parameter=value it will treat it as a customized link and do the stuff that is intended.
Is there any way to prevent this?
This is our Linkify related code:
Linkify.addLinks(this, Linkify.WEB_URLS); // This one is causing the issue. Unfortunately we can't disable it
for (final Pattern pattern : linkPatterns) {
Linkify.addLinks(this, pattern, linkPrefix);
}

Phonegap window.open does not work on Android

I have an iOS/Android app built on cordova 2.6 and jqm 1.3. I need to open a link to an external website after the user clicks on a button. The code I am using is:
var ref = window.open('http://google.com','_self','location=yes');
ref.addEventListener('loadstart',function(event) {
console.log('load started');
});
ref.addEventListener('loadstop',function(event) {
console.log('load stopped');
});
ref.addEventListener('loaderror',function(event) {
console.log('load error = ' + JSON.stringify(event));
});
On iOS everything performs like I would expect. A new browser window opens with the google website loaded. But I cannot get anything to to load in Android. When I click on the button, nothing happens. I have put in console statements before and after the window.open, so I know the code is at least being executed.
My config.xml should be wide open for white listed sites:
<access origin=".*"/>;
I have tested on a Nexus 7 (android 4.2) and an android 2.2 emulator with the same results on both.
Does anyone know why window.open would not be firing correctly on android?
It looked like it was a problem with 2.6 loading plugins on Android. I upgraded to 2.7 and everything started to work.
Perhaps it's a solution to use the ChildBrowser plugin? This gives you a bit more control over the operation itself, while still preserving platform compatibility between iOS and Android.
In most cases, I use something like the following snippet to use the childbrowser to display an external page.
function openBrowser(url) {
// determine if the childbrowser plugin is available
var useChildBrowser = ('plugins' in window && window.plugins.childBrowser);
if (useChildBrowser) {
popup = window.plugins.childBrowser;
popup.showWebPage(url, { showLocationBar: false, showAddress: false });
} else {
popup = window.open(url, 'Share', "['width=600px', 'height=400px', 'resizable=0', 'fullscreen=yes']");
}
}
Note that this falls back to using window.open if the ChildBrowser plugin isn't available, so you won't break anything else with this. Could be worth a shot, perhaps?

SlidingMenu and ViewPager with API13 (Honeycomb)

I´m experiencing a weird problem with SlidingMenu Library and ViewPager when they are running on devices with Android 3.2 (Honeycomb).
The problem appears when we "toggle" the SlidingMenu to show the Menu that is hidden on the left of the app. When we do this, both ContentView and BehingContentView stops responding to touch events.
Thinking that this was a problem related to my application, I downloaded the last version of ABS and SlidingMenu library and configured a new project using the built-in example that comes with the SlidingMenu and, for my surprise, the same behavior occurred with the ViewPager example.
These are the steps that I did:
Configure an Emulator using API Level 13 and 7" WSVGA (Tablet);
Download ABS and SlidingMenu from GIT;
Setup a new Project, using the compatibility library android-support-v41 (Also tested with android-support-v4);
Solved the problem 'getSupportActionBar() is undefined' as described here: https://github.com/jfeinstein10/SlidingMenu/issues/145;
Run the 'Example Application' and choose 'ViewPager' example;
Swipe pages to the right and to the left, without opening the menu;
Open the menu. See that the lists don´t scroll as expected;
Close the menu. See that the viewpager doesn´t responds to touch events anymore;
Notice that this behavior was reported only on Android 3.2 devices. We have the same application running on 2.x and on 4.x devices, without this problem.
Also, noticed that the Example Application that was downloaded from Google Play doesn´t have this problem.
Does anybody have any advice? Thanks a lot!
Edit 1
Tested on a real device, and confirmed the Behavior. Does anybody have an advice?
I had the same problem and fixed it by using the following work-around.
Replace these lines in SlidingMenu.java:
#TargetApi(Build.VERSION_CODES.HONEYCOMB)
public void manageLayers(float percentOpen) {
if (Build.VERSION.SDK_INT < 11) return;
with:
#TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public void manageLayers(float percentOpen) {
if (Build.VERSION.SDK_INT < 14) return;

Android:cannot make a selection after WebView search with highlight

Hello I have a bug in my app and I cannot figure it out.
I want to search for text in my WebView and get the found Text highlighted
for Android 1.5-2.3 this works quite well
public void onClick(View v){
webView1.findNext(true);
int i = webView1.findAll(findBox.getText().toString());
try{
Method m = WebView.class.getMethod("setFindIsUp", Boolean.TYPE);
m.invoke(webView1, true);
}catch(Exception ignored){}
}
}
for Android 3.0+ I have to use the JavaScript workaround from here, because Google doesn't support the highlighting of searched text for incomprehensible reasons
And now my Bug: After the search on my WebView I get the highlighted Text, and I can't select the Text anymore. The only fix I could use is the JavaScript workaround in older Android versions, too. But the function runs very slow and it takes about 10 seconds until the text gets highlighted. I Hope someone has a better solution/fix :)
Thank you
I use the same for 3.x then it did not work on 4.0.x.
Yesterday I updated to 4.0.4 and now highlight works again.
So the solution can be found in the 4.0.4 sources.
OK I have found a quite good solution.
Here is a JavaScript code for Highlighting, that runs really fast :) http://4umi.com/web/javascript/hilite.php#thescript
Anyway I don't understand, why I can't selecting text after the of the official Webview search
For Android 3.x I used webview.showFindDialog(stringtofind, true);
use findAllAsync() instead , finAll() is deprecated in API 16;

Categories

Resources