diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 75a70dc68a50ab674f52fe955a747201371bf138..57b47934bf0eedd6633548c22f1c78f2070516fb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -100,6 +100,18 @@
android:exported="false"
>
+
+
+
+
= 0) {
- applicationInterface.setCameraIdPref(qrcodeCamId);
- //userSwitchToCamera(qrcodeCamId, true);
- }
+ setQRCode(true);
} else if (this.is_qrcode()) {
this.functionalMode = FunctionalMode.PHOTO;
- final Activity activity = (Activity) Preview.this.getContext();
- final FrameLayout rootLayout = activity.findViewById(android.R.id.content);
- if (overlayQRCodeView.getParent() != null) {
- rootLayout.removeView(overlayQRCodeView);
- }
+ setQRCode(false);
} else if (this.is_photo()) {
if (this.isOnTimer()) {
cancelTimer();
@@ -8654,6 +8641,21 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu
}
}
+ public void setQRCode(boolean enabled) {
+ final Activity activity = (Activity) Preview.this.getContext();
+ final FrameLayout rootLayout = activity.findViewById(android.R.id.content);
+ if (enabled) {
+ this.functionalMode = FunctionalMode.QRCODE;
+ rootLayout.addView(overlayQRCodeView);
+ int qrcodeCamId = ((MainActivity)getContext()).getBetterQRCodeCameraID();
+ if (qrcodeCamId >= 0) {
+ applicationInterface.setCameraIdPref(qrcodeCamId);
+ }
+ } else if (overlayQRCodeView.getParent() != null) {
+ rootLayout.removeView(overlayQRCodeView);
+ }
+ }
+
public boolean isQRCode() {
return functionalMode == FunctionalMode.QRCODE;
}
diff --git a/app/src/main/java/net/sourceforge/opencamera/qr/QrScannerActivity.kt b/app/src/main/java/net/sourceforge/opencamera/qr/QrScannerActivity.kt
new file mode 100644
index 0000000000000000000000000000000000000000..94a501b74debf8f08e94294b7d6694e72f429b5e
--- /dev/null
+++ b/app/src/main/java/net/sourceforge/opencamera/qr/QrScannerActivity.kt
@@ -0,0 +1,11 @@
+package net.sourceforge.opencamera.qr
+
+import android.os.Bundle
+import net.sourceforge.opencamera.MainActivity
+
+class QrScannerActivity : MainActivity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ preview.setQRCode(true)
+ }
+}