Skip to content

Commit

Permalink
Fixed #37
Browse files Browse the repository at this point in the history
  • Loading branch information
yasirkula committed Jun 19, 2020
1 parent 1d6c5af commit 568859e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions .github/AAR Source (Android)/NativeCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@

public class NativeCamera
{
public static boolean KeepGalleryReferences = false;
public static boolean KeepGalleryReferences = false; // false: if camera app saves a copy of the image/video in Gallery, automatically delete it
public static boolean QuickCapture = true; // true: the Confirm/Delete screen after the capture is skipped
public static boolean UseDefaultCameraApp = true; // false: Intent.createChooser is used to pick the camera app

public static boolean HasCamera( Context context )
{
Expand Down Expand Up @@ -149,4 +151,4 @@ private static boolean CanAccessCamera( Context context, NativeCameraMediaReceiv

return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ else if( imageCursor.getCount() <= 0 )
else if( defaultCamera == 1 )
NativeCameraUtils.SetDefaultCamera( intent, false );

if( getActivity().getPackageManager().queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY ).size() > 0 )
if( NativeCamera.QuickCapture )
intent.putExtra( "android.intent.extra.quickCapture", true );

if( NativeCamera.UseDefaultCameraApp && getActivity().getPackageManager().queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY ).size() > 0 )
startActivityForResult( intent, CAMERA_PICTURE_CODE );
else
startActivityForResult( Intent.createChooser( intent, "" ), CAMERA_PICTURE_CODE );
Expand Down
5 changes: 4 additions & 1 deletion .github/AAR Source (Android)/NativeCameraVideoFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ else if( videoCursor.getCount() <= 0 )
else if( defaultCamera == 1 )
NativeCameraUtils.SetDefaultCamera( intent, false );

if( getActivity().getPackageManager().queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY ).size() > 0 )
if( NativeCamera.QuickCapture )
intent.putExtra( "android.intent.extra.quickCapture", true );

if( NativeCamera.UseDefaultCameraApp && getActivity().getPackageManager().queryIntentActivities( intent, PackageManager.MATCH_DEFAULT_ONLY ).size() > 0 )
startActivityForResult( intent, CAMERA_VIDEO_CODE );
else
startActivityForResult( Intent.createChooser( intent, "" ), CAMERA_VIDEO_CODE );
Expand Down
Binary file modified Plugins/NativeCamera/Android/NativeCamera.aar
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.yasirkula.nativecamera",
"displayName": "Native Camera",
"version": "1.2.2",
"version": "1.2.3",
"description": "This plugin helps you take pictures/record videos natively with your device's camera on Android and iOS. It has built-in support for runtime permissions, as well."
}

0 comments on commit 568859e

Please sign in to comment.