Skip to content

Commit

Permalink
Dev
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy-budiyev committed Apr 26, 2018
1 parent 788b640 commit 476168f
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions src/main/java/com/budiyev/android/codescanner/CodeScannerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,11 @@ protected void onLayout(final boolean changed, final int left, final int top, fi
}
}

/**
* Get current mask color
*
* @see #setMaskColor
*/
@ColorInt
public int getMaskColor() {
return mViewFinderView.getMaskColor();
Expand All @@ -231,6 +236,11 @@ public void setMaskColor(@ColorInt final int color) {
mViewFinderView.setMaskColor(color);
}

/**
* Get current frame color
*
* @see #setFrameColor
*/
@ColorInt
public int getFrameColor() {
return mViewFinderView.getFrameColor();
Expand All @@ -245,6 +255,11 @@ public void setFrameColor(@ColorInt final int color) {
mViewFinderView.setFrameColor(color);
}

/**
* Get current frame thickness
*
* @see #setFrameThickness
*/
@Px
public int getFrameThickness() {
return mViewFinderView.getFrameThickness();
Expand All @@ -262,6 +277,11 @@ public void setFrameThickness(@Px final int thickness) {
mViewFinderView.setFrameThickness(thickness);
}

/**
* Get current frame corners size
*
* @see #setFrameCornersSize
*/
@Px
public int getFrameCornersSize() {
return mViewFinderView.getFrameCornersSize();
Expand All @@ -279,6 +299,11 @@ public void setFrameCornersSize(@Px final int size) {
mViewFinderView.setFrameCornersSize(size);
}

/**
* Get current frame size
*
* @see #setFrameSize
*/
@FloatRange(from = 0.1, to = 1.0)
public float getFrameSize() {
return mViewFinderView.getFrameSize();
Expand All @@ -296,23 +321,47 @@ public void setFrameSize(@FloatRange(from = 0.1, to = 1) final float size) {
mViewFinderView.setFrameSize(size);
}

/**
* Get current frame aspect ratio width
*
* @see #setFrameAspectRatioWidth
* @see #setFrameAspectRatio
*/
@FloatRange(from = 0, fromInclusive = false)
public float getFrameAspectRatioWidth() {
return mViewFinderView.getFrameAspectRatioWidth();
}

/**
* Set frame aspect ratio width
*
* @param ratioWidth Frame aspect ratio width
* @see #setFrameAspectRatio
*/
public void setFrameAspectRatioWidth(@FloatRange(from = 0, fromInclusive = false) final float ratioWidth) {
if (ratioWidth <= 0) {
throw new IllegalArgumentException("Frame aspect ratio values should be greater than zero");
}
mViewFinderView.setFrameAspectRatioWidth(ratioWidth);
}

/**
* Get current frame aspect ratio height
*
* @see #setFrameAspectRatioHeight
* @see #setFrameAspectRatio
*/
@FloatRange(from = 0, fromInclusive = false)
public float getFrameAspectRatioHeight() {
return mViewFinderView.getFrameAspectRatioHeight();
}

/**
* Set frame aspect ratio height
*
* @param ratioHeight Frame aspect ratio width
* @see #setFrameAspectRatio
*/
public void setFrameAspectRatioHeight(@FloatRange(from = 0, fromInclusive = false) final float ratioHeight) {
if (ratioHeight <= 0) {
throw new IllegalArgumentException("Frame aspect ratio values should be greater than zero");
Expand All @@ -334,6 +383,11 @@ public void setFrameAspectRatio(@FloatRange(from = 0, fromInclusive = false) fin
mViewFinderView.setFrameAspectRatio(ratioWidth, ratioHeight);
}

/**
* Whether if auto focus button is currently visible
*
* @see #setAutoFocusButtonVisible
*/
public boolean isAutoFocusButtonVisible() {
return mAutoFocusButton.getVisibility() == VISIBLE;
}
Expand All @@ -347,6 +401,11 @@ public void setAutoFocusButtonVisible(final boolean visible) {
mAutoFocusButton.setVisibility(visible ? VISIBLE : INVISIBLE);
}

/**
* Whether if flash button is currently visible
*
* @see #setFlashButtonVisible
*/
public boolean isFlashButtonVisible() {
return mFlashButton.getVisibility() == VISIBLE;
}
Expand All @@ -360,6 +419,11 @@ public void setFlashButtonVisible(final boolean visible) {
mFlashButton.setVisibility(visible ? VISIBLE : INVISIBLE);
}

/**
* Get current auto focus button color
*
* @see #setAutoFocusButtonColor
*/
@ColorInt
public int getAutoFocusButtonColor() {
return mAutoFocusButtonColor;
Expand All @@ -375,6 +439,11 @@ public void setAutoFocusButtonColor(@ColorInt final int color) {
mAutoFocusButton.setColorFilter(color);
}

/**
* Get current flash button color
*
* @see #setFlashButtonColor
*/
@ColorInt
public int getFlashButtonColor() {
return mFlashButtonColor;
Expand Down

0 comments on commit 476168f

Please sign in to comment.