This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
generated from capacitor-community/.github
-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ⬆️ Bump minimist from 1.2.5 to 1.2.6 (#112) Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6. - [Release notes](https://github.com/substack/minimist/releases) - [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6) --- updated-dependencies: - dependency-name: minimist dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Reset last scanned code when resuming scan (#116) * Update BarcodeScanner.java reset scanResult after calling resumeScan * Update Plugin.swift reset scan result after calling resumeScan * 2.1.1 * fix IOS orientation (#131) Steps to reproduce : open the app in portrait/landscape mode => rotate => open the camera Issue the CameraView was being loaded when the app starts not with each scan. Somehow the cameraView doesn't recognize that the app has rotated * Capacitor v4 (#143) * feat(capacitor): update to capacitor v4 * fix(ios): small bugfixes * fix(ios): added self. to savedCall in scan() (#142) Co-authored-by: Kristof Hauser <hauser.kristof@gmail.com> * 3.0.0 * Add more detailed troubleshooting to the README (#152) Added more detailed troubleshooting, with a fix for the following #151 * fix(readme): typos and other enhancements * iOS interface orientation obsolete (#146) On iOS the `UIApplication.shared.statusBarOrientation` is deprecated and on newer versions obsolete. It has been replaced by code suggested here: https://askcodes.net/coding/-statusbarorientation--was-deprecated-in-ios-13-0-when-attempting-to-get-app-orientation #129 * fix(readme): added ionic stuff * updating definitions * adding dependencies * updating permisions * feat: Adding ML-Kit Logic * updating XML Layout * adding base for graphic drawing Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: PaintedShepherd <painted.shepherd@gmail.com> Co-authored-by: Yannik Ache Eicher <ache@bbit.io> Co-authored-by: Mohamed Abdelgwad <4671486+scr2em@users.noreply.github.com> Co-authored-by: Kristof Hauser <hauser.kristof@gmail.com> Co-authored-by: Raphaël Balet <raphael.balet@outlook.com> Co-authored-by: Robin <rattenval@hotmail.com> Co-authored-by: Abdulaziz Alghamdi <a.alghamdi@juleb.com>
- Loading branch information
1 parent
434edc5
commit f37570b
Showing
17 changed files
with
1,880 additions
and
496 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic" | ||
} |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains 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
69 changes: 69 additions & 0 deletions
69
android/src/main/java/com/getcapacitor/community/barcodescanner/BarcodeGraphic.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package com.getcapacitor.community.barcodescanner; | ||
|
||
import static java.lang.Math.max; | ||
import static java.lang.Math.min; | ||
|
||
import android.graphics.Canvas; | ||
import android.graphics.Color; | ||
import android.graphics.Paint; | ||
import android.graphics.RectF; | ||
import com.google.mlkit.vision.barcode.common.Barcode; | ||
|
||
public class BarcodeGraphic extends GraphicOverlay.Graphic { | ||
|
||
private static final int TEXT_COLOR = Color.BLACK; | ||
private static final int MARKER_COLOR = Color.WHITE; | ||
private static final float TEXT_SIZE = 54.0f; | ||
private static final float STROKE_WIDTH = 4.0f; | ||
private static final String TAG = "Drawing"; | ||
|
||
private final Paint rectPaint; | ||
private final Paint barcodePaint; | ||
private final Barcode barcode; | ||
private final Paint labelPaint; | ||
|
||
BarcodeGraphic(GraphicOverlay overlay, Barcode barcode) { | ||
super(overlay); | ||
this.barcode = barcode; | ||
|
||
rectPaint = new Paint(); | ||
rectPaint.setColor(MARKER_COLOR); | ||
rectPaint.setStyle(Paint.Style.STROKE); | ||
rectPaint.setStrokeWidth(STROKE_WIDTH); | ||
|
||
barcodePaint = new Paint(); | ||
barcodePaint.setColor(TEXT_COLOR); | ||
barcodePaint.setTextSize(TEXT_SIZE); | ||
|
||
labelPaint = new Paint(); | ||
labelPaint.setColor(MARKER_COLOR); | ||
labelPaint.setStyle(Paint.Style.FILL); | ||
} | ||
|
||
/** | ||
* Draws the barcode block annotations for position, size, and raw value on the supplied canvas. | ||
*/ | ||
@Override | ||
public void draw(Canvas canvas) { | ||
if (barcode == null) { | ||
throw new IllegalStateException("Attempting to draw a null barcode."); | ||
} | ||
// Draws the bounding box around the BarcodeBlock. | ||
RectF rect = new RectF(barcode.getBoundingBox()); | ||
// If the image is flipped, the left will be translated to right, and the right to left. | ||
float x0 = translateX(rect.left); | ||
float x1 = translateX(rect.right); | ||
rect.left = min(x0, x1); | ||
rect.right = max(x0, x1); | ||
rect.top = translateY(rect.top); | ||
rect.bottom = translateY(rect.bottom); | ||
canvas.drawRect(rect, rectPaint); | ||
|
||
// Draws other object info. | ||
float lineHeight = TEXT_SIZE + (2 * STROKE_WIDTH); | ||
float textWidth = barcodePaint.measureText(barcode.getDisplayValue()); | ||
canvas.drawRect(rect.left - STROKE_WIDTH, rect.top - lineHeight, rect.left + textWidth + (2 * STROKE_WIDTH), rect.top, labelPaint); | ||
// Renders the barcode at the bottom of the box. | ||
canvas.drawText(barcode.getDisplayValue(), rect.left, rect.top - STROKE_WIDTH, barcodePaint); | ||
} | ||
} |
Oops, something went wrong.