-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(android): camerax, preview config, photo size, whitebalance, zoom (
#141)
- Loading branch information
Showing
12 changed files
with
1,134 additions
and
482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,32 @@ | ||
import * as observable from '@nativescript/core/data/observable'; | ||
import * as pages from '@nativescript/core/ui/page'; | ||
import { HelloWorldModel } from './main-view-model'; | ||
import {CameraPlus} from '@nstudio/nativescript-camera-plus'; | ||
import {HelloWorldModel} from './main-view-model'; | ||
|
||
// Event handler for Page 'loaded' event attached in main-page.xml | ||
export function pageLoaded(args: observable.EventData) { | ||
// Get the event sender | ||
const page = <pages.Page>args.object; | ||
page.bindingContext = new HelloWorldModel(page); | ||
// Get the event sender | ||
const page = <pages.Page>args.object; | ||
page.bindingContext = new HelloWorldModel(page); | ||
} | ||
|
||
export function camLoaded(args: any) { | ||
console.log(`cam loaded event`); | ||
|
||
try { | ||
const flashMode = args.object.getFlashMode(); | ||
console.log(`flashMode in loaded event = ${flashMode}`); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
const cam = args.object as CameraPlus; | ||
console.log(`cam loaded event`); | ||
const handle = () => { | ||
console.log('sizes', cam.getAvailablePictureSizes('16:9')); | ||
cam.autoFocus = true; | ||
try { | ||
const flashMode = args.object.getFlashMode(); | ||
console.log(`flashMode in loaded event = ${flashMode}`); | ||
} catch (e) { | ||
console.log(e); | ||
} | ||
}; | ||
if (!cam.hasCameraPermission()) { | ||
cam.requestCameraPermissions() | ||
.then(() => handle()); | ||
} else { | ||
handle(); | ||
} | ||
} |
Oops, something went wrong.