Merge pull request #7840 from osmandapp/theme_change_fixes
Theme change fixes
This commit is contained in:
commit
44e36fb380
6 changed files with 30 additions and 20 deletions
|
@ -257,7 +257,6 @@
|
|||
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_light</item>
|
||||
<item name="profile_save_btn">@drawable/btn_round_profile_blue</item>
|
||||
<item name="profile_cancel_btn">@drawable/btn_round_profile_gray</item>
|
||||
<item name="android:textColor">@color/text_color_primary_light</item>
|
||||
|
||||
<item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyleLight</item>
|
||||
<item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyleLight</item>
|
||||
|
@ -287,6 +286,7 @@
|
|||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.NoActionbar.Preferences">
|
||||
<item name="android:textColor">@color/text_color_primary_light</item>
|
||||
<item name="android:textColorSecondary">@color/text_color_secondary_light</item>
|
||||
<item name="android:listDivider">@color/divider_color_light</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
|
@ -357,6 +357,7 @@
|
|||
</style>
|
||||
|
||||
<style name="OsmandDarkTheme.NoActionbar.Preferences">
|
||||
<item name="android:textColor">@color/text_color_primary_dark</item>
|
||||
<item name="android:textColorSecondary">@color/text_color_secondary_dark</item>
|
||||
<item name="android:listDivider">@color/divider_color_dark</item>
|
||||
<item name="android:dividerHeight">1dp</item>
|
||||
|
@ -520,7 +521,6 @@
|
|||
<item name="dlg_btn_stroked">@drawable/dlg_btn_stroked_dark</item>
|
||||
<item name="profile_save_btn">@drawable/btn_round_profile_night</item>
|
||||
<item name="profile_cancel_btn">@drawable/btn_round_profile_gray_n</item>
|
||||
<item name="android:textColor">@color/text_color_primary_dark</item>
|
||||
|
||||
<item name="buttonBarNegativeButtonStyle">@style/DialogButtonStyleDark</item>
|
||||
<item name="buttonBarPositiveButtonStyle">@style/DialogButtonStyleDark</item>
|
||||
|
|
|
@ -46,6 +46,7 @@ import net.osmand.plus.OsmandPlugin;
|
|||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.Version;
|
||||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||
import net.osmand.plus.activities.actions.OsmandRestoreOrExitDialog;
|
||||
|
@ -82,9 +83,6 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
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_SCREEN_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_MEASURE_DISTANCE;
|
||||
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;
|
||||
|
||||
|
||||
|
@ -191,9 +192,11 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
builder.setView(view);
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand.plus.mapcontextmenu.editors;
|
|||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
@ -28,6 +27,7 @@ import android.widget.TextView;
|
|||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||
|
@ -44,7 +44,8 @@ public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
|
||||
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();
|
||||
if (editor == null) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.mapmarkers;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Paint;
|
||||
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.OsmandPreference;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndDialogFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
@ -61,7 +63,7 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
|
|||
final OsmandSettings settings = getSettings();
|
||||
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.setNavigationIcon(getIconsCache().getIcon(R.drawable.ic_arrow_back));
|
||||
|
@ -114,20 +116,21 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
|
|||
menuTv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Context themedContext = UiUtilities.getThemedContext(getActivity(), !settings.isLightContent());
|
||||
CharSequence[] titles = getMenuTitles();
|
||||
Paint paint = new Paint();
|
||||
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 itemWidth = titleTextWidth + AndroidUtils.dpToPx(getActivity(), 32);
|
||||
float minWidth = AndroidUtils.dpToPx(getActivity(), 100);
|
||||
final ListPopupWindow listPopupWindow = new ListPopupWindow(getActivity());
|
||||
float itemWidth = titleTextWidth + AndroidUtils.dpToPx(themedContext, 32);
|
||||
float minWidth = AndroidUtils.dpToPx(themedContext, 100);
|
||||
final ListPopupWindow listPopupWindow = new ListPopupWindow(themedContext);
|
||||
listPopupWindow.setAnchorView(menuTv);
|
||||
listPopupWindow.setContentWidth((int) (Math.max(itemWidth, minWidth)));
|
||||
listPopupWindow.setDropDownGravity(Gravity.END | Gravity.TOP);
|
||||
listPopupWindow.setHorizontalOffset(AndroidUtils.dpToPx(getActivity(), 8));
|
||||
listPopupWindow.setHorizontalOffset(AndroidUtils.dpToPx(themedContext, 8));
|
||||
listPopupWindow.setVerticalOffset(-menuTv.getHeight());
|
||||
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() {
|
||||
@Override
|
||||
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.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
|
@ -716,7 +717,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
final OsmandApplication app = mapActivity.getMyApplication();
|
||||
final WaypointDialogHelper helper = mapActivity.getDashboard().getWaypointDialogHelper();
|
||||
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));
|
||||
updatePointInfoView(mapActivity, v, point, true, nightMode, edit, false);
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
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.graphics.Paint.Style;
|
||||
import android.graphics.Typeface;
|
||||
|
@ -16,6 +13,11 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
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 {
|
||||
|
||||
private String contentTitle;
|
||||
|
@ -38,7 +40,7 @@ public class TextInfoWidget {
|
|||
|
||||
public TextInfoWidget(Activity activity) {
|
||||
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);
|
||||
topImageView = (ImageView) view.findViewById(R.id.widget_top_icon);
|
||||
topTextView = (TextView) view.findViewById(R.id.widget_top_icon_text);
|
||||
|
|
Loading…
Reference in a new issue