public class BarcodeCaptureFragment
extends Fragment
implements android.view.View.OnTouchListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
BarcodeCaptureFragment.BarcodeScanningListener |
| Constructor and Description |
|---|
BarcodeCaptureFragment() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
initiateCamera()
Make sure you have camera permissions before calling this
|
static BarcodeCaptureFragment |
instantiate(MVBarcodeScanner.ScanningMode mode,
CameraSourcePreview.PreviewScaleType scaleType,
int... formats) |
static BarcodeCaptureFragment |
instantiate(MVBarcodeScanner.ScanningMode mode,
int... formats) |
void |
onAttach(android.content.Context context) |
protected void |
onBarcodeDetected(Barcode barcode) |
void |
onCreate(android.os.Bundle savedInstanceState) |
android.view.View |
onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState) |
void |
onDestroy() |
void |
onPause() |
void |
onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults)
Callback for the result from requesting permissions.
|
void |
onResume() |
protected boolean |
onTap(float rawX,
float rawY)
onTap is called to capture the oldest barcode currently detected and
return it to the caller.
|
boolean |
onTouch(android.view.View v,
android.view.MotionEvent event)
Called when a touch event is dispatched to a view.
|
protected void |
releaseCamera()
Releases the resources associated with the camera source, the associated detectors, and the
rest of the processing pipeline.
|
void |
setListener(BarcodeCaptureFragment.BarcodeScanningListener listener) |
protected void |
stopCamera()
Stops the camera.
|
public static BarcodeCaptureFragment instantiate(MVBarcodeScanner.ScanningMode mode, int... formats)
public static BarcodeCaptureFragment instantiate(MVBarcodeScanner.ScanningMode mode, CameraSourcePreview.PreviewScaleType scaleType, int... formats)
public void setListener(BarcodeCaptureFragment.BarcodeScanningListener listener)
public void onCreate(android.os.Bundle savedInstanceState)
public android.view.View onCreateView(android.view.LayoutInflater inflater,
android.view.ViewGroup container,
android.os.Bundle savedInstanceState)
public void onResume()
protected void initiateCamera()
protected void stopCamera()
protected void releaseCamera()
public void onPause()
public void onDestroy()
public void onRequestPermissionsResult(int requestCode,
java.lang.String[] permissions,
int[] grantResults)
#requestPermissions(String[], int).
Note: It is possible that the permissions request interaction with the user is interrupted. In this case you will receive empty permissions and results arrays which should be treated as a cancellation.
requestCode - The request code passed in #requestPermissions(String[], int).permissions - The requested permissions. Never null.grantResults - The grant results for the corresponding permissions
which is either PackageManager.PERMISSION_GRANTED
or PackageManager.PERMISSION_DENIED. Never null.#requestPermissions(String[], int)public void onAttach(android.content.Context context)
public boolean onTouch(android.view.View v,
android.view.MotionEvent event)
onTouch in interface android.view.View.OnTouchListenerv - The view the touch event has been dispatched to.event - The MotionEvent object containing full information about
the event.protected boolean onTap(float rawX,
float rawY)
rawX - - the raw position of the taprawY - - the raw position of the tap.protected void onBarcodeDetected(Barcode barcode)