Use large heap size for commons app (#2261)

This commit is contained in:
Vivek Maskara 2019-01-03 19:46:16 +05:30 committed by Josephine Lim
parent ed51d8b871
commit a4a037a577
2 changed files with 9 additions and 10 deletions

View file

@ -28,6 +28,8 @@
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/LightAppTheme" android:theme="@style/LightAppTheme"
android:largeHeap="true"
android:hardwareAccelerated="false"
android:supportsRtl="true" > android:supportsRtl="true" >
<activity android:name="org.acra.CrashReportDialog" <activity android:name="org.acra.CrashReportDialog"
android:theme="@android:style/Theme.Dialog" android:theme="@android:style/Theme.Dialog"

View file

@ -35,8 +35,8 @@ import timber.log.Timber;
public class ImageUtils { public class ImageUtils {
public static final int IMAGE_DARK = 1; static final int IMAGE_DARK = 1;
public static final int IMAGE_BLURRY = 1 << 1; static final int IMAGE_BLURRY = 1 << 1;
public static final int IMAGE_DUPLICATE = 1 << 2; public static final int IMAGE_DUPLICATE = 1 << 2;
public static final int IMAGE_GEOLOCATION_DIFFERENT = 1 << 3; public static final int IMAGE_GEOLOCATION_DIFFERENT = 1 << 3;
public static final int IMAGE_OK = 0; public static final int IMAGE_OK = 0;
@ -44,7 +44,7 @@ public class ImageUtils {
public static final int IMAGE_WAIT = -2; public static final int IMAGE_WAIT = -2;
public static final int EMPTY_TITLE = -3; public static final int EMPTY_TITLE = -3;
public static final int FILE_NAME_EXISTS = -4; public static final int FILE_NAME_EXISTS = -4;
public static final int NO_CATEGORY_SELECTED = -5; static final int NO_CATEGORY_SELECTED = -5;
@IntDef( @IntDef(
flag = true, flag = true,
@ -70,7 +70,7 @@ public class ImageUtils {
* @return IMAGE_OK if image is neither dark nor blurry or if the input bitmapRegionDecoder provided is null * @return IMAGE_OK if image is neither dark nor blurry or if the input bitmapRegionDecoder provided is null
* IMAGE_DARK if image is too dark * IMAGE_DARK if image is too dark
*/ */
public static @Result static @Result
int checkIfImageIsTooDark(BitmapRegionDecoder bitmapRegionDecoder) { int checkIfImageIsTooDark(BitmapRegionDecoder bitmapRegionDecoder) {
if (bitmapRegionDecoder == null) { if (bitmapRegionDecoder == null) {
Timber.e("Expected bitmapRegionDecoder was null"); Timber.e("Expected bitmapRegionDecoder was null");
@ -102,7 +102,7 @@ public class ImageUtils {
* @return false if image is neither dark nor blurry or if the input bitmapRegionDecoder provided is null * @return false if image is neither dark nor blurry or if the input bitmapRegionDecoder provided is null
* true if geolocation of the image and wikidata item are different * true if geolocation of the image and wikidata item are different
*/ */
public static boolean checkImageGeolocationIsDifferent(String geolocationOfFileString, String wikidataItemLocationString) { static boolean checkImageGeolocationIsDifferent(String geolocationOfFileString, String wikidataItemLocationString) {
Timber.d("Comparing geolocation of file with nearby place location"); Timber.d("Comparing geolocation of file with nearby place location");
if (geolocationOfFileString == null || geolocationOfFileString == "") { // Means that geolocation for this image is not given if (geolocationOfFileString == null || geolocationOfFileString == "") { // Means that geolocation for this image is not given
return false; // Since we don't know geolocation of file, we choose letting upload return false; // Since we don't know geolocation of file, we choose letting upload
@ -114,11 +114,8 @@ public class ImageUtils {
Double distance = LengthUtils.computeDistanceBetween( Double distance = LengthUtils.computeDistanceBetween(
new LatLng(Double.parseDouble(geolocationOfFile[0]),Double.parseDouble(geolocationOfFile[1]),0) new LatLng(Double.parseDouble(geolocationOfFile[0]),Double.parseDouble(geolocationOfFile[1]),0)
, new LatLng(Double.parseDouble(wikidataItemLocation[0]), Double.parseDouble(wikidataItemLocation[1]),0)); , new LatLng(Double.parseDouble(wikidataItemLocation[0]), Double.parseDouble(wikidataItemLocation[1]),0));
if ( distance >= 1000 ) {// Distance is more than 1 km, means that geolocation is wrong // Distance is more than 1 km, means that geolocation is wrong
return true; return distance >= 1000;
} else {
return false;
}
} }
private static boolean checkIfImageIsDark(Bitmap bitmap) { private static boolean checkIfImageIsDark(Bitmap bitmap) {