Loading app/src/main/java/net/sourceforge/opencamera/preview/Preview.java +16 −4 Original line number Diff line number Diff line Loading @@ -203,8 +203,10 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu VIDEO, QRCODE }; private FunctionalMode functionalMode; private FunctionalMode functionalMode = FunctionalMode.PHOTO; private boolean is_video() {return functionalMode == FunctionalMode.VIDEO;}; private boolean is_qrcode() {return functionalMode == FunctionalMode.QRCODE;}; private boolean is_photo() {return functionalMode == FunctionalMode.PHOTO;}; private volatile MediaRecorder video_recorder; // must be volatile for test project reading the state private volatile boolean video_start_time_set; // must be volatile for test project reading the state Loading Loading @@ -4728,12 +4730,16 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu return; } boolean old_is_video = is_video(); boolean old_is_qrcode = is_qrcode(); if (this.is_video()) { if (video_recorder != null) { stopVideo(false); } this.functionalMode = FunctionalMode.QRCODE; } else if (this.is_qrcode()) { // K1ZFP TODO Stop the qrcode // this.functionalMode = FunctionalMode.PHOTO; } else { } else if (this.is_photo()) { if (this.isOnTimer()) { cancelTimer(); ((MainActivity)getContext()).setDecorFitsSystemWindows(true); Loading @@ -4748,7 +4754,10 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu } } if (is_video() != old_is_video) { if (is_qrcode() != old_is_qrcode) { //K1ZFP TODO // } else if (is_video() != old_is_video) { setFocusPref(false); // first restore the saved focus for the new photo/video mode; don't do autofocus, as it'll be cancelled when restarting preview /*if( !is_video ) { // changing from video to photo mode Loading @@ -4757,7 +4766,7 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu if (change_user_pref) { // now save applicationInterface.setVideoPref(is_video()); applicationInterface.setVideoPref(is_video()); // K1ZFP TODO Warn// } if (!during_startup) { // if during startup, updateFlashForVideo() needs to always be explicitly called anyway Loading Loading @@ -8597,6 +8606,9 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu public boolean isVideo() { return functionalMode == FunctionalMode.VIDEO; } public boolean isPhoto() { return functionalMode == FunctionalMode.PHOTO; } public boolean isVideoRecording() { return video_recorder != null && video_start_time_set; Loading app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java +30 −3 Original line number Diff line number Diff line Loading @@ -1217,6 +1217,7 @@ public class MainUI { int resource; int content_description; int switch_video_content_description; // The switch order is camera -> video -> qrcode -> camera... if (main_activity.getPreview().isVideo()) { if (MyDebug.LOG) Log.d(TAG, "set icon to video " + main_activity.getPreview().isVideoRecording()); Loading @@ -1224,23 +1225,48 @@ public class MainUI { ? R.drawable.ic_camera_video_recording : R.drawable.ic_camera_video; content_description = main_activity.getPreview().isVideoRecording() ? R.string.stop_video : R.string.start_video; switch_video_content_description = R.string.switch_to_qrcode; } else if (main_activity.getPreview().isQRCode()) { if (MyDebug.LOG) Log.d(TAG, "set icon to qrcode"); resource = R.drawable.empty; content_description = 0; switch_video_content_description = R.string.switch_to_photo; } else { } else { // Video case if (MyDebug.LOG) Log.d(TAG, "set icon to photo"); resource = R.drawable.take_photo_selector; content_description = R.string.take_photo; switch_video_content_description = R.string.switch_to_video; } view.setImageResource(resource); if (content_description==0) view.setContentDescription(""); else view.setContentDescription(main_activity.getResources().getString(content_description)); view.setTag(resource); // for testing view = main_activity.findViewById(R.id.switch_video); view.setContentDescription(main_activity.getResources().getString(switch_video_content_description)); resource = main_activity.getPreview().isVideo() ? R.drawable.ic_switch_camera : R.drawable.ic_switch_video; if (main_activity.getPreview().isVideo()) resource = R.drawable.ic_switch_qrcode; else if (main_activity.getPreview().isQRCode()) resource = R.drawable.ic_switch_camera; else // camera resource = R.drawable.ic_switch_video; view.setImageResource(resource); view.setTag(resource); // for testing // Hide/Show gallery & switch camera icons. if (main_activity.getPreview().isQRCode()) { main_activity.findViewById(R.id.gallery).setVisibility(View.INVISIBLE); main_activity.findViewById(R.id.switch_camera).setVisibility(View.INVISIBLE); } else { main_activity.findViewById(R.id.gallery).setVisibility(View.VISIBLE); main_activity.findViewById(R.id.switch_camera).setVisibility(View.VISIBLE); } } } Loading Loading @@ -2506,6 +2532,7 @@ public class MainUI { } public void setPopupIcon() { if (MyDebug.LOG) Log.d(TAG, "setPopupIcon"); ImageButton popup = main_activity.findViewById(R.id.popup); Loading app/src/main/res/values-fr/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -932,4 +932,5 @@ <string name="photo_mode_x_beauty">X-Bty</string> <string name="photo_mode_x_bokeh_full">Extension : Bokeh</string> <string name="photo_mode_x_bokeh">X-Bokeh</string> <string name="switch_to_qrcode">QR Code</string> </resources> No newline at end of file app/src/main/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1101,4 +1101,5 @@ <string name="skip_button_label">Skip</string> <string name="switch_multi_camera_lens">LENS</string> <string name="switch_to_qrcode">QRCode</string> </resources> Loading
app/src/main/java/net/sourceforge/opencamera/preview/Preview.java +16 −4 Original line number Diff line number Diff line Loading @@ -203,8 +203,10 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu VIDEO, QRCODE }; private FunctionalMode functionalMode; private FunctionalMode functionalMode = FunctionalMode.PHOTO; private boolean is_video() {return functionalMode == FunctionalMode.VIDEO;}; private boolean is_qrcode() {return functionalMode == FunctionalMode.QRCODE;}; private boolean is_photo() {return functionalMode == FunctionalMode.PHOTO;}; private volatile MediaRecorder video_recorder; // must be volatile for test project reading the state private volatile boolean video_start_time_set; // must be volatile for test project reading the state Loading Loading @@ -4728,12 +4730,16 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu return; } boolean old_is_video = is_video(); boolean old_is_qrcode = is_qrcode(); if (this.is_video()) { if (video_recorder != null) { stopVideo(false); } this.functionalMode = FunctionalMode.QRCODE; } else if (this.is_qrcode()) { // K1ZFP TODO Stop the qrcode // this.functionalMode = FunctionalMode.PHOTO; } else { } else if (this.is_photo()) { if (this.isOnTimer()) { cancelTimer(); ((MainActivity)getContext()).setDecorFitsSystemWindows(true); Loading @@ -4748,7 +4754,10 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu } } if (is_video() != old_is_video) { if (is_qrcode() != old_is_qrcode) { //K1ZFP TODO // } else if (is_video() != old_is_video) { setFocusPref(false); // first restore the saved focus for the new photo/video mode; don't do autofocus, as it'll be cancelled when restarting preview /*if( !is_video ) { // changing from video to photo mode Loading @@ -4757,7 +4766,7 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu if (change_user_pref) { // now save applicationInterface.setVideoPref(is_video()); applicationInterface.setVideoPref(is_video()); // K1ZFP TODO Warn// } if (!during_startup) { // if during startup, updateFlashForVideo() needs to always be explicitly called anyway Loading Loading @@ -8597,6 +8606,9 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu public boolean isVideo() { return functionalMode == FunctionalMode.VIDEO; } public boolean isPhoto() { return functionalMode == FunctionalMode.PHOTO; } public boolean isVideoRecording() { return video_recorder != null && video_start_time_set; Loading
app/src/main/java/net/sourceforge/opencamera/ui/MainUI.java +30 −3 Original line number Diff line number Diff line Loading @@ -1217,6 +1217,7 @@ public class MainUI { int resource; int content_description; int switch_video_content_description; // The switch order is camera -> video -> qrcode -> camera... if (main_activity.getPreview().isVideo()) { if (MyDebug.LOG) Log.d(TAG, "set icon to video " + main_activity.getPreview().isVideoRecording()); Loading @@ -1224,23 +1225,48 @@ public class MainUI { ? R.drawable.ic_camera_video_recording : R.drawable.ic_camera_video; content_description = main_activity.getPreview().isVideoRecording() ? R.string.stop_video : R.string.start_video; switch_video_content_description = R.string.switch_to_qrcode; } else if (main_activity.getPreview().isQRCode()) { if (MyDebug.LOG) Log.d(TAG, "set icon to qrcode"); resource = R.drawable.empty; content_description = 0; switch_video_content_description = R.string.switch_to_photo; } else { } else { // Video case if (MyDebug.LOG) Log.d(TAG, "set icon to photo"); resource = R.drawable.take_photo_selector; content_description = R.string.take_photo; switch_video_content_description = R.string.switch_to_video; } view.setImageResource(resource); if (content_description==0) view.setContentDescription(""); else view.setContentDescription(main_activity.getResources().getString(content_description)); view.setTag(resource); // for testing view = main_activity.findViewById(R.id.switch_video); view.setContentDescription(main_activity.getResources().getString(switch_video_content_description)); resource = main_activity.getPreview().isVideo() ? R.drawable.ic_switch_camera : R.drawable.ic_switch_video; if (main_activity.getPreview().isVideo()) resource = R.drawable.ic_switch_qrcode; else if (main_activity.getPreview().isQRCode()) resource = R.drawable.ic_switch_camera; else // camera resource = R.drawable.ic_switch_video; view.setImageResource(resource); view.setTag(resource); // for testing // Hide/Show gallery & switch camera icons. if (main_activity.getPreview().isQRCode()) { main_activity.findViewById(R.id.gallery).setVisibility(View.INVISIBLE); main_activity.findViewById(R.id.switch_camera).setVisibility(View.INVISIBLE); } else { main_activity.findViewById(R.id.gallery).setVisibility(View.VISIBLE); main_activity.findViewById(R.id.switch_camera).setVisibility(View.VISIBLE); } } } Loading Loading @@ -2506,6 +2532,7 @@ public class MainUI { } public void setPopupIcon() { if (MyDebug.LOG) Log.d(TAG, "setPopupIcon"); ImageButton popup = main_activity.findViewById(R.id.popup); Loading
app/src/main/res/values-fr/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -932,4 +932,5 @@ <string name="photo_mode_x_beauty">X-Bty</string> <string name="photo_mode_x_bokeh_full">Extension : Bokeh</string> <string name="photo_mode_x_bokeh">X-Bokeh</string> <string name="switch_to_qrcode">QR Code</string> </resources> No newline at end of file
app/src/main/res/values/strings.xml +1 −0 Original line number Diff line number Diff line Loading @@ -1101,4 +1101,5 @@ <string name="skip_button_label">Skip</string> <string name="switch_multi_camera_lens">LENS</string> <string name="switch_to_qrcode">QRCode</string> </resources>