mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-30 22:34:02 +01:00 
			
		
		
		
	Add loadFromLocation method
This commit is contained in:
		
							parent
							
								
									fb3188914d
								
							
						
					
					
						commit
						ee27896589
					
				
					 1 changed files with 24 additions and 1 deletions
				
			
		|  | @ -16,6 +16,8 @@ import android.widget.ListAdapter; | |||
| import android.widget.ProgressBar; | ||||
| import android.widget.TextView; | ||||
| 
 | ||||
| import java.util.Collections; | ||||
| import java.util.Comparator; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import fr.free.nrw.commons.R; | ||||
|  | @ -62,7 +64,28 @@ public class NearbyListFragment extends ListFragment { | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     private static List<Attraction> loadAttractionsFromLocation(final LatLng curLatLng) { | ||||
|         //String closestCity = TouristAttractions.getClosestCity(curLatLng); | ||||
|         //if (closestCity != null) { | ||||
|         List<Attraction> attractions = TouristAttractions.get(); | ||||
|         if (curLatLng != null) { | ||||
|             Collections.sort(attractions, | ||||
|                     new Comparator<Attraction>() { | ||||
|                         @Override | ||||
|                         public int compare(Attraction lhs, Attraction rhs) { | ||||
|                             double lhsDistance = SphericalUtil.computeDistanceBetween( | ||||
|                                     lhs.location, curLatLng); | ||||
|                             double rhsDistance = SphericalUtil.computeDistanceBetween( | ||||
|                                     rhs.location, curLatLng); | ||||
|                             return (int) (lhsDistance - rhsDistance); | ||||
|                         } | ||||
|                     } | ||||
|             ); | ||||
|         } | ||||
|         return attractions; | ||||
|         //} | ||||
|         //return null; | ||||
|     } | ||||
| 
 | ||||
|     private class NearbyAdapter extends ArrayAdapter { | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 misaochan
						misaochan