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) {
|
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) {
|
if (lang != null) {
|
||||||
String translateName = getAdditionalInfo(tag + ":" + lang);
|
String translateName = getAdditionalInfo(tag + ":" + lang);
|
||||||
if (!Algorithms.isEmpty(translateName)) {
|
if (!Algorithms.isEmpty(translateName)) {
|
||||||
|
@ -293,11 +306,6 @@ public class Amenity extends MapObject {
|
||||||
if (!Algorithms.isEmpty(enName)) {
|
if (!Algorithms.isEmpty(enName)) {
|
||||||
return enName;
|
return enName;
|
||||||
}
|
}
|
||||||
for (String nm : getAdditionalInfoKeys()) {
|
|
||||||
if (nm.startsWith(tag + ":")) {
|
|
||||||
return getAdditionalInfo(nm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,23 +33,11 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
nightMode=!getMyApplication().getSettings().isLightContent();
|
nightMode = !getMyApplication().getSettings().isLightContent();
|
||||||
View view = inflater.inflate(R.layout.fragment_wikivoyage_show_images_first_time, container, false);
|
View view = inflater.inflate(R.layout.fragment_wikivoyage_show_images_first_time, container, false);
|
||||||
view.findViewById(R.id.button_no).setOnClickListener(new View.OnClickListener() {
|
TextView buttonNo = view.findViewById(R.id.button_no);
|
||||||
@Override
|
buttonNo.setText(R.string.shared_string_only_with_wifi);
|
||||||
public void onClick(View v) {
|
buttonNo.setOnClickListener(new View.OnClickListener() {
|
||||||
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() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
|
@ -60,8 +48,8 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
TextView buttonDownload = view.findViewById(R.id.button_download);
|
||||||
buttonDownload.setText(R.string.shared_string_show);
|
buttonDownload.setText(R.string.shared_string_always);
|
||||||
buttonDownload.setOnClickListener(new View.OnClickListener() {
|
buttonDownload.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -73,10 +61,7 @@ public class WikivoyageShowPicturesDialogFragment extends BottomSheetDialogFragm
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
setupHeightAndBackground(view);
|
setupHeightAndBackground(view);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -280,7 +280,7 @@ public class TravelObfHelper implements TravelHelper {
|
||||||
res.originalId = 0;
|
res.originalId = 0;
|
||||||
res.lang = lang;
|
res.lang = lang;
|
||||||
res.contentsJson = Algorithms.emptyIfNull(amenity.getTagContent(Amenity.CONTENT_JSON, 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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue