Exemplo n.º 1
0
 public String getBuildFileName() {
   LocationProvider locationProvider = getAntModel().getLocationProvider();
   if (locationProvider != null) {
     IFile file = locationProvider.getFile();
     if (file != null) {
       return file.getFullPath().toOSString();
     }
   }
   return null;
 }
 private void reloadLocation() {
   if (isLoadingLocation) return;
   isLoadingLocation = true;
   if (locationProvider == null) {
     locationProvider = new LocationProvider(this);
   }
   locationProvider.requestLocation(
       new LocationProvider.LocationResultListener() {
         @Override
         public void onLocationResult(
             boolean success, String city, String area, double latitude, double longitude) {
           isLoadingLocation = false;
           if (LocationSearchActivity.this.isFinishing()) return;
           if (success) {
             currentCity = city;
             currentArea = area;
             LocationSearchActivity.this.latitude = latitude;
             LocationSearchActivity.this.longitude = longitude;
             if (!(selectedLocation != null
                 && selectedLocation.type == LocationObject.Type.City
                 && selectedLocation.name.equals(currentCity))) {
               chooseAdapter.list.add(1, LocationObject.city(currentCity, latitude, longitude));
               chooseAdapter.notifyDataSetChanged();
             }
             LatLng latLng = new LatLng(latitude, longitude);
             chooseAdapter.searcher.configure(LocationSearchActivity.this, latLng, chooseAdapter);
             searchAdapter.searcher.configure(LocationSearchActivity.this, latLng, searchAdapter);
             LocationSearchActivity.this.supportInvalidateOptionsMenu();
             loadMore();
           } else {
             currentCity = null;
             mFootUpdate.showFail();
           }
         }
       });
 }
Exemplo n.º 3
0
 @Override
 protected void onPause() {
   super.onPause();
   locationProvider.disconnect();
 }
Exemplo n.º 4
0
 @Override
 protected void onResume() {
   super.onResume();
   setUpMapIfNeeded();
   locationProvider.connect();
 }