@@ -209,7 +209,7 @@ public boolean handleMessage(Message message) {
209209 pause ();
210210 fireState .cameraError (error );
211211 }
212- } else if (message .what == R .id .zxing_camera_closed ) {
212+ } else if (message .what == R .id .zxing_camera_closed ) {
213213 fireState .cameraClosed ();
214214 }
215215 return false ;
@@ -280,11 +280,11 @@ protected void initializeAttributes(AttributeSet attrs) {
280280
281281 // See zxing_attrs.xml for the enum values
282282 int scalingStrategyNumber = styledAttributes .getInteger (R .styleable .zxing_camera_preview_zxing_preview_scaling_strategy , -1 );
283- if (scalingStrategyNumber == 1 ) {
283+ if (scalingStrategyNumber == 1 ) {
284284 previewScalingStrategy = new CenterCropStrategy ();
285- } else if (scalingStrategyNumber == 2 ) {
285+ } else if (scalingStrategyNumber == 2 ) {
286286 previewScalingStrategy = new FitCenterStrategy ();
287- } else if (scalingStrategyNumber == 3 ) {
287+ } else if (scalingStrategyNumber == 3 ) {
288288 previewScalingStrategy = new FitXYStrategy ();
289289 }
290290
@@ -293,14 +293,14 @@ protected void initializeAttributes(AttributeSet attrs) {
293293
294294 private void rotationChanged () {
295295 // Confirm that it did actually change
296- if (isActive () && getDisplayRotation () != openedOrientation ) {
296+ if (isActive () && getDisplayRotation () != openedOrientation ) {
297297 pause ();
298298 resume ();
299299 }
300300 }
301301
302302 private void setupSurfaceView () {
303- if (useTextureView ) {
303+ if (useTextureView ) {
304304 textureView = new TextureView (getContext ());
305305 textureView .setSurfaceTextureListener (surfaceTextureListener ());
306306 addView (textureView );
@@ -431,7 +431,7 @@ private void containerSized(Size containerSize) {
431431 displayConfiguration .setPreviewScalingStrategy (getPreviewScalingStrategy ());
432432 cameraInstance .setDisplayConfiguration (displayConfiguration );
433433 cameraInstance .configureCamera ();
434- if (torchOn ) {
434+ if (torchOn ) {
435435 cameraInstance .setTorch (torchOn );
436436 }
437437 }
@@ -451,14 +451,14 @@ public void setPreviewScalingStrategy(PreviewScalingStrategy previewScalingStrat
451451 * Override this to specify a different preview scaling strategy.
452452 */
453453 public PreviewScalingStrategy getPreviewScalingStrategy () {
454- if (previewScalingStrategy != null ) {
454+ if (previewScalingStrategy != null ) {
455455 return previewScalingStrategy ;
456456 }
457457
458458 // If we are using SurfaceTexture, it is safe to use centerCrop.
459459 // For SurfaceView, it's better to use fitCenter, otherwise the preview may overlap to
460460 // other views.
461- if (textureView != null ) {
461+ if (textureView != null ) {
462462 return new CenterCropStrategy ();
463463 } else {
464464 return new FitCenterStrategy ();
@@ -521,8 +521,8 @@ private void startPreviewIfReady() {
521521 if (currentSurfaceSize != null && previewSize != null && surfaceRect != null ) {
522522 if (surfaceView != null && currentSurfaceSize .equals (new Size (surfaceRect .width (), surfaceRect .height ()))) {
523523 startCameraPreview (new CameraSurface (surfaceView .getHolder ()));
524- } else if (textureView != null && textureView .getSurfaceTexture () != null ) {
525- if (previewSize != null ) {
524+ } else if (textureView != null && textureView .getSurfaceTexture () != null ) {
525+ if (previewSize != null ) {
526526 Matrix transform = calculateTextureTransform (new Size (textureView .getWidth (), textureView .getHeight ()), previewSize );
527527 textureView .setTransform (transform );
528528 }
@@ -539,15 +539,15 @@ private void startPreviewIfReady() {
539539 protected void onLayout (boolean changed , int l , int t , int r , int b ) {
540540 containerSized (new Size (r - l , b - t ));
541541
542- if (surfaceView != null ) {
542+ if (surfaceView != null ) {
543543 if (surfaceRect == null ) {
544544 // Match the container, to reduce the risk of issues. The preview should never be drawn
545545 // while the surface has this size.
546546 surfaceView .layout (0 , 0 , getWidth (), getHeight ());
547547 } else {
548548 surfaceView .layout (surfaceRect .left , surfaceRect .top , surfaceRect .right , surfaceRect .bottom );
549549 }
550- } else if (textureView != null ) {
550+ } else if (textureView != null ) {
551551 textureView .layout (0 , 0 , getWidth (), getHeight ());
552552 }
553553 }
@@ -617,11 +617,11 @@ public void resume() {
617617 // The activity was paused but not stopped, so the surface still exists. Therefore
618618 // surfaceCreated() won't be called, so init the camera here.
619619 startPreviewIfReady ();
620- } else if (surfaceView != null ) {
620+ } else if (surfaceView != null ) {
621621 // Install the callback and wait for surfaceCreated() to init the camera.
622622 surfaceView .getHolder ().addCallback (surfaceCallback );
623- } else if (textureView != null ) {
624- if (textureView .isAvailable ()) {
623+ } else if (textureView != null ) {
624+ if (textureView .isAvailable ()) {
625625 surfaceTextureListener ().onSurfaceTextureAvailable (textureView .getSurfaceTexture (), textureView .getWidth (), textureView .getHeight ());
626626 } else {
627627 textureView .setSurfaceTextureListener (surfaceTextureListener ());
@@ -656,7 +656,7 @@ public void pause() {
656656 SurfaceHolder surfaceHolder = surfaceView .getHolder ();
657657 surfaceHolder .removeCallback (surfaceCallback );
658658 }
659- if (currentSurfaceSize == null && textureView != null ) {
659+ if (currentSurfaceSize == null && textureView != null ) {
660660 textureView .setSurfaceTextureListener (null );
661661 }
662662
@@ -678,7 +678,7 @@ public void pauseAndWait() {
678678 pause ();
679679 long startTime = System .nanoTime ();
680680 while (instance != null && !instance .isCameraClosed ()) {
681- if (System .nanoTime () - startTime > 2000000000 ) {
681+ if (System .nanoTime () - startTime > 2000000000 ) {
682682 // Don't wait for longer than 2 seconds
683683 break ;
684684 }
@@ -714,7 +714,7 @@ public double getMarginFraction() {
714714 * @param marginFraction the fraction
715715 */
716716 public void setMarginFraction (double marginFraction ) {
717- if (marginFraction >= 0.5d ) {
717+ if (marginFraction >= 0.5d ) {
718718 throw new IllegalArgumentException ("The margin fraction must be less than 0.5" );
719719 }
720720 this .marginFraction = marginFraction ;
@@ -835,7 +835,7 @@ protected Rect calculateFramingRect(Rect container, Rect surface) {
835835 Rect intersection = new Rect (container );
836836 boolean intersects = intersection .intersect (surface );
837837
838- if (framingRectSize != null ) {
838+ if (framingRectSize != null ) {
839839 // Specific size is specified. Make sure it's not larger than the container or surface.
840840 int horizontalMargin = Math .max (0 , (intersection .width () - framingRectSize .width ) / 2 );
841841 int verticalMargin = Math .max (0 , (intersection .height () - framingRectSize .height ) / 2 );
@@ -864,7 +864,7 @@ protected Parcelable onSaveInstanceState() {
864864
865865 @ Override
866866 protected void onRestoreInstanceState (Parcelable state ) {
867- if (!(state instanceof Bundle )) {
867+ if (!(state instanceof Bundle )) {
868868 super .onRestoreInstanceState (state );
869869 return ;
870870 }
0 commit comments