use of net.osmand.plus.download.CustomRegion in project Osmand by osmandapp.
the class DownloadsItem method writeItemsToJson.
@NonNull
@Override
JSONObject writeItemsToJson(@NonNull JSONObject json) {
JSONArray jsonArray = new JSONArray();
if (!items.isEmpty()) {
try {
for (WorldRegion region : items) {
if (region instanceof CustomRegion) {
JSONObject regionJson = ((CustomRegion) region).toJson();
jsonArray.put(regionJson);
}
}
json.put("items", jsonArray);
} catch (JSONException e) {
warnings.add(app.getString(R.string.settings_item_write_error, String.valueOf(getType())));
SettingsHelper.LOG.error("Failed write to json", e);
}
}
return json;
}
use of net.osmand.plus.download.CustomRegion in project Osmand by osmandapp.
the class DownloadResourceGroupFragment method updateDescriptionView.
private void updateDescriptionView() {
if (descriptionView != null) {
if (group != null && group.getRegion() instanceof CustomRegion) {
CustomRegion customRegion = (CustomRegion) group.getRegion();
DownloadDescriptionInfo descriptionInfo = customRegion.getDescriptionInfo();
if (descriptionInfo != null) {
OsmandApplication app = activity.getMyApplication();
TextView description = descriptionView.findViewById(R.id.description);
updateDescription(app, descriptionInfo, description);
ViewGroup buttonsContainer = descriptionView.findViewById(R.id.buttons_container);
updateActionButtons(activity, descriptionInfo, null, buttonsContainer, R.layout.download_description_button, nightMode);
LockableViewPager viewPager = descriptionView.findViewById(R.id.images_pager);
updateImagesPager(app, descriptionInfo, viewPager);
descriptionView.findViewById(R.id.container).setVisibility(View.VISIBLE);
return;
}
}
descriptionView.findViewById(R.id.container).setVisibility(View.GONE);
}
}
Aggregations