Webview alternatives? - appcelerator

So, I am developing an application that uses 2-3 WebView, and the performance hit when the user open them is huge: I can't remove them and use native views to show the data because it was requested to use a WebView, so I was looking for a way to embed a page that was less performance hungry.
Thanks for the help ;)
Example:
webview.xml
<Alloy>
<Window id="webview">
<WebView id="dynamicWebView" />
</Window>
</Alloy>
webview.js
$.dynamicWebView.url = "http://www.stackoverflow.com";
$.webview.open();

There is an alternative called Crosswalk:
https://github.com/UniversalAvenue/TiCrosswalk
it brings the latest Chromium to all Android devices (even older ones that don't use the external WebView component). But I'm not sure if that brings you some memory advantages since it's still a webview. But give it a try!

Related

How to implement map navigation system inside Xamarin Forms app?

I am developing an app like Ola and Uber which will have navigation system and live tracking inside my Xamarin Forms app (For Android and iOS both platforms). So, can anyone please tell me the way to open the navigation map inside the app?
If you are trying develop an app like Ola/Uber which will have navigation system and live tracking inside the app, then you don't need to open the navigation map inside the app. You just need to display it on the page.
You can follow the official Xamarin.Forms documentation here, to add maps into your Xamarin Forms app. There's a full fledged map sample that you can also see to understand what needs to be done, but your XAML will look something like this:
<ContentPage ...
xmlns:maps="clr-namespace:Xamarin.Forms.Maps;assembly=Xamarin.Forms.Maps">
...
<maps:Map x:Name="map" />
...
</ContentPage>
The 3 dots indicate other controls you would like to add into the page and the layout that you have to put the Map control inside.
In fact you can also take a look at the sample code of several apps (RunAway, YellowClone, SmartHotel, BikeSharing, Movies, Evolve) in Javier Suarez's Good Looking UI curated collection.

Applying animation in xamarin.forms

Is there any way I can implement the animation like
https://codemyui.com/circular-water-fill-loading-animation/ in Xamarin.forms?
Is there any way I can implement the animation like ...
The short answer is; Yes.
The longer answer; It depends upon what you really need, only you can answer that.
A "quick way" (at least for me) is to use the Xamarin.Forms' WebView and embed the html/svg/css/JScript into native application projects and setup a javascript interface to control the percentage completion (the water.style.transform element).
https://developer.xamarin.com/samples/xamarin-forms/WorkingWithWebview/
You could, of course, re-implement it using something like SkiaSharp, Lottie, etc and create a cross-platform Forms' control, or implement it as a "native" control on each platform.
Note: I'm a big fan of Lottie and would personally take that approach, but they do not support native UWP. Currently supported is iOS, Android, Web.
I edited the colors, etc. on that PEN sample you linked to and added the html/js/css to a Forms' solution, setup a JS interface and the results work in a Forms' WebView (iOS' UIWebView and Android's WebView, did not test UWP Edge, but it should work fine):
The Lottie is my preferred, but you can use a animation with the Nuget XamAnimation. It most hard to create but it's so good too.

How to set CommandBar under SplitView?

I'm developing an application for Windows 10 Platform.
While developing this application, I ran into an issue where CommandBar is above SplitView.
How do I set CommandBar under SplitView under controls on the page?
IMPROVED
Due to I was making for my own app, here is the study and solution I elaborate here: http://bit.ly/1L6EZ00. It involves changes in many parts and I think it looks cool.
Old, in case you just need only that:
That is most similar behavior like the photos app that I have been capable to achieve (it is like the lottery testing):
<Page.TopAppBar >
<CommandBar Margin="48,0,0,0" >
<CommandBar.PrimaryCommands>
<AppBarButton Icon="Globe" Label="Quick Launch" Command="{Binding QuickLaunch}">
</AppBarButton>
</CommandBar.PrimaryCommands>
</CommandBar>
</Page.TopAppBar>
Now the splitview:
<SplitView x:Name="Splitter" Margin="0,-48,0,0" CompactPaneLength="48" OpenPaneLength="240" ...
then pane as usual and the content, for instance:
<SemanticZoom Margin="0,48,0,0">
It is not exactly the same as the Photos apps and I am using the 10166 SDK so I think it is the most accurate option.

Webview inside Flipview not working properly

i am trying to get Webview inside Flipview, so as usual it will be something like this :
<flipview>
<flipview.itemtemplate>
<datatemplate><webview name="wv" /> </datatemplate>
</flipview.itemtemplate>
</flipview>
I would like to use wv.navigatetostring(htmlstring);
The problem now is, when i navigate through items, sometime the webview is updated, sometime its not. Any Suggestion?
Theoretically it is possible to use WebView inside FlipView, but you should be aware of several limitations of this component. There is a well known issue when using the WebView - it's rendered on top of everything so the swiping using touch between FlipView items might not be possible.
Nice article every developer should know before using WebView in Windows 8 application:
Ten Things You Need to Know About WebView

WebView slow loading

In a cocoa / Mac app I am using a WebView to load a series of YouTube videos (5). When it is loading my whole application locks up for 5 seconds or so.
Is there a way I can load it so it doesn't freeze the rest of the application?
Thanks
eg:
[[webView mainFrame] loadHTMLString:html baseURL:[NSURL URLWithString:#"http://youtube.com"]];
Unfortunately, you cannot render a WebView except on the main thread. This is a basic limitation of the class. I would begin investigating why your page takes so long to render. My hunch: Javascript or a plugin.
I usually like to start by using Safari to see if it has the same issues. You can drag an HTML file onto Safari to load it easily. If Safari shows the same problem, then you can use Safari's Develop tools to profile it. (Preferences, Advanced, Show Develop menu in menu bar.)
If Safari doesn't have a problem, that's actually good, because it means your problem is definitely solvable (if Safari can do it, you should be able to achieve the same thing). Here are some things to try out:
Instruments. Try to see what WebView is taking its time on. Focus first on "all samples" for the main thread. This is usually what leads to the app hanging.
Simplification. Try stripping things out of the webview, especially javascript, until you find the piece that's causing the problem.
Implement the WebResourceLoadDelegate methods to see what piece seems to be causing the problem. The information given by this can be misleading, since it has to do with when things are downloaded, not when they are rendered, but it can give a sense of where in the page you're hanging.

Resources