Skip to content

Commit

Permalink
Merge pull request #21893 from osmandapp/fix_non_ui_context
Browse files Browse the repository at this point in the history
Fixed non ui context on ContextMenu creation
  • Loading branch information
Chumva authored Feb 12, 2025
2 parents 2d8d6d0 + 3f7f7ab commit c4a0887
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
6 changes: 3 additions & 3 deletions OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ private CollapsableView getWithinCollapsableView(@NonNull List<MenuObject> menuO
LinearLayout llv = buildCollapsableContentView(mapActivity, true, true);
for (int i = 0; i < menuObjects.size(); i++) {
MenuObject menuObject = menuObjects.get(i);
View container = createRowContainer(app, null);
View container = createRowContainer(mapActivity, null);
String rowTextPrefix, rowText;
String title = menuObject.getTitleStr();
if (title.contains(":")) {
Expand Down Expand Up @@ -1423,7 +1423,7 @@ protected void buildNearestWikiRow(ViewGroup viewGroup, SearchAmenitiesListener
private void buildGetWikipediaBanner(ViewGroup viewGroup) {
boolean light = isLightContent();
OsmAndFeature feature = OsmAndFeature.WIKIPEDIA;
LinearLayout view = buildCollapsableContentView(app, false, true);
LinearLayout view = buildCollapsableContentView(viewGroup.getContext(), false, true);

View banner = UiUtilities.getInflater(mapActivity, !light)
.inflate(R.layout.get_wikipedia_context_menu_banner, view, false);
Expand All @@ -1439,7 +1439,7 @@ private void buildGetWikipediaBanner(ViewGroup viewGroup) {
}
});

View row = createRowContainer(app, NEAREST_WIKI_KEY);
View row = createRowContainer(viewGroup.getContext(), NEAREST_WIKI_KEY);
view.addView(banner);
String text = app.getString(R.string.wiki_around);
CollapsableView collapsableView = new CollapsableView(view, this, false);
Expand Down
3 changes: 1 addition & 2 deletions OsmAnd/src/net/osmand/plus/search/NearbyPlacesAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class NearbyPlacesAdapter(
}

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): NearbyViewHolder {
val app = parent.context.applicationContext as OsmandApplication
val inflater = UiUtilities.getInflater(app, isNightMode())
val inflater = UiUtilities.getInflater(parent.context, isNightMode())
val view = inflater.inflate(
if (isVertical) R.layout.search_nearby_item_vertical else R.layout.search_nearby_item,
parent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected int getLayoutId() {

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
LayoutInflater themedInflater = UiUtilities.getInflater(app, !app.getSettings().isLightContent());
LayoutInflater themedInflater = UiUtilities.getInflater(requireContext(), !app.getSettings().isLightContent());
return themedInflater.inflate(getLayoutId(), container, false);
}

Expand Down

0 comments on commit c4a0887

Please sign in to comment.