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

Commit 61662f28 authored by Julian Mancini's avatar Julian Mancini Committed by Android (Google) Code Review
Browse files

Merge "Add DocsUI Support for Focal Length/ISO"

parents 6493890e c6678536
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -67,6 +67,14 @@
    <string name="metadata_duration">Duration</string>
    <!-- When a photo was taken. Note that this is probably camera EXIF data.-->
    <string name="metadata_date_time">Taken on</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$d </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 Speed</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>

    <!-- 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>
+12 −0
Original line number Diff line number Diff line
@@ -138,6 +138,18 @@ 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)) {
            int length = (int) 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 −0
Original line number Diff line number Diff line
@@ -57,6 +57,8 @@ public class MediaViewTest {
     */
    @Test
    public void testShowExifData() throws Exception {
        mResources.strings.put(R.string.metadata_iso_format, "ISO %s");
        mResources.strings.put(R.string.metadata_focal_format, "%d mm");
        mResources.strings.put(R.string.metadata_aperture_format, "f/%.1f");
        Bundle exif = mMetadata.getBundle(DocumentsContract.METADATA_EXIF);
        MediaView.showExifData(mTable, mResources, TestEnv.FILE_JPG, exif, null);
@@ -69,6 +71,8 @@ public class MediaViewTest {
        mTable.assertHasRow(R.string.metadata_model, "Pixel");
        mTable.assertHasRow(R.string.metadata_shutter_speed, "1/100");
        mTable.assertHasRow(R.string.metadata_aperture, "f/2.0");
        mTable.assertHasRow(R.string.metadata_focal_length, "8 mm");
        mTable.assertHasRow(R.string.metadata_iso_speed_ratings, "ISO 120");
    }

    /**
+15 −12
Original line number Diff line number Diff line
@@ -29,18 +29,21 @@ final class TestMetadata {
        Bundle data = new Bundle();
        container.putBundle(DocumentsContract.METADATA_EXIF, data);

        data.putInt(ExifInterface.TAG_IMAGE_WIDTH, 3840);
        data.putInt(ExifInterface.TAG_IMAGE_LENGTH, 2160);
        data.putString(ExifInterface.TAG_DATETIME, "Jan 01, 1970, 12:16 AM");
        data.putString(ExifInterface.TAG_GPS_LATITUDE, "33/1,59/1,4530/100");
        data.putString(ExifInterface.TAG_GPS_LONGITUDE, "118/1,28/1,3124/100");
        data.putString(ExifInterface.TAG_GPS_LATITUDE_REF, "N");
        data.putString(ExifInterface.TAG_GPS_LONGITUDE_REF, "W");
        data.putDouble(ExifInterface.TAG_GPS_ALTITUDE, 1244);
        data.putString(ExifInterface.TAG_MAKE, "Google");
        data.putString(ExifInterface.TAG_MODEL, "Pixel");
        data.putDouble(ExifInterface.TAG_SHUTTER_SPEED_VALUE, 6.643);
        data.putDouble(ExifInterface.TAG_APERTURE, 2.0);
        Bundle exif = new Bundle();
        exif.putInt(ExifInterface.TAG_IMAGE_WIDTH, 3840);
        exif.putInt(ExifInterface.TAG_IMAGE_LENGTH, 2160);
        exif.putString(ExifInterface.TAG_DATETIME, "Jan 01, 1970, 12:16 AM");
        exif.putString(ExifInterface.TAG_GPS_LATITUDE, "33/1,59/1,4530/100");
        exif.putString(ExifInterface.TAG_GPS_LONGITUDE, "118/1,28/1,3124/100");
        exif.putString(ExifInterface.TAG_GPS_LATITUDE_REF, "N");
        exif.putString(ExifInterface.TAG_GPS_LONGITUDE_REF, "W");
        exif.putDouble(ExifInterface.TAG_GPS_ALTITUDE, 1244);
        exif.putString(ExifInterface.TAG_MAKE, "Google");
        exif.putString(ExifInterface.TAG_MODEL, "Pixel");
        exif.putDouble(ExifInterface.TAG_SHUTTER_SPEED_VALUE, 6.643);
        exif.putDouble(ExifInterface.TAG_APERTURE, 2.0);
        exif.putDouble(ExifInterface.TAG_FOCAL_LENGTH, 8.0);
        exif.putInt(ExifInterface.TAG_ISO_SPEED_RATINGS, 120);
    }

    static void populateVideoData(Bundle container) {
+1 −1

File changed.

Contains only whitespace changes.