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,7 +602,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
				
			||||||
                if (lastFocusLocation == null && lastKnownLocation == null) {
 | 
					                if (lastFocusLocation == null && lastKnownLocation == null) {
 | 
				
			||||||
                    locationPermissionGranted();
 | 
					                    locationPermissionGranted();
 | 
				
			||||||
                }else if (updatedPlaceList != null){
 | 
					                }else if (updatedPlaceList != null){
 | 
				
			||||||
                    loadPlacesDataAsync(updatedPlaceList, updatedLatLng);
 | 
					                    if (updatedPlaceList.size() != 0){
 | 
				
			||||||
 | 
					                        loadPlacesDataAsync(updatedPlaceList, updatedLatLng);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                startMapWithoutPermission();
 | 
					                startMapWithoutPermission();
 | 
				
			||||||
| 
						 | 
					@ -1264,16 +1266,6 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
				
			||||||
        compositeDisposable.add(nearbyPlacesInfoObservable
 | 
					        compositeDisposable.add(nearbyPlacesInfoObservable
 | 
				
			||||||
            .subscribeOn(Schedulers.io())
 | 
					            .subscribeOn(Schedulers.io())
 | 
				
			||||||
            .observeOn(AndroidSchedulers.mainThread())
 | 
					            .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 -> {
 | 
					            .subscribe(nearbyPlacesInfo -> {
 | 
				
			||||||
                    if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
 | 
					                    if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
 | 
				
			||||||
                        showErrorMessage(getString(R.string.no_nearby_places_around));
 | 
					                        showErrorMessage(getString(R.string.no_nearby_places_around));
 | 
				
			||||||
| 
						 | 
					@ -1311,16 +1303,6 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
				
			||||||
        compositeDisposable.add(nearbyPlacesInfoObservable
 | 
					        compositeDisposable.add(nearbyPlacesInfoObservable
 | 
				
			||||||
            .subscribeOn(Schedulers.io())
 | 
					            .subscribeOn(Schedulers.io())
 | 
				
			||||||
            .observeOn(AndroidSchedulers.mainThread())
 | 
					            .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 -> {
 | 
					            .subscribe(nearbyPlacesInfo -> {
 | 
				
			||||||
                    if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
 | 
					                    if (nearbyPlacesInfo.placeList == null || nearbyPlacesInfo.placeList.isEmpty()) {
 | 
				
			||||||
                        showErrorMessage(getString(R.string.no_nearby_places_around));
 | 
					                        showErrorMessage(getString(R.string.no_nearby_places_around));
 | 
				
			||||||
| 
						 | 
					@ -1332,6 +1314,7 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
 | 
				
			||||||
                            false);
 | 
					                            false);
 | 
				
			||||||
                        lastMapFocus = new GeoPoint(searchLatLng.getLatitude(),
 | 
					                        lastMapFocus = new GeoPoint(searchLatLng.getLatitude(),
 | 
				
			||||||
                            searchLatLng.getLongitude());
 | 
					                            searchLatLng.getLongitude());
 | 
				
			||||||
 | 
					                        stopQuery();
 | 
				
			||||||
                        loadPlacesDataAsync(nearbyPlacesInfo.placeList, nearbyPlacesInfo.currentLatLng);
 | 
					                        loadPlacesDataAsync(nearbyPlacesInfo.placeList, nearbyPlacesInfo.currentLatLng);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -159,7 +159,6 @@ public class NearbyParentFragmentPresenter
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void updateMapAndList(LocationChangeType locationChangeType) {
 | 
					    public void updateMapAndList(LocationChangeType locationChangeType) {
 | 
				
			||||||
        nearbyParentFragmentView.stopQuery();
 | 
					 | 
				
			||||||
        Timber.d("Presenter updates map and list");
 | 
					        Timber.d("Presenter updates map and list");
 | 
				
			||||||
        if (isNearbyLocked) {
 | 
					        if (isNearbyLocked) {
 | 
				
			||||||
            Timber.d("Nearby is locked, so updateMapAndList returns");
 | 
					            Timber.d("Nearby is locked, so updateMapAndList returns");
 | 
				
			||||||
| 
						 | 
					@ -326,6 +325,7 @@ public class NearbyParentFragmentPresenter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public View.OnClickListener onSearchThisAreaClicked() {
 | 
					    public View.OnClickListener onSearchThisAreaClicked() {
 | 
				
			||||||
        return v -> {
 | 
					        return v -> {
 | 
				
			||||||
 | 
					            nearbyParentFragmentView.stopQuery();
 | 
				
			||||||
            // Lock map operations during search this area operation
 | 
					            // Lock map operations during search this area operation
 | 
				
			||||||
//            nearbyParentFragmentView.setMapCenter();
 | 
					//            nearbyParentFragmentView.setMapCenter();
 | 
				
			||||||
            nearbyParentFragmentView.setSearchThisAreaButtonVisibility(false);
 | 
					            nearbyParentFragmentView.setSearchThisAreaButtonVisibility(false);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue