Loading app/src/main/AndroidManifest.xml +12 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,18 @@ android:exported="false" > </activity> <activity android:name="net.sourceforge.opencamera.qr.QrScannerActivity" android:configChanges="orientation|screenLayout|screenSize|smallestScreenSize|keyboardHidden" android:exported="true" android:excludeFromRecents="true" android:launchMode="singleInstance" android:screenOrientation="nosensor" android:visibleToInstantApps="true" android:windowSoftInputMode="stateAlwaysHidden|adjustPan"> </activity> <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html --> <receiver android:icon="@mipmap/ic_launcher" Loading app/src/main/java/net/sourceforge/opencamera/preview/OverlayQRCodeView.java +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import android.view.View; import androidx.core.content.ContextCompat; import foundation.e.camera.R; import net.sourceforge.opencamera.R; public class OverlayQRCodeView extends View { private Drawable qrcode; Loading app/src/main/java/net/sourceforge/opencamera/preview/Preview.java +17 −15 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; Loading Loading @@ -4856,22 +4855,10 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu if( video_recorder != null ) { stopVideo(false); } this.functionalMode = FunctionalMode.QRCODE; final Activity activity = (Activity) Preview.this.getContext(); final FrameLayout rootLayout = activity.findViewById(android.R.id.content); rootLayout.addView(overlayQRCodeView); int qrcodeCamId = ((MainActivity)getContext()).getBetterQRCodeCameraID(); if (qrcodeCamId >= 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(); Loading Loading @@ -8883,6 +8870,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; } Loading app/src/main/java/net/sourceforge/opencamera/qr/QrScannerActivity.kt 0 → 100644 +11 −0 Original line number Diff line number Diff line 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) } } Loading
app/src/main/AndroidManifest.xml +12 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,18 @@ android:exported="false" > </activity> <activity android:name="net.sourceforge.opencamera.qr.QrScannerActivity" android:configChanges="orientation|screenLayout|screenSize|smallestScreenSize|keyboardHidden" android:exported="true" android:excludeFromRecents="true" android:launchMode="singleInstance" android:screenOrientation="nosensor" android:visibleToInstantApps="true" android:windowSoftInputMode="stateAlwaysHidden|adjustPan"> </activity> <!-- should not change the android:name, including moving to a subpackage - see http://android-developers.blogspot.co.uk/2011/06/things-that-cannot-change.html --> <receiver android:icon="@mipmap/ic_launcher" Loading
app/src/main/java/net/sourceforge/opencamera/preview/OverlayQRCodeView.java +1 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,7 @@ import android.view.View; import androidx.core.content.ContextCompat; import foundation.e.camera.R; import net.sourceforge.opencamera.R; public class OverlayQRCodeView extends View { private Drawable qrcode; Loading
app/src/main/java/net/sourceforge/opencamera/preview/Preview.java +17 −15 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; import android.graphics.RectF; Loading Loading @@ -4856,22 +4855,10 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu if( video_recorder != null ) { stopVideo(false); } this.functionalMode = FunctionalMode.QRCODE; final Activity activity = (Activity) Preview.this.getContext(); final FrameLayout rootLayout = activity.findViewById(android.R.id.content); rootLayout.addView(overlayQRCodeView); int qrcodeCamId = ((MainActivity)getContext()).getBetterQRCodeCameraID(); if (qrcodeCamId >= 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(); Loading Loading @@ -8883,6 +8870,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; } Loading
app/src/main/java/net/sourceforge/opencamera/qr/QrScannerActivity.kt 0 → 100644 +11 −0 Original line number Diff line number Diff line 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) } }