Theme change fixes second part
This commit is contained in:
parent
7eed0c04e3
commit
bab9d58ac8
5 changed files with 28 additions and 18 deletions
|
@ -46,6 +46,7 @@ import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||||
import net.osmand.plus.activities.actions.OsmandRestoreOrExitDialog;
|
import net.osmand.plus.activities.actions.OsmandRestoreOrExitDialog;
|
||||||
|
@ -82,9 +83,6 @@ import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CHOSEN_PROFILE_TAG;
|
|
||||||
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CONTROL_BUTTON_TAG;
|
|
||||||
import static net.osmand.plus.ContextMenuAdapter.PROFILES_NORMAL_PROFILE_TAG;
|
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_MAP_ID;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_CONFIGURE_SCREEN_ID;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_DASHBOARD_ID;
|
||||||
|
@ -105,6 +103,9 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_D
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
|
||||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_SEARCH_NEARBY;
|
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_SEARCH_NEARBY;
|
||||||
|
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CHOSEN_PROFILE_TAG;
|
||||||
|
import static net.osmand.plus.ContextMenuAdapter.PROFILES_CONTROL_BUTTON_TAG;
|
||||||
|
import static net.osmand.plus.ContextMenuAdapter.PROFILES_NORMAL_PROFILE_TAG;
|
||||||
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
import static net.osmand.plus.helpers.ImportHelper.GPX_SUFFIX;
|
||||||
|
|
||||||
|
|
||||||
|
@ -191,9 +192,11 @@ public class MapActivityActions implements DialogProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dialog createAddWaypointDialog(final Bundle args) {
|
private Dialog createAddWaypointDialog(final Bundle args) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(mapActivity, nightMode));
|
||||||
builder.setTitle(R.string.add_waypoint_dialog_title);
|
builder.setTitle(R.string.add_waypoint_dialog_title);
|
||||||
View view = mapActivity.getLayoutInflater().inflate(R.layout.add_gpx_point_dialog, null);
|
|
||||||
|
View view = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.add_gpx_point_dialog, null);
|
||||||
final EditText editText = (EditText) view.findViewById(android.R.id.edit);
|
final EditText editText = (EditText) view.findViewById(android.R.id.edit);
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand.plus.mapcontextmenu.editors;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.Color;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -28,6 +27,7 @@ import android.widget.TextView;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||||
|
@ -44,7 +44,8 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
|
||||||
view = inflater.inflate(R.layout.point_editor_fragment, container, false);
|
boolean nightMode = !getMyApplication().getSettings().isLightContent();
|
||||||
|
view = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.point_editor_fragment, container, false);
|
||||||
|
|
||||||
PointEditor editor = getEditor();
|
PointEditor editor = getEditor();
|
||||||
if (editor == null) {
|
if (editor == null) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package net.osmand.plus.mapmarkers;
|
package net.osmand.plus.mapmarkers;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
@ -35,6 +36,7 @@ import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.OsmandSettings.MapMarkersMode;
|
import net.osmand.plus.OsmandSettings.MapMarkersMode;
|
||||||
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
import net.osmand.plus.OsmandSettings.OsmandPreference;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
@ -61,7 +63,7 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
|
||||||
final OsmandSettings settings = getSettings();
|
final OsmandSettings settings = getSettings();
|
||||||
helpImgHeight = getResources().getDimensionPixelSize(R.dimen.action_bar_image_height);
|
helpImgHeight = getResources().getDimensionPixelSize(R.dimen.action_bar_image_height);
|
||||||
|
|
||||||
mainView = inflater.inflate(R.layout.fragment_direction_indication_dialog, container);
|
mainView = UiUtilities.getInflater(getContext(), !settings.isLightContent()).inflate(R.layout.fragment_direction_indication_dialog, container);
|
||||||
|
|
||||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.toolbar);
|
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.toolbar);
|
||||||
toolbar.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
toolbar.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||||
|
@ -114,20 +116,21 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
|
||||||
menuTv.setOnClickListener(new View.OnClickListener() {
|
menuTv.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
Context themedContext = UiUtilities.getThemedContext(getActivity(), !settings.isLightContent());
|
||||||
CharSequence[] titles = getMenuTitles();
|
CharSequence[] titles = getMenuTitles();
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setTextSize(getResources().getDimensionPixelSize(R.dimen.default_list_text_size));
|
paint.setTextSize(getResources().getDimensionPixelSize(R.dimen.default_list_text_size));
|
||||||
float titleTextWidth = Math.max(paint.measureText(titles[0].toString()), paint.measureText(titles[1].toString()));
|
float titleTextWidth = Math.max(paint.measureText(titles[0].toString()), paint.measureText(titles[1].toString()));
|
||||||
float itemWidth = titleTextWidth + AndroidUtils.dpToPx(getActivity(), 32);
|
float itemWidth = titleTextWidth + AndroidUtils.dpToPx(themedContext, 32);
|
||||||
float minWidth = AndroidUtils.dpToPx(getActivity(), 100);
|
float minWidth = AndroidUtils.dpToPx(themedContext, 100);
|
||||||
final ListPopupWindow listPopupWindow = new ListPopupWindow(getActivity());
|
final ListPopupWindow listPopupWindow = new ListPopupWindow(themedContext);
|
||||||
listPopupWindow.setAnchorView(menuTv);
|
listPopupWindow.setAnchorView(menuTv);
|
||||||
listPopupWindow.setContentWidth((int) (Math.max(itemWidth, minWidth)));
|
listPopupWindow.setContentWidth((int) (Math.max(itemWidth, minWidth)));
|
||||||
listPopupWindow.setDropDownGravity(Gravity.END | Gravity.TOP);
|
listPopupWindow.setDropDownGravity(Gravity.END | Gravity.TOP);
|
||||||
listPopupWindow.setHorizontalOffset(AndroidUtils.dpToPx(getActivity(), 8));
|
listPopupWindow.setHorizontalOffset(AndroidUtils.dpToPx(themedContext, 8));
|
||||||
listPopupWindow.setVerticalOffset(-menuTv.getHeight());
|
listPopupWindow.setVerticalOffset(-menuTv.getHeight());
|
||||||
listPopupWindow.setModal(true);
|
listPopupWindow.setModal(true);
|
||||||
listPopupWindow.setAdapter(new ArrayAdapter<>(getActivity(), R.layout.popup_list_text_item, titles));
|
listPopupWindow.setAdapter(new ArrayAdapter<>(themedContext, R.layout.popup_list_text_item, titles));
|
||||||
listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
|
|
@ -39,6 +39,7 @@ import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
@ -716,7 +717,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
||||||
final OsmandApplication app = mapActivity.getMyApplication();
|
final OsmandApplication app = mapActivity.getMyApplication();
|
||||||
final WaypointDialogHelper helper = mapActivity.getDashboard().getWaypointDialogHelper();
|
final WaypointDialogHelper helper = mapActivity.getDashboard().getWaypointDialogHelper();
|
||||||
if (v == null || v.findViewById(R.id.info_close) == null) {
|
if (v == null || v.findViewById(R.id.info_close) == null) {
|
||||||
v = mapActivity.getLayoutInflater().inflate(R.layout.route_waypoint_item, null);
|
v = UiUtilities.getInflater(mapActivity, nightMode).inflate(R.layout.route_waypoint_item, null);
|
||||||
}
|
}
|
||||||
v.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.card_and_list_background_dark : R.color.card_and_list_background_light));
|
v.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.card_and_list_background_dark : R.color.card_and_list_background_light));
|
||||||
updatePointInfoView(mapActivity, v, point, true, nightMode, edit, false);
|
updatePointInfoView(mapActivity, v, point, true, nightMode, edit, false);
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package net.osmand.plus.views.mapwidgets;
|
package net.osmand.plus.views.mapwidgets;
|
||||||
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.R;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
@ -16,6 +13,11 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
|
import net.osmand.plus.views.OsmandMapLayer.DrawSettings;
|
||||||
|
|
||||||
public class TextInfoWidget {
|
public class TextInfoWidget {
|
||||||
|
|
||||||
private String contentTitle;
|
private String contentTitle;
|
||||||
|
@ -38,7 +40,7 @@ public class TextInfoWidget {
|
||||||
|
|
||||||
public TextInfoWidget(Activity activity) {
|
public TextInfoWidget(Activity activity) {
|
||||||
app = (OsmandApplication) activity.getApplication();
|
app = (OsmandApplication) activity.getApplication();
|
||||||
view = activity.getLayoutInflater().inflate(R.layout.map_hud_widget, null);
|
view = UiUtilities.getInflater(activity, isNight).inflate(R.layout.map_hud_widget, null);
|
||||||
bottomLayout = (ViewGroup) view.findViewById(R.id.widget_bottom_layout);
|
bottomLayout = (ViewGroup) view.findViewById(R.id.widget_bottom_layout);
|
||||||
topImageView = (ImageView) view.findViewById(R.id.widget_top_icon);
|
topImageView = (ImageView) view.findViewById(R.id.widget_top_icon);
|
||||||
topTextView = (TextView) view.findViewById(R.id.widget_top_icon_text);
|
topTextView = (TextView) view.findViewById(R.id.widget_top_icon_text);
|
||||||
|
|
Loading…
Reference in a new issue