mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-01 15:23:54 +01:00
added condition in if statement
This commit is contained in:
parent
0f7ffc320e
commit
68c24c47e3
1 changed files with 4 additions and 4 deletions
|
|
@ -205,17 +205,17 @@ public class ExploreMapPresenter
|
||||||
* @return Returns true if search this area button is used around our current location
|
* @return Returns true if search this area button is used around our current location
|
||||||
*/
|
*/
|
||||||
public boolean searchCloseToCurrentLocation() {
|
public boolean searchCloseToCurrentLocation() {
|
||||||
if (null == exploreMapFragmentView.getLastMapFocus()) {
|
if (exploreMapFragmentView.getLastMapFocus() == null || exploreMapFragmentView.getMapFocus() == null) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Location mylocation = new Location("");
|
final Location mylocation = new Location("");
|
||||||
Location dest_location = new Location("");
|
final Location dest_location = new Location("");
|
||||||
dest_location.setLatitude(exploreMapFragmentView.getMapFocus().getLatitude());
|
dest_location.setLatitude(exploreMapFragmentView.getMapFocus().getLatitude());
|
||||||
dest_location.setLongitude(exploreMapFragmentView.getMapFocus().getLongitude());
|
dest_location.setLongitude(exploreMapFragmentView.getMapFocus().getLongitude());
|
||||||
mylocation.setLatitude(exploreMapFragmentView.getLastMapFocus().getLatitude());
|
mylocation.setLatitude(exploreMapFragmentView.getLastMapFocus().getLatitude());
|
||||||
mylocation.setLongitude(exploreMapFragmentView.getLastMapFocus().getLongitude());
|
mylocation.setLongitude(exploreMapFragmentView.getLastMapFocus().getLongitude());
|
||||||
Float distance = mylocation.distanceTo(dest_location);
|
final float distance = mylocation.distanceTo(dest_location);
|
||||||
|
|
||||||
if (distance > 2000.0 * 3 / 4) {
|
if (distance > 2000.0 * 3 / 4) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue