Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed non ui context on ContextMenu creation #21893

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading