Use resources to specify wether or not to enforce no upscaling

Add a resource which controls whether or not to enforce using
ScaleType.CENTER for thumbnail images. This allows other apps to
override this resource if they wish to have custom behaviour here.

This is change ag/278873 but moved to jb-mr2-dev

Change-Id: I599b3d0a6b099fc1d8d8429349ef1765d9a633b9
diff --git a/res/values/config.xml b/res/values/config.xml
new file mode 100644
index 0000000..250b687
--- /dev/null
+++ b/res/values/config.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+  <!-- If true, thumbnails will be forcibly set to ScaleType.CENTER -->
+  <bool name="force_thumbnail_no_scaling">true</bool>
+</resources>
\ No newline at end of file
diff --git a/src/com/android/ex/photo/fragments/PhotoViewFragment.java b/src/com/android/ex/photo/fragments/PhotoViewFragment.java
index e4807b6..2408258 100644
--- a/src/com/android/ex/photo/fragments/PhotoViewFragment.java
+++ b/src/com/android/ex/photo/fragments/PhotoViewFragment.java
@@ -324,7 +324,9 @@
                     mThumbnailShown = true;
                 }
                 mPhotoPreviewImage.setVisibility(View.VISIBLE);
-                mPhotoPreviewImage.setScaleType(ImageView.ScaleType.CENTER);
+                if (getResources().getBoolean(R.bool.force_thumbnail_no_scaling)) {
+                    mPhotoPreviewImage.setScaleType(ImageView.ScaleType.CENTER);
+                }
                 enableImageTransforms(false);
                 break;
             case LOADER_ID_PHOTO: