I'm using Camera Plus with Nativescript Vue. The camera preview is very zoomed in, but when I take a photo it comes out normal. This only happens on Android.
Anyone out there who have experience with this plugin and knows what the issue might be? Is there a way to control the zoom?
I have also noticed if I set the height of the preview to around 300, it's not zoomed in, but the higher the height, the more zoomed in it gets.
My implementation:
app.js
import Camera from './components/Camera';
const CameraPlus = require("#nstudio/nativescript-camera-plus");
Vue.registerElement('CameraPlus', () => CameraPlus.CameraPlus);
const app = new Vue({
template: `
<Frame>
<Camera />
</Frame>`,
components: {
Camera,
},
});
app.$start();
camera.vue
<template lang="html">
<Page>
<CameraPlus></CameraPlus>
</Page>
</template>
Tested on Android 9 and 10 with Camera Plus v3.0.7
Indeed, I registered this issue here.
This is actualy due to the Android's native implementation used by nativescript-camera-plus. It's named FancyCamera and developed in Kotlin language. Since new release 3.1.0 of CameraPlus uses new FancyCamera version as well, which has a new implementation using new Android camerax library (for android api 21+). With theat, the new plugin has the zoom issue is fixed.
However, at the moment I'm writing, the new implementation has bugs, which I'm tryingto fix, as explained here. Help is welcome.
Related
I'm building an application on Nativescript-vue where I'm using webview to play HTML5 video player in it. I want this video player to go fullscreen but I'm to able to see any controls, I did some research and I came to know that it I need to give permission for fullscreen.
<WebView #loaded="onWebViewLoaded($event)" :src="url_to_be_fetched" />
In my webview I required local storage access also which I overcome by:
onWebViewLoaded(args) {
console.log('check on load');
const webView = args.object;
if (webView.android) {
webView.android.getSettings().setDomStorageEnabled(true);
webView.android.getSettings().setDatabaseEnabled(true);
}
},
I came across the same issue but with angular AllowFullScreen in webview nativescript (angular)
I'm not sure how to implement in my vue app. I'm sure there must be some way out to it. Help me out, Thanks.
My app can have only one language, and it should be aligned RTL.
Currently when I run my app with tns preview the ActionBar labels appears in the left (instead of the right) and so on with any other widget.
I have found some localization plugins but not sure I need them for my case - since I have only one language and text direction.
I have been through all GitHub issues related to RTL but I'm still not sure how to work it out. Any idea how I can force my app and change the layout for RTL language?
You may set the layout direction to RTL at runtime, this would not only update ActionBar but any layout in app will be forced for RTL.
import * as app from 'tns-core-modules/application';
app.android.addEventListener(app.AndroidApplication.activityCreatedEvent, (event: app.AndroidActivityEventData) => {
event.activity.getWindow().getDecorView().setLayoutDirection(android.view.View.LAYOUT_DIRECTION_RTL);
});
Playground Sample
I was thinking of a small layout that slides up from the bottom of the
page and disappears after sometime.
There is this plugin I've worked on for the Material Design Snackbar: https://github.com/bradmartin/nativescript-snackbar
There is also the Toast plugin: https://github.com/TobiasHennig/nativescript-toast at one time the plugin dropped iOS support but it looks like a recent contribution was made to fix the iOS version. Since there is not a native toast for iOS from apple, this plugin uses a cocoapod for that platform it looks like.
If you wanted to use your own visuals you could always create a layout that's positioned off the screen using the translate (x) or (y) and then animate it into the view when you want and out after a set time. The possibilites are limitless really.
How to access camera in nativescript without opening camera activity?
I used following code but it is opening device camera application. And I am expecting it should take picture without opening camera, or add camera view in application itself like whatsapp web scan.
import cameraModule = require("camera");
import imageModule = require("ui/image");
cameraModule.takePicture().then(picture => {
console.log("Result is an image source instance");
var image = new imageModule.Image();
image.imageSource = picture;
});
The "camera" module of NativeScript is an abstraction for the OS specific camera module which is why it opens that native interface.
In order to open a custom "nested" camera view a custom implementation would be required. Here comes the power of NativeScript and more specifically its plugin extensibility. You can either write such plugin yourself or looks for an existing one. As the idea of "nested" camera UI is very specific and would probably rely on app specific styles I was not able to find such existing plugin. Here for example you can see how something like this would be implemented in native Android, the same is probably possible in iOS also.
I tried creating a Chart in Xamarin.Forms but I wasn't able to show it. I also want to know where am I gonna put this code. Is it in .xaml or in .xaml.cs?
I'm just a beginner in using Xamarin so maybe someone can help me.
This is the code that I to use.
using BarChart;
...
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
var data = new [] { 1f, 2f, 4f, 8f, 16f, 32f };
var chart = new BarChartView (this) {
ItemsSource = Array.ConvertAll (data, v => new BarModel { Value = v })
};
AddContentView (chart, new ViewGroup.LayoutParams (
ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent));
}
There isn't really any Charting Control that comes with Xamarin.Forms. Syncfusion which offers great Charting Controls for Xamarin.Forms come with a community license which offers them for free.
Here is a full example by Xamarin using SyncFusion Chart Controls
I presume this code is in your mainactivty right now, but when working with Xamarin Forms the UI portion is not create there. It is created in the Shared code.
If you really want to use Xamarin forms I would recommend the following steps:
First follow this to get started with and understanding how to use Xamarin Forms : https://developer.xamarin.com/guides/xamarin-forms/getting-started/introduction-to-xamarin-forms/
And then Oxyplot (this is a charting libary for Xamarin Forms): https://github.com/conceptdev/xamarin-forms-samples/tree/master/OxyPlotDemo
Xamarin charts provided by SciChart can be used in Xamarin Forms.
Check out the Xamarin Chart examples here:
While SciChart is a native Xamarin.iOS and Xamarin.Android chart control, it can be used in Xamarin Forms as per this FAQ.
Disclosure: I am the tech lead on the Xamarin Charts project