mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-03 08:13:55 +01:00
Nearby offline pins: Add snackbar message
This commit is contained in:
parent
3a38a6636c
commit
5a1e0221f7
4 changed files with 18 additions and 1 deletions
|
|
@ -18,6 +18,8 @@ public interface NearbyParentFragmentContract {
|
||||||
|
|
||||||
boolean isNetworkConnectionEstablished();
|
boolean isNetworkConnectionEstablished();
|
||||||
|
|
||||||
|
void updateSnackbar(boolean offlinePinsShown);
|
||||||
|
|
||||||
void listOptionMenuItemClicked();
|
void listOptionMenuItemClicked();
|
||||||
|
|
||||||
void populatePlaces(LatLng currentLatLng);
|
void populatePlaces(LatLng currentLatLng);
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior.BottomSheetCa
|
||||||
import com.google.android.material.snackbar.Snackbar;
|
import com.google.android.material.snackbar.Snackbar;
|
||||||
import com.jakewharton.rxbinding2.view.RxView;
|
import com.jakewharton.rxbinding2.view.RxView;
|
||||||
import com.jakewharton.rxbinding3.appcompat.RxSearchView;
|
import com.jakewharton.rxbinding3.appcompat.RxSearchView;
|
||||||
import fr.free.nrw.commons.BaseMarker;
|
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
import fr.free.nrw.commons.CommonsApplication.BaseLogoutListener;
|
import fr.free.nrw.commons.CommonsApplication.BaseLogoutListener;
|
||||||
import fr.free.nrw.commons.MapController.NearbyPlacesInfo;
|
import fr.free.nrw.commons.MapController.NearbyPlacesInfo;
|
||||||
|
|
@ -1040,6 +1039,18 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateSnackbar(final boolean offlinePinsShown) {
|
||||||
|
if (!isNetworkErrorOccurred || snackbar == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (offlinePinsShown) {
|
||||||
|
snackbar.setText(R.string.nearby_showing_pins_offline);
|
||||||
|
} else {
|
||||||
|
snackbar.setText(R.string.no_internet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hide or expand bottom sheet according to states of all sheets
|
* Hide or expand bottom sheet according to states of all sheets
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -528,6 +528,9 @@ class NearbyParentFragmentPresenter
|
||||||
ensureActive()
|
ensureActive()
|
||||||
NearbyController.currentLocation = mapFocus
|
NearbyController.currentLocation = mapFocus
|
||||||
schedulePlacesUpdate(markerPlaceGroups, force = true)
|
schedulePlacesUpdate(markerPlaceGroups, force = true)
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
nearbyParentFragmentView.updateSnackbar(!markerPlaceGroups.isEmpty())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,7 @@
|
||||||
<string name="copy_wikicode">Copy the wikitext to the clipboard</string>
|
<string name="copy_wikicode">Copy the wikitext to the clipboard</string>
|
||||||
<string name="wikicode_copied">The wikitext was copied to the clipboard</string>
|
<string name="wikicode_copied">The wikitext was copied to the clipboard</string>
|
||||||
<string name="nearby_location_not_available">Nearby might not work properly, Location not available.</string>
|
<string name="nearby_location_not_available">Nearby might not work properly, Location not available.</string>
|
||||||
|
<string name="nearby_showing_pins_offline">Internet unavailable. Showing only cached places.</string>
|
||||||
<string name="upload_location_access_denied">Location access denied. Please set your location manually to use this feature.</string>
|
<string name="upload_location_access_denied">Location access denied. Please set your location manually to use this feature.</string>
|
||||||
<string name="location_permission_rationale_nearby">Permission required to display a list of nearby places</string>
|
<string name="location_permission_rationale_nearby">Permission required to display a list of nearby places</string>
|
||||||
<string name="location_permission_rationale_explore">Permission required to display a list of nearby images</string>
|
<string name="location_permission_rationale_explore">Permission required to display a list of nearby images</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue