Skip to content

Commit 61ec278

Browse files
committed
Move snackbar msgs to avoid overlapping each other when Camera permission denied
1 parent 58e37ea commit 61ec278

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

visionSamples/ocr-reader/app/src/main/java/com/google/android/gms/samples/vision/ocrreader/OcrCaptureActivity.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,17 @@ public void onCreate(Bundle icicle) {
9797
int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
9898
if (rc == PackageManager.PERMISSION_GRANTED) {
9999
createCameraSource(autoFocus, useFlash);
100+
101+
Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom",
102+
Snackbar.LENGTH_LONG)
103+
.show();
104+
100105
} else {
101106
requestCameraPermission();
102107
}
103108

104109
gestureDetector = new GestureDetector(this, new CaptureGestureListener());
105110
scaleGestureDetector = new ScaleGestureDetector(this, new ScaleListener());
106-
107-
Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom",
108-
Snackbar.LENGTH_LONG)
109-
.show();
110111
}
111112

112113
/**
@@ -267,6 +268,10 @@ public void onRequestPermissionsResult(int requestCode,
267268
boolean autoFocus = getIntent().getBooleanExtra(AutoFocus,false);
268269
boolean useFlash = getIntent().getBooleanExtra(UseFlash, false);
269270
createCameraSource(autoFocus, useFlash);
271+
272+
Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom",
273+
Snackbar.LENGTH_LONG)
274+
.show();
270275
return;
271276
}
272277

0 commit comments

Comments
 (0)