Fix "Directions->Options->GPX route" theme of popup is switching immediately

This commit is contained in:
Dima-1 2019-11-12 16:44:28 +03:00
parent 0d5d1dacca
commit 9c588dce95

View file

@ -4,6 +4,7 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v7.view.ContextThemeWrapper;
import android.support.v7.widget.PopupMenu; import android.support.v7.widget.PopupMenu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
@ -426,9 +427,9 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
}, nightMode); }, nightMode);
} }
private void showOptionsMenu(final TextView gpxSpinner) { private void showOptionsMenu(View view) {
RouteProvider.GPXRouteParamsBuilder rp = mapActivity.getRoutingHelper().getCurrentGPXRoute(); RouteProvider.GPXRouteParamsBuilder rp = mapActivity.getRoutingHelper().getCurrentGPXRoute();
final PopupMenu optionsMenu = new PopupMenu(gpxSpinner.getContext(), gpxSpinner); final PopupMenu optionsMenu = new PopupMenu(new ContextThemeWrapper(view.getContext(), themeRes), view);
MenuItem item = optionsMenu.getMenu().add( MenuItem item = optionsMenu.getMenu().add(
mapActivity.getString(R.string.shared_string_none)); mapActivity.getString(R.string.shared_string_none));
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {