mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-11-04 00:33:55 +01:00 
			
		
		
		
	Fixed exception issue and pins issue
This commit is contained in:
		
							parent
							
								
									bc7ed146d9
								
							
						
					
					
						commit
						27c8443fa2
					
				
					 2 changed files with 5 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -602,8 +602,10 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
			
		|||
                if (lastFocusLocation == null && lastKnownLocation == null) {
 | 
			
		||||
                    locationPermissionGranted();
 | 
			
		||||
                }else if (updatedPlaceList != null){
 | 
			
		||||
                    if (updatedPlaceList.size() != 0){
 | 
			
		||||
                        loadPlacesDataAsync(updatedPlaceList, updatedLatLng);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                startMapWithoutPermission();
 | 
			
		||||
            }
 | 
			
		||||
| 
						 | 
				
			
			@ -1264,16 +1266,6 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
			
		|||
        compositeDisposable.add(nearbyPlacesInfoObservable
 | 
			
		||||
            .subscribeOn(Schedulers.io())
 | 
			
		||||
            .observeOn(AndroidSchedulers.mainThread())
 | 
			
		||||
            .retryWhen(errors -> errors
 | 
			
		||||
                .zipWith(Observable.range(1, 4), (throwable, retryCount) -> {
 | 
			
		||||
                    if (throwable instanceof InterruptedIOException && retryCount < 4) {
 | 
			
		||||
                        Timber.d("Retry attempt %d due to %s", retryCount, throwable.getMessage());
 | 
			
		||||
                        return retryCount;
 | 
			
		||||
                    }
 | 
			
		||||
                    throw new Exception(throwable);
 | 
			
		||||
                })
 | 
			
		||||
                .flatMap(retryCount -> Observable.timer(5, TimeUnit.SECONDS))
 | 
			
		||||
            )
 | 
			
		||||
            .subscribe(nearbyPlacesInfo -> {
 | 
			
		||||
                    if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
 | 
			
		||||
                        showErrorMessage(getString(R.string.no_nearby_places_around));
 | 
			
		||||
| 
						 | 
				
			
			@ -1311,16 +1303,6 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
			
		|||
        compositeDisposable.add(nearbyPlacesInfoObservable
 | 
			
		||||
            .subscribeOn(Schedulers.io())
 | 
			
		||||
            .observeOn(AndroidSchedulers.mainThread())
 | 
			
		||||
            .retryWhen(errors -> errors
 | 
			
		||||
                .zipWith(Observable.range(1, 4), (throwable, retryCount) -> {
 | 
			
		||||
                    if (throwable instanceof InterruptedIOException && retryCount < 4) {
 | 
			
		||||
                        Timber.d("Retry attempt %d due to %s", retryCount, throwable.getMessage());
 | 
			
		||||
                        return retryCount;
 | 
			
		||||
                    }
 | 
			
		||||
                    throw new Exception(throwable);
 | 
			
		||||
                })
 | 
			
		||||
                .flatMap(retryCount -> Observable.timer(5, TimeUnit.SECONDS))
 | 
			
		||||
            )
 | 
			
		||||
            .subscribe(nearbyPlacesInfo -> {
 | 
			
		||||
                    if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
 | 
			
		||||
                        showErrorMessage(getString(R.string.no_nearby_places_around));
 | 
			
		||||
| 
						 | 
				
			
			@ -1332,6 +1314,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
			
		|||
                            false);
 | 
			
		||||
                        lastMapFocus = new GeoPoint(searchLatLng.getLatitude(),
 | 
			
		||||
                            searchLatLng.getLongitude());
 | 
			
		||||
                        stopQuery();
 | 
			
		||||
                        loadPlacesDataAsync(nearbyPlacesInfo.placeList, nearbyPlacesInfo.currentLatLng);
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -159,7 +159,6 @@ public class NearbyParentFragmentPresenter
 | 
			
		|||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public void updateMapAndList(LocationChangeType locationChangeType) {
 | 
			
		||||
        nearbyParentFragmentView.stopQuery();
 | 
			
		||||
        Timber.d("Presenter updates map and list");
 | 
			
		||||
        if (isNearbyLocked) {
 | 
			
		||||
            Timber.d("Nearby is locked, so updateMapAndList returns");
 | 
			
		||||
| 
						 | 
				
			
			@ -326,6 +325,7 @@ public class NearbyParentFragmentPresenter
 | 
			
		|||
 | 
			
		||||
    public View.OnClickListener onSearchThisAreaClicked() {
 | 
			
		||||
        return v -> {
 | 
			
		||||
            nearbyParentFragmentView.stopQuery();
 | 
			
		||||
            // Lock map operations during search this area operation
 | 
			
		||||
//            nearbyParentFragmentView.setMapCenter();
 | 
			
		||||
            nearbyParentFragmentView.setSearchThisAreaButtonVisibility(false);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue