Skip to content

Instantly share code, notes, and snippets.

@masudias
Created April 5, 2018 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masudias/3f3b142b041b2dd2b33c6f114af57575 to your computer and use it in GitHub Desktop.
Save masudias/3f3b142b041b2dd2b33c6f114af57575 to your computer and use it in GitHub Desktop.
import com.google.android.gms.vision.MultiProcessor;
import com.google.android.gms.vision.Tracker;
import com.google.android.gms.vision.barcode.Barcode;
/**
* Factory for creating a tracker and associated graphic to be associated with a new barcode. The
* multi-processor uses this factory to create barcode trackers as needed -- one for each barcode.
*/
class BarcodeTrackerFactory implements MultiProcessor.Factory<Barcode> {
private BarcodeGraphicTracker.BarcodeDetectorListener mDetectorListener;
BarcodeTrackerFactory(BarcodeGraphicTracker.BarcodeDetectorListener detectorListener) {
mDetectorListener = detectorListener;
}
@Override
public Tracker<Barcode> create(Barcode barcode) {
BarcodeGraphicTracker graphicTracker = new BarcodeGraphicTracker();
if (mDetectorListener != null)
graphicTracker.setDetectorListener(mDetectorListener);
return graphicTracker;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment