Skip to content

Commit a4a037a

Browse files
maskaravivekmisaochan
authored andcommitted
Use large heap size for commons app (commons-app#2261)
1 parent ed51d8b commit a4a037a

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

app/src/main/AndroidManifest.xml

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
android:icon="@mipmap/ic_launcher"
2929
android:label="@string/app_name"
3030
android:theme="@style/LightAppTheme"
31+
android:largeHeap="true"
32+
android:hardwareAccelerated="false"
3133
android:supportsRtl="true" >
3234
<activity android:name="org.acra.CrashReportDialog"
3335
android:theme="@android:style/Theme.Dialog"

app/src/main/java/fr/free/nrw/commons/utils/ImageUtils.java

+7-10
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,16 @@
3535

3636
public class ImageUtils {
3737

38-
public static final int IMAGE_DARK = 1;
39-
public static final int IMAGE_BLURRY = 1 << 1;
38+
static final int IMAGE_DARK = 1;
39+
static final int IMAGE_BLURRY = 1 << 1;
4040
public static final int IMAGE_DUPLICATE = 1 << 2;
4141
public static final int IMAGE_GEOLOCATION_DIFFERENT = 1 << 3;
4242
public static final int IMAGE_OK = 0;
4343
public static final int IMAGE_KEEP = -1;
4444
public static final int IMAGE_WAIT = -2;
4545
public static final int EMPTY_TITLE = -3;
4646
public static final int FILE_NAME_EXISTS = -4;
47-
public static final int NO_CATEGORY_SELECTED = -5;
47+
static final int NO_CATEGORY_SELECTED = -5;
4848

4949
@IntDef(
5050
flag = true,
@@ -70,7 +70,7 @@ public class ImageUtils {
7070
* @return IMAGE_OK if image is neither dark nor blurry or if the input bitmapRegionDecoder provided is null
7171
* IMAGE_DARK if image is too dark
7272
*/
73-
public static @Result
73+
static @Result
7474
int checkIfImageIsTooDark(BitmapRegionDecoder bitmapRegionDecoder) {
7575
if (bitmapRegionDecoder == null) {
7676
Timber.e("Expected bitmapRegionDecoder was null");
@@ -102,7 +102,7 @@ int checkIfImageIsTooDark(BitmapRegionDecoder bitmapRegionDecoder) {
102102
* @return false if image is neither dark nor blurry or if the input bitmapRegionDecoder provided is null
103103
* true if geolocation of the image and wikidata item are different
104104
*/
105-
public static boolean checkImageGeolocationIsDifferent(String geolocationOfFileString, String wikidataItemLocationString) {
105+
static boolean checkImageGeolocationIsDifferent(String geolocationOfFileString, String wikidataItemLocationString) {
106106
Timber.d("Comparing geolocation of file with nearby place location");
107107
if (geolocationOfFileString == null || geolocationOfFileString == "") { // Means that geolocation for this image is not given
108108
return false; // Since we don't know geolocation of file, we choose letting upload
@@ -114,11 +114,8 @@ public static boolean checkImageGeolocationIsDifferent(String geolocationOfFileS
114114
Double distance = LengthUtils.computeDistanceBetween(
115115
new LatLng(Double.parseDouble(geolocationOfFile[0]),Double.parseDouble(geolocationOfFile[1]),0)
116116
, new LatLng(Double.parseDouble(wikidataItemLocation[0]), Double.parseDouble(wikidataItemLocation[1]),0));
117-
if ( distance >= 1000 ) {// Distance is more than 1 km, means that geolocation is wrong
118-
return true;
119-
} else {
120-
return false;
121-
}
117+
// Distance is more than 1 km, means that geolocation is wrong
118+
return distance >= 1000;
122119
}
123120

124121
private static boolean checkIfImageIsDark(Bitmap bitmap) {

0 commit comments

Comments
 (0)