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

Commit 8b8370f2 authored by Steve McKay's avatar Steve McKay
Browse files

EXIF improvements.

Collapse Make and Model into a single "Camera" field.
Improve rendering of focal length.

Test: Manual
Change-Id: I94b758551edfae5602ebaa8bd475c64d3a3917c9
parent af73f02e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -55,10 +55,10 @@
    <string name="metadata_coordinates_format"><xliff:g id="latitude" example="33.996">%1$,.3f</xliff:g>, <xliff:g id="longitude" example="-118.476">%2$,.3f</xliff:g></string>
    <!-- The elevation a photo was taken. -->
    <string name="metadata_altitude">Altitude</string>
    <!-- The company that made the camera the photo was taken on. -->
    <string name="metadata_make">Make</string>
    <!-- The camera model that the photo was taken on. -->
    <string name="metadata_model">Model</string>
    <!-- The camera make and model. -->
    <string name="metadata_camera">Camera</string>
    <!-- The camera make and model. Where make is usually the company, and model is the individual camera model name. -->
    <string name="metadata_camera_format"><xliff:g id="make" example="Sony">%s</xliff:g> <xliff:g id="model" example="Snazzy Snapper">%s</xliff:g></string>
    <!-- The value of a photos aperture. Note that this is probably camera EXIF data.-->
    <string name="metadata_aperture">Aperture</string>
    <!-- The value of a photos shutter speed. Note that this is probably camera EXIF data.-->
@@ -70,11 +70,11 @@
    <!--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>
    <string name="metadata_focal_format"><xliff:g id="length" example="4.67mm">%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 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>
    <string name="metadata_iso_format">ISO <xliff:g id="iso_speed" example="200">%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>
+9 −9
Original line number Diff line number Diff line
@@ -118,14 +118,14 @@ public class MediaView extends TableView implements MediaDisplay {
            table.put(R.string.metadata_altitude, String.valueOf(altitude));
        }

        if (tags.containsKey(ExifInterface.TAG_MAKE)) {
        if (tags.containsKey(ExifInterface.TAG_MAKE) || tags.containsKey(ExifInterface.TAG_MODEL)) {
                String make = tags.getString(ExifInterface.TAG_MAKE);
            table.put(R.string.metadata_make, make);
        }

        if (tags.containsKey(ExifInterface.TAG_MODEL)) {
                String model = tags.getString(ExifInterface.TAG_MODEL);
            table.put(R.string.metadata_model, model);
                make = make != null ? make : "";
                model = model != null ? model : "";
                table.put(
                        R.string.metadata_camera,
                        resources.getString(R.string.metadata_camera_format, make, model));
        }

        if (tags.containsKey(ExifInterface.TAG_APERTURE)) {
@@ -140,7 +140,7 @@ public class MediaView extends TableView implements MediaDisplay {
        }

        if (tags.containsKey(ExifInterface.TAG_FOCAL_LENGTH)) {
            int length = (int) tags.getDouble(ExifInterface.TAG_FOCAL_LENGTH);
            float length = (float) tags.getDouble(ExifInterface.TAG_FOCAL_LENGTH);
            table.put(R.string.metadata_focal_length,
                    String.format(resources.getString(R.string.metadata_focal_format), length));
        }
+4 −3
Original line number Diff line number Diff line
@@ -42,9 +42,11 @@ public class MediaViewTest {
    @Before
    public void setUp() {
        mResources = TestResources.create();
        // TODO: We should just be using the real underlying resources.
        mResources.strings.put(R.string.metadata_dimensions_format, "%d x %d, %.1fMP");
        mResources.strings.put(R.string.metadata_aperture_format, "f/%.1f");
        mResources.strings.put(R.string.metadata_coordinates_format, "%.3f, %.3f");
        mResources.strings.put(R.string.metadata_camera_format, "%s %s");
        mTable = new TestTable();
        mMetadata = new Bundle();
        TestMetadata.populateExifData(mMetadata);
@@ -67,11 +69,10 @@ public class MediaViewTest {
        mTable.assertHasRow(R.string.metadata_date_time, "Jan 01, 1970, 12:16 AM");
        mTable.assertHasRow(R.string.metadata_coordinates, "33.996, -118.475");
        mTable.assertHasRow(R.string.metadata_altitude, "1244.0");
        mTable.assertHasRow(R.string.metadata_make, "Google");
        mTable.assertHasRow(R.string.metadata_model, "Pixel");
        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_focal_length, "8 mm");
        mTable.assertHasRow(R.string.metadata_focal_length, "8.00mm");
        mTable.assertHasRow(R.string.metadata_iso_speed_ratings, "ISO 120");
    }