Skip to content

Commit 92e20b4

Browse files
committed
Moved code to reduce feature envy.
1 parent 1c43426 commit 92e20b4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

app/src/main/java/fr/free/nrw/commons/location/LatLng.java

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package fr.free.nrw.commons.location;
22

33
import android.location.Location;
4+
import android.net.Uri;
45
import android.support.annotation.NonNull;
56

67
public class LatLng {
@@ -129,4 +130,8 @@ public double getLongitude() {
129130
public double getLatitude() {
130131
return latitude;
131132
}
133+
134+
public Uri getGmmIntentUri() {
135+
return Uri.parse("geo:0,0?q=" + latitude + "," + longitude);
136+
}
132137
}

app/src/main/java/fr/free/nrw/commons/nearby/Place.java

+12
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ public void setDistance(String distance) {
4242
this.distance = distance;
4343
}
4444

45+
public boolean hasWikipediaLink() {
46+
return !(siteLinks == null || Uri.EMPTY.equals(siteLinks.getWikipediaLink()));
47+
}
48+
49+
public boolean hasWikidataLink() {
50+
return !(siteLinks == null || Uri.EMPTY.equals(siteLinks.getWikidataLink()));
51+
}
52+
53+
public boolean hasCommonsLink() {
54+
return !(siteLinks == null || Uri.EMPTY.equals(siteLinks.getCommonsLink()));
55+
}
56+
4557
@Override
4658
public boolean equals(Object o) {
4759
if (o instanceof Place) {

0 commit comments

Comments
 (0)