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

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

Merge "Fix aperture display in the inspector"

parents 945dabb8 432d5203
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -66,6 +66,9 @@
    <!--When a photo was taken. Note that this is probably camera EXIF data.-->
    <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>

    <!--String label for developer/debug file details, specifying which stream types are available. -->
    <string name="debug_stream_types">Stream types</string>
    <!--String label for developer/debug file details, specifying the size of the file in bytes. -->
+2 −3
Original line number Diff line number Diff line
@@ -133,8 +133,8 @@ public class MediaView extends TableView implements MediaDisplay {
        }

        if (tags.containsKey(ExifInterface.TAG_APERTURE)) {
            String aperture = String.valueOf(tags.get(ExifInterface.TAG_APERTURE));
            table.put(R.string.metadata_aperture, aperture);
            table.put(R.string.metadata_aperture, resources.getString(
                    R.string.metadata_aperture_format, tags.getDouble(ExifInterface.TAG_APERTURE)));
        }

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

    /**
     *
     * @param speed a value n, where shutter speed equals 1/(2^n)
     * @return a String containing either a fraction that displays 1 over a positive integer, or a
     * double rounded to one decimal, depending on if 1/(2^n) is less than or greater than 1,
+2 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ public class MediaViewTest {
     */
    @Test
    public void testPrintMetadata_BundleTags() throws Exception {
        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);

@@ -62,6 +63,7 @@ public class MediaViewTest {
        mTable.assertHasRow(R.string.metadata_make, "Google");
        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");
    }

    /**
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ final class TestMetadata {
        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);
        container.putBundle(DocumentsContract.METADATA_EXIF, exif);
    }
}