Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7efad758 authored by Mark Harman's avatar Mark Harman
Browse files

Announce camera front/back etc for accessibility/talkback.

parent c720b8b9
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -56,6 +56,8 @@ FIXED Fixed possible crash related to focusing with Camera2 API.
FIXED   Dialog for poor magnetic sensor dialog wasn't showing any text.
FIXED   Ensure the info text for capture progress in x- extension modes remains visible until 100%.
FIXED   Zoom wasn't available in video mode after restarting, if photo mode was set to Panorama.
ADDED   Announce current camera info for accessibility (e.g. Talkback) on startup and when switching
        camera.
ADDED   More crop guides: 65:24 and 3:1.
UPDATED Shutter button now changes to a red square when recording video.
UPDATED Smooth zoom transition when using zoom seekbar (for Camera2 API).
+22 −0
Original line number Diff line number Diff line
@@ -1672,6 +1672,8 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
                    }
                }
            }

            this.announceCameraForAccessibility(cameraId, cameraIdSPhysical);
        }

        push_switched_camera = false; // just in case
@@ -1681,6 +1683,25 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        }
    }

    /** Give details on the camera for talkback. Should be called when resuming (but not every time the
     *  camera is reopened), or if switching camera.
     */
    private void announceCameraForAccessibility(int cameraId, String cameraIdSPhysical) {
        String description = cameraIdSPhysical != null ?
                preview.getCameraControllerManager().getDescription(null, this, cameraIdSPhysical, true, false) :
                preview.getCameraControllerManager().getDescription(this, cameraId);
        if( description != null ) {
            String talkback_string = description;
            if( cameraIdSPhysical == null )
                talkback_string += " " + getResources().getString(R.string.camera_id) + " " + cameraId;
            else
                talkback_string += " " + getResources().getString(R.string.lens) + " " + cameraIdSPhysical;
            if( MyDebug.LOG )
                Log.d(TAG, "talkback_string: " + talkback_string);
            this.preview.getView().announceForAccessibility(talkback_string);
        }
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        if( MyDebug.LOG )
@@ -2451,6 +2472,7 @@ public class MainActivity extends AppCompatActivity implements PreferenceFragmen
        switchMultiCameraButton.setEnabled(true);
        // no need to call mainUI.setSwitchCameraContentDescription - this will be called from Preview.cameraSetup when the
        // new camera is opened
        this.announceCameraForAccessibility(cameraId, cameraIdSPhysical);
    }

    /**