Created
October 6, 2015 01:19
-
-
Save patrickhammond/393488bef4f786179c17 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
... | |
BarcodeLoggerActivityPermissionsDispatcher.startBarcodeCaptureWithCheck(this); | |
} | |
@NeedsPermission(Manifest.permission.CAMERA) | |
void startBarcodeCapture() { | |
int orientation = WindowManagerHelper.getCurrentAccurateOrientation(this); | |
Intent intent = CaptureActivity.buildIntent(this, orientation); | |
startActivityForResult(intent, REQUEST_CODE_BARCODE_SCAN); | |
overridePendingTransition(R.anim.open_slide_enter, | |
R.anim.open_slide_exit); | |
} | |
@ShowsRationale(Manifest.permission.CAMERA) | |
void showRationaleForCamera() { | |
Toast.makeText(this, "Please?", Toast.LENGTH_LONG).show(); | |
} | |
@DeniedPermission(Manifest.permission.CAMERA) | |
void showDeniedForCamera() { | |
Toast.makeText(this, "I need to see!", Toast.LENGTH_LONG).show(); | |
} | |
@Override | |
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | |
super.onRequestPermissionsResult(requestCode, permissions, grantResults); | |
BarcodeLoggerActivityPermissionsDispatcher.onRequestPermissionsResult(this, requestCode, grantResults); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment