mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-19 04:53:36 +00:00
[Android] Fix crash when selectedCountry is null
Signed-off-by: map-per <map-per@gmx.de>
This commit is contained in:
@@ -692,6 +692,7 @@ public class PlacePageView extends Fragment
|
|||||||
{
|
{
|
||||||
UiUtils.showIf(Editor.nativeShouldShowEditPlace(), mEditPlace);
|
UiUtils.showIf(Editor.nativeShouldShowEditPlace(), mEditPlace);
|
||||||
UiUtils.showIf(Editor.nativeShouldShowAddPlace(), mAddPlace);
|
UiUtils.showIf(Editor.nativeShouldShowAddPlace(), mAddPlace);
|
||||||
|
UiUtils.hide(mMapTooOld);
|
||||||
MaterialButton mTvEditPlace = mEditPlace.findViewById(R.id.mb__place_editor);
|
MaterialButton mTvEditPlace = mEditPlace.findViewById(R.id.mb__place_editor);
|
||||||
MaterialButton mTvAddPlace = mAddPlace.findViewById(R.id.mb__place_add);
|
MaterialButton mTvAddPlace = mAddPlace.findViewById(R.id.mb__place_add);
|
||||||
|
|
||||||
@@ -711,26 +712,31 @@ public class PlacePageView extends Fragment
|
|||||||
Utils.showSnackbar(v.getContext(), v.getRootView(), R.string.place_page_too_old_to_edit);
|
Utils.showSnackbar(v.getContext(), v.getRootView(), R.string.place_page_too_old_to_edit);
|
||||||
});
|
});
|
||||||
|
|
||||||
CountryItem map = CountryItem.fill(MapManager.nativeGetSelectedCountry());
|
String countryId = MapManager.nativeGetSelectedCountry();
|
||||||
|
|
||||||
|
if (countryId != null)
|
||||||
|
{
|
||||||
|
CountryItem map = CountryItem.fill(countryId);
|
||||||
|
|
||||||
if (map.status == CountryItem.STATUS_UPDATABLE || map.status == CountryItem.STATUS_DONE
|
if (map.status == CountryItem.STATUS_UPDATABLE || map.status == CountryItem.STATUS_DONE
|
||||||
|| map.status == CountryItem.STATUS_FAILED)
|
|| map.status == CountryItem.STATUS_FAILED)
|
||||||
{
|
{
|
||||||
mMapTooOld.setVisibility(VISIBLE);
|
UiUtils.show(mMapTooOld);
|
||||||
MaterialButton mTvUpdateTooOldMap = mMapTooOld.findViewById(R.id.mb__update_too_old_map);
|
|
||||||
boolean canUpdateMap = map.status != CountryItem.STATUS_DONE;
|
|
||||||
|
|
||||||
|
boolean canUpdateMap = map.status != CountryItem.STATUS_DONE;
|
||||||
|
MaterialButton mTvUpdateTooOldMap = mMapTooOld.findViewById(R.id.mb__update_too_old_map);
|
||||||
|
UiUtils.showIf(canUpdateMap, mTvUpdateTooOldMap);
|
||||||
|
|
||||||
|
MaterialTextView mapTooOldDescription = mMapTooOld.findViewById(R.id.tv__map_too_old_description);
|
||||||
if (canUpdateMap)
|
if (canUpdateMap)
|
||||||
{
|
{
|
||||||
|
mapTooOldDescription.setText(R.string.place_page_map_too_old_description);
|
||||||
mTvUpdateTooOldMap.setOnClickListener((v) -> {
|
mTvUpdateTooOldMap.setOnClickListener((v) -> {
|
||||||
MapManagerHelper.warn3gAndDownload(requireActivity(), map.id, null);
|
MapManagerHelper.warn3gAndDownload(requireActivity(), map.id, null);
|
||||||
mMapTooOld.setVisibility(GONE);
|
UiUtils.hide(mMapTooOld);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
mTvUpdateTooOldMap.setVisibility(GONE);
|
|
||||||
MaterialTextView mapTooOldDescription = mMapTooOld.findViewById(R.id.tv__map_too_old_description);
|
|
||||||
mapTooOldDescription.setText(R.string.place_page_app_too_old_description);
|
mapTooOldDescription.setText(R.string.place_page_app_too_old_description);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user