Fix image download buttons, wrong navigation
This commit is contained in:
parent
152129ec78
commit
25390e1d42
3 changed files with 30 additions and 37 deletions
|
@ -279,6 +279,19 @@ public class Amenity extends MapObject {
|
|||
}
|
||||
|
||||
public String getTagContent(String tag, String lang) {
|
||||
String translateName = getStrictTagContent(tag, lang);
|
||||
if (translateName != null) {
|
||||
return translateName;
|
||||
}
|
||||
for (String nm : getAdditionalInfoKeys()) {
|
||||
if (nm.startsWith(tag + ":")) {
|
||||
return getAdditionalInfo(nm);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getStrictTagContent(String tag, String lang) {
|
||||
if (lang != null) {
|
||||
String translateName = getAdditionalInfo(tag + ":" + lang);
|
||||
if (!Algorithms.isEmpty(translateName)) {
|
||||
|
@ -293,11 +306,6 @@ public class Amenity extends MapObject {
|
|||
if (!Algorithms.isEmpty(enName)) {
|
||||
return enName;
|
||||
}
|
||||
for (String nm : getAdditionalInfoKeys()) {
|
||||
if (nm.startsWith(tag + ":")) {
|
||||
return getAdditionalInfo(nm);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,21 +35,9 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
nightMode = !getMyApplication().getSettings().isLightContent();
|
||||
View view = inflater.inflate(R.layout.fragment_wikivoyage_show_images_first_time, container, false);
|
||||
view.findViewById(R.id.button_no).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app != null) {
|
||||
app.getSettings().WIKI_ARTICLE_SHOW_IMAGES.set(WikiArticleShowImages.OFF);
|
||||
}
|
||||
sendResult();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
TextView buttonDownload = view.findViewById(R.id.button_download);
|
||||
if (getMyApplication().getSettings().isWifiConnected()) {
|
||||
buttonDownload.setText(R.string.shared_string_only_with_wifi);
|
||||
buttonDownload.setOnClickListener(new View.OnClickListener() {
|
||||
TextView buttonNo = view.findViewById(R.id.button_no);
|
||||
buttonNo.setText(R.string.shared_string_only_with_wifi);
|
||||
buttonNo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
OsmandApplication app = getMyApplication();
|
||||
|
@ -60,8 +48,8 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
|||
dismiss();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
buttonDownload.setText(R.string.shared_string_show);
|
||||
TextView buttonDownload = view.findViewById(R.id.button_download);
|
||||
buttonDownload.setText(R.string.shared_string_always);
|
||||
buttonDownload.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -73,10 +61,7 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
|||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setupHeightAndBackground(view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -280,7 +280,7 @@ public class TravelObfHelper implements TravelHelper {
|
|||
res.originalId = 0;
|
||||
res.lang = lang;
|
||||
res.contentsJson = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.CONTENT_JSON, lang));
|
||||
res.aggregatedPartOf = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.IS_AGGR_PART, lang));
|
||||
res.aggregatedPartOf = Algorithms.emptyIfNull(amenity.getStrictTagContent(Amenity.IS_AGGR_PART, lang));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue