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

Commit 93d9f19e authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Implement front end support for ISO/Focal Length"

parents 04330c70 c0f0283c
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -69,6 +69,14 @@
    <string name="metadata_date_time">Taken on</string>
    <!-- Message presenting EXIF aperture information in the tradition "f/2.0" format familiar to users. This format is basically an industry standard that shouldn't be translated, so it is marked as not translatable. -->
    <string name="metadata_aperture_format" translatable="false">f/<xliff:g id="aperture" example="2.0">%1$,.1f</xliff:g></string>
    <!--The tag for the focal length of a camera. Note that this is probably camera EXIF data-->
    <string name="metadata_focal_length">Focal length</string>
    <!--The format for displaying the focal length of a camera. Note that this is probably camera EXIF data-->
    <string name="metadata_focal_format"><xliff:g id="length" example="24">%1$.2f </xliff:g>mm</string>
    <!--The tag for the ISO Speed of a camera. Note that this is probably camera EXIF data-->
    <string name="metadata_iso_speed_ratings">ISO equivalent</string>
    <!--The format for displaying ISO speed. Note that this is probably camera EXIF data-->
    <string name="metadata_iso_format">ISO <xliff:g id="iso_speed" example="35">%1$d</xliff:g></string>

    <!-- String label for developer/debug file details, specifying which stream types are available. -->
    <string name="debug_stream_types">Stream types</string>
+13 −0
Original line number Diff line number Diff line
@@ -138,6 +138,19 @@ public class MediaView extends TableView implements MediaDisplay {
                    formatShutterSpeed(tags.getDouble(ExifInterface.TAG_SHUTTER_SPEED_VALUE)));
            table.put(R.string.metadata_shutter_speed, shutterSpeed);
        }

        if (tags.containsKey(ExifInterface.TAG_FOCAL_LENGTH)) {
            double length = tags.getDouble(ExifInterface.TAG_FOCAL_LENGTH);
            table.put(R.string.metadata_focal_length,
                    String.format(resources.getString(R.string.metadata_focal_format), length));
        }

        if (tags.containsKey(ExifInterface.TAG_ISO_SPEED_RATINGS)) {
            int iso = tags.getInt(ExifInterface.TAG_ISO_SPEED_RATINGS);
            table.put(R.string.metadata_iso_speed_ratings,
                    String.format(resources.getString(R.string.metadata_iso_format), iso));
        }

    }

    private static void showCoordiantes(
+4 −1
Original line number Diff line number Diff line
@@ -59,7 +59,8 @@ public class MediaViewTest {
     */
    @Test
    public void testShowExifData() throws Exception {
        mResources.strings.put(R.string.metadata_aperture_format, "f/%.1f");
        mResources.strings.put(R.string.metadata_focal_format, "%.2f mm");
        mResources.strings.put(R.string.metadata_iso_format, "ISO %d");
        Bundle exif = mMetadata.getBundle(DocumentsContract.METADATA_EXIF);
        MediaView.showExifData(mTable, mResources, TestEnv.FILE_JPG, exif, null);

@@ -70,6 +71,8 @@ public class MediaViewTest {
        mTable.assertHasRow(R.string.metadata_camera, "Google Pixel");
        mTable.assertHasRow(R.string.metadata_shutter_speed, "1/100");
        mTable.assertHasRow(R.string.metadata_aperture, "f/2.0");
        mTable.assertHasRow(R.string.metadata_iso_speed_ratings, "ISO 120");
        mTable.assertHasRow(R.string.metadata_focal_length, "4.27 mm");
    }

    /**
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ final class TestMetadata {
        data.putString(ExifInterface.TAG_MODEL, "Pixel");
        data.putDouble(ExifInterface.TAG_SHUTTER_SPEED_VALUE, 6.643);
        data.putDouble(ExifInterface.TAG_APERTURE, 2.0);
        data.putInt(ExifInterface.TAG_ISO_SPEED_RATINGS, 120);
        data.putDouble(ExifInterface.TAG_FOCAL_LENGTH, 4.27);
    }

    static void populateVideoData(Bundle container) {