Small fixes
This commit is contained in:
parent
447682d319
commit
81089f916d
6 changed files with 15 additions and 13 deletions
|
@ -220,7 +220,7 @@ public class Amenity extends MapObject {
|
|||
return lng;
|
||||
}
|
||||
|
||||
public Set<String> getSupportedLocales() {
|
||||
public Set<String> getSupportedContentLocales() {
|
||||
Set<String> supported = new TreeSet<>();
|
||||
supported.addAll(getNames("content", "en"));
|
||||
supported.addAll(getNames("description", "en"));
|
||||
|
|
|
@ -266,7 +266,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
WikipediaDialogFragment.showInstance(mapActivity, amenity, null);
|
||||
WikipediaDialogFragment.showInstance(mapActivity, amenity);
|
||||
}
|
||||
});
|
||||
button.setAllCaps(true);
|
||||
|
@ -405,7 +405,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
|
||||
if (amenity.getType().isWiki()) {
|
||||
if (!hasWiki) {
|
||||
String articleLang = WikipediaPoiMenu.getWikiArticleLanguage(app, amenity.getSupportedLocales(), preferredLang);
|
||||
String articleLang = WikipediaPoiMenu.getWikiArticleLanguage(app, amenity.getSupportedContentLocales(), preferredLang);
|
||||
String lng = amenity.getContentLanguage("content", articleLang, "en");
|
||||
if (Algorithms.isEmpty(lng)) {
|
||||
lng = "en";
|
||||
|
|
|
@ -72,7 +72,7 @@ public class AmenityMenuController extends MenuController {
|
|||
public void buttonPressed() {
|
||||
MapActivity activity = getMapActivity();
|
||||
if (activity != null) {
|
||||
WikipediaDialogFragment.showInstance(activity, amenity, null);
|
||||
WikipediaDialogFragment.showInstance(activity, amenity);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -57,9 +57,6 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
app = requiredMyApplication();
|
||||
settings = app.getSettings();
|
||||
initLanguagesData();
|
||||
if (savedInstanceState != null) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,8 +67,6 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
|
||||
@Override
|
||||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
|
||||
boolean nightMode = isNightMode(app);
|
||||
final int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
|
||||
final int profileColorResId = appMode.getIconColorInfo().getColor(nightMode);
|
||||
|
||||
|
@ -203,7 +198,6 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
}
|
||||
|
||||
private View getCustomButtonView() {
|
||||
boolean nightMode = isNightMode(app);
|
||||
OsmandApplication app = getMyApplication();
|
||||
if (app == null) {
|
||||
return null;
|
||||
|
@ -224,6 +218,14 @@ public class SelectWikiLanguagesBottomSheet extends MenuBottomSheetDialogFragmen
|
|||
return buttonView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if (requireActivity().isChangingConfigurations()) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
public void setAppMode(ApplicationMode appMode) {
|
||||
this.appMode = appMode;
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
|
|||
Context context = getContext();
|
||||
if (context != null) {
|
||||
final PopupMenu optionsMenu = new PopupMenu(context, view, Gravity.RIGHT);
|
||||
Set<String> namesSet = amenity.getSupportedLocales();
|
||||
Set<String> namesSet = amenity.getSupportedContentLocales();
|
||||
|
||||
Map<String, String> names = new HashMap<>();
|
||||
for (String n : namesSet) {
|
||||
|
@ -283,7 +283,7 @@ public class WikipediaDialogFragment extends WikiArticleBaseDialogFragment {
|
|||
WikipediaDialogFragment wikipediaDialogFragment = new WikipediaDialogFragment();
|
||||
wikipediaDialogFragment.setAmenity(amenity);
|
||||
lang = lang != null ? lang : WikipediaPoiMenu.getWikiArticleLanguage(app,
|
||||
amenity.getSupportedLocales(), app.getSettings().MAP_PREFERRED_LOCALE.get());
|
||||
amenity.getSupportedContentLocales(), app.getSettings().MAP_PREFERRED_LOCALE.get());
|
||||
wikipediaDialogFragment.setLanguage(lang);
|
||||
wikipediaDialogFragment.setRetainInstance(true);
|
||||
wikipediaDialogFragment.show(activity.getSupportFragmentManager(), TAG);
|
||||
|
|
|
@ -394,7 +394,7 @@ public class WikipediaPoiMenu {
|
|||
// global Wikipedia POI filter enabled
|
||||
return preferredLanguage;
|
||||
}
|
||||
if (TextUtils.isEmpty(preferredLanguage)) {
|
||||
if (Algorithms.isEmpty(preferredLanguage)) {
|
||||
preferredLanguage = app.getLanguage();
|
||||
}
|
||||
List<String> wikiLangs = wikiPoiSettings.getStringArrayList(ENABLED_WIKI_POI_LANGUAGES_KEY);
|
||||
|
|
Loading…
Reference in a new issue