-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
For #38: Initial (non-functional) prototype for ZXing
- Loading branch information
Showing
6 changed files
with
142 additions
and
2 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
app/src/foss/java/com/czlucius/scan/translators/zxing/ZXingCodeTranslator.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,34 @@ | ||
/* | ||
* Code Scanner. An android app to scan and create codes(barcodes, QR codes, etc) | ||
* Copyright (C) 2021 Lucius Chee Zihan | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.czlucius.scan.translators.zxing; | ||
|
||
import com.czlucius.scan.objects.Code; | ||
import com.czlucius.scan.objects.Type; | ||
import com.czlucius.scan.translators.CodeTranslator; | ||
import com.czlucius.scan.translators.TranslationException; | ||
import com.google.zxing.Result; | ||
|
||
public class ZXingCodeTranslator implements CodeTranslator<Result> { | ||
@Override | ||
public Code convert(Result from) throws TranslationException { | ||
|
||
Code code = new Code() | ||
return null; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
app/src/foss/java/com/czlucius/scan/utils/zxing/ZXingUtils.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,22 @@ | ||
/* | ||
* Code Scanner. An android app to scan and create codes(barcodes, QR codes, etc) | ||
* Copyright (C) 2021 Lucius Chee Zihan | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.czlucius.scan.utils.zxing; | ||
|
||
public class ZXingUtils { | ||
} |
55 changes: 55 additions & 0 deletions
55
app/src/main/java/com/czlucius/scan/objects/BaseAnalyser.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,55 @@ | ||
/* | ||
* Code Scanner. An android app to scan and create codes(barcodes, QR codes, etc) | ||
* Copyright (C) 2021 Lucius Chee Zihan | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.czlucius.scan.objects; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.camera.core.ImageAnalysis; | ||
import androidx.camera.core.ImageProxy; | ||
|
||
import java.util.List; | ||
|
||
public abstract class BaseAnalyser implements ImageAnalysis.Analyzer { | ||
|
||
private final SuccessCallback successCallback; | ||
private final FailureHandler failureHandler; | ||
|
||
protected BaseAnalyser(SuccessCallback successCallback, FailureHandler failureHandler) { | ||
this.successCallback = successCallback; | ||
this.failureHandler = failureHandler; | ||
} | ||
|
||
|
||
public abstract void analyze(@NonNull ImageProxy image, SuccessCallback successCallback, FailureHandler failureHandler); | ||
|
||
@Override | ||
public final void analyze(@NonNull ImageProxy imageProxy) { | ||
analyze(imageProxy, successCallback, failureHandler); | ||
imageProxy.close(); | ||
} | ||
|
||
|
||
public interface SuccessCallback { | ||
void scannedBarcodes(List<Code> barcodes); | ||
} | ||
|
||
public interface FailureHandler { | ||
void handleException(Exception e); | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Code Scanner. An android app to scan and create codes(barcodes, QR codes, etc) | ||
* Copyright (C) 2021 Lucius Chee Zihan | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.czlucius.scan; | ||
|
||
import com.czlucius.scan.objects.Type; | ||
import com.google.mlkit.vision.barcode.common.Barcode; | ||
|
||
public class MLKitUtils { | ||
|
||
} |
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