Merge pull request #8507 from osmandapp/FixTextColor

Fix text color / Colors refactoring
This commit is contained in:
max-klaus 2020-02-19 15:56:23 +03:00 committed by GitHub
commit 6fc07984af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 83 additions and 51 deletions

View file

@ -46,6 +46,7 @@
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier" android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size" android:textSize="@dimen/default_sub_text_size"
tools:text="Some description" /> tools:text="Some description" />

View file

@ -64,6 +64,7 @@
android:layout_gravity="fill_horizontal" android:layout_gravity="fill_horizontal"
android:layout_marginBottom="24dp" android:layout_marginBottom="24dp"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:textColor="?android:textColorSecondary"
android:text="@string/application_dir_description" android:text="@string/application_dir_description"
android:textSize="16sp"/> android:textSize="16sp"/>

View file

@ -74,7 +74,7 @@
android:layout_marginLeft="6dp" android:layout_marginLeft="6dp"
android:drawablePadding="2dp" android:drawablePadding="2dp"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/text_color_secondary_dark" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_sub_text_size"/>
<TextView <TextView
@ -84,7 +84,7 @@
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@color/text_color_secondary_dark" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_sub_text_size"/> android:textSize="@dimen/default_sub_text_size"/>
<TextView <TextView

View file

@ -35,6 +35,7 @@
android:layout_weight="1" android:layout_weight="1"
android:layout_height="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical" android:gravity="center_vertical"
android:textColor="?android:textColorPrimary"
tools:text="Today"/> tools:text="Today"/>
<android.support.v7.widget.SwitchCompat <android.support.v7.widget.SwitchCompat
@ -68,6 +69,7 @@
android:ellipsize="end" android:ellipsize="end"
android:maxLines="3" android:maxLines="3"
android:textAppearance="@style/TextAppearance.ContextMenuSubtitle" android:textAppearance="@style/TextAppearance.ContextMenuSubtitle"
android:textColor="?android:textColorSecondary"
tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard." /> tools:text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard." />
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx

View file

@ -32,7 +32,7 @@
android:layout_marginRight="@dimen/list_content_padding_large" android:layout_marginRight="@dimen/list_content_padding_large"
android:layout_marginTop="@dimen/list_header_padding" android:layout_marginTop="@dimen/list_header_padding"
android:gravity="center" android:gravity="center"
android:textColor="?attr/card_description_text_color" android:textColor="?attr/dialog_text_description_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"
tools:text="@string/osm_live_payment_desc"/> tools:text="@string/osm_live_payment_desc"/>

View file

@ -46,7 +46,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/osm_live_payment_contribute_descr" android:text="@string/osm_live_payment_contribute_descr"
android:textColor="?attr/card_description_text_color" android:textColor="?attr/dialog_text_description_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
android:visibility="gone" android:visibility="gone"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"
@ -56,7 +56,7 @@
android:id="@+id/description" android:id="@+id/description"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/card_description_text_color" android:textColor="?attr/dialog_text_description_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"
tools:text="Monthly payment" /> tools:text="Monthly payment" />

View file

@ -38,7 +38,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/osm_live_payment_contribute_descr" android:text="@string/osm_live_payment_contribute_descr"
android:textColor="?attr/card_description_text_color" android:textColor="?attr/dialog_text_description_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
android:visibility="gone" android:visibility="gone"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"
@ -48,7 +48,7 @@
android:id="@+id/description" android:id="@+id/description"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textColor="?attr/card_description_text_color" android:textColor="?attr/dialog_text_description_color"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" osmand:typeface="@string/font_roboto_regular"
tools:text="$0.62 / month • Save 68%" /> tools:text="$0.62 / month • Save 68%" />

View file

@ -28,7 +28,6 @@ import android.support.annotation.AttrRes;
import android.support.annotation.ColorInt; import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes; import android.support.annotation.ColorRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider; import android.support.v4.content.FileProvider;
import android.support.v4.text.TextUtilsCompat; import android.support.v4.text.TextUtilsCompat;
@ -342,18 +341,6 @@ public class AndroidUtils {
return res; return res;
} }
public static void setSnackbarTextColor(Snackbar snackbar, @ColorRes int colorId) {
View view = snackbar.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_action);
tv.setTextColor(ContextCompat.getColor(view.getContext(), colorId));
}
public static void setSnackbarTextMaxLines(Snackbar snackbar, int maxLines) {
View view = snackbar.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
tv.setMaxLines(maxLines);
}
public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) { public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) {
Drawable drawable; Drawable drawable;
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {

View file

@ -15,6 +15,7 @@ import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes; import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.graphics.drawable.DrawableCompat;
import android.support.v4.text.TextUtilsCompat; import android.support.v4.text.TextUtilsCompat;
@ -343,6 +344,40 @@ public class UiUtilities {
return screenOrientation; return screenOrientation;
} }
public static void setupSnackbar(Snackbar snackbar, boolean nightMode) {
setupSnackbar(snackbar, nightMode, null, null, null, null);
}
public static void setupSnackbar(Snackbar snackbar, boolean nightMode, Integer maxLines) {
setupSnackbar(snackbar, nightMode, null, null, null, maxLines);
}
public static void setupSnackbar(Snackbar snackbar, boolean nightMode, @ColorRes Integer backgroundColor,
@ColorRes Integer messageColor, @ColorRes Integer actionColor, Integer maxLines) {
if (snackbar == null) {
return;
}
View view = snackbar.getView();
Context ctx = view.getContext();
TextView tvMessage = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
TextView tvAction = (TextView) view.findViewById(android.support.design.R.id.snackbar_action);
if (messageColor == null) {
messageColor = nightMode ? R.color.text_color_primary_dark : R.color.text_color_primary_light;
}
tvMessage.setTextColor(ContextCompat.getColor(ctx, messageColor));
if (actionColor == null) {
actionColor = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
}
tvAction.setTextColor(ContextCompat.getColor(ctx, actionColor));
if (maxLines != null) {
tvMessage.setMaxLines(maxLines);
}
if (backgroundColor == null) {
backgroundColor = nightMode ? R.color.list_background_color_dark : R.color.list_background_color_light;
}
view.setBackgroundColor(ContextCompat.getColor(ctx, backgroundColor));
}
public static void setupLayoutDirection(View layout) { public static void setupLayoutDirection(View layout) {
Context ctx = layout.getContext(); Context ctx = layout.getContext();
Locale currentLocale = ctx.getResources().getConfiguration().locale; Locale currentLocale = ctx.getResources().getConfiguration().locale;

View file

@ -264,7 +264,7 @@ public class ContributionVersionActivity extends OsmandListActivity {
StringBuilder format = new StringBuilder(); StringBuilder format = new StringBuilder();
format.append(AndroidUtils.formatDateTime(getMyApplication(), build.date.getTime()))/*.append(" : ").append(build.size).append(" MB")*/; format.append(AndroidUtils.formatDateTime(getMyApplication(), build.date.getTime()))/*.append(" : ").append(build.size).append(" MB")*/;
description.setText(format.toString()); description.setText(format.toString());
int color = getResources().getColor(R.color.color_unknown); int color = getResources().getColor(R.color.text_color_secondary_dark);
if (currentInstalledDate != null) { if (currentInstalledDate != null) {
if (currentInstalledDate.before(build.date)) { if (currentInstalledDate.before(build.date)) {
color = getResources().getColor(R.color.color_update); color = getResources().getColor(R.color.color_update);

View file

@ -65,6 +65,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.Version; import net.osmand.plus.Version;
import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.TrackActivity; import net.osmand.plus.activities.TrackActivity;
@ -1092,7 +1093,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
startActivity(intent); startActivity(intent);
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); UiUtilities.setupSnackbar(snackbar, !lightTheme);
snackbar.show(); snackbar.show();
} }
}; };
@ -1119,7 +1120,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); UiUtilities.setupSnackbar(snackbar, !lightTheme);
snackbar.show(); snackbar.show();
} }

View file

@ -33,6 +33,7 @@ import net.osmand.plus.MapMarkersHelper.OnGroupSyncedListener;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings;
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.activities.TrackActivity; import net.osmand.plus.activities.TrackActivity;
import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.OnPointsSavedListener; import net.osmand.plus.mapmarkers.CoordinateInputDialogFragment.OnPointsSavedListener;
@ -449,7 +450,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
} }
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); UiUtilities.setupSnackbar(snackbar, !lightTheme);
snackbar.show(); snackbar.show();
} }
} }
@ -494,7 +495,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm
startActivity(intent); startActivity(intent);
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); UiUtilities.setupSnackbar(snackbar, !lightTheme);
snackbar.show(); snackbar.show();
} }
}; };

View file

@ -207,7 +207,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
updateAdapter(); updateAdapter();
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); UiUtilities.setupSnackbar(snackbar, night);
snackbar.show(); snackbar.show();
} }
} }

View file

@ -171,8 +171,7 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
} }
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, night ? R.color.active_color_primary_dark : R.color.active_color_primary_light); UiUtilities.setupSnackbar(snackbar, night);
snackbar.getView().setBackgroundColor(ContextCompat.getColor(app, night ? R.color.list_background_color_dark : R.color.list_background_color_light));
snackbar.show(); snackbar.show();
} }
} }

View file

@ -48,6 +48,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
if (gpxFile == null) { if (gpxFile == null) {
return; return;
} }
int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
isUpdateMode = getArguments().getBoolean(UPDATE_CATEGORIES_KEY); isUpdateMode = getArguments().getBoolean(UPDATE_CATEGORIES_KEY);
List<String> categories = getArguments().getStringArrayList(ACTIVE_CATEGORIES_KEY); List<String> categories = getArguments().getStringArrayList(ACTIVE_CATEGORIES_KEY);
@ -58,6 +59,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
final BottomSheetItemWithCompoundButton[] selectAllItem = new BottomSheetItemWithCompoundButton[1]; final BottomSheetItemWithCompoundButton[] selectAllItem = new BottomSheetItemWithCompoundButton[1];
selectAllItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder() selectAllItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder()
.setChecked(!isUpdateMode || categories!=null&&categories.size() == gpxFile.getPointsByCategories().size()) .setChecked(!isUpdateMode || categories!=null&&categories.size() == gpxFile.getPointsByCategories().size())
.setCompoundButtonColorId(activeColorResId)
.setDescription(getString(R.string.shared_string_total) + ": " + gpxFile.getPoints().size()) .setDescription(getString(R.string.shared_string_total) + ": " + gpxFile.getPoints().size())
.setIcon(getContentIcon(R.drawable.ic_action_group_select_all)) .setIcon(getContentIcon(R.drawable.ic_action_group_select_all))
.setTitle(getString(R.string.shared_string_select_all)) .setTitle(getString(R.string.shared_string_select_all))
@ -93,6 +95,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee
} }
} }
}) })
.setCompoundButtonColorId(activeColorResId)
.setDescription(String.valueOf(pointsByCategories.get(category).size())) .setDescription(String.valueOf(pointsByCategories.get(category).size()))
.setIcon(getContentIcon(R.drawable.ic_action_folder)) .setIcon(getContentIcon(R.drawable.ic_action_folder))
.setTitle(category.equals("") ? getString(R.string.shared_string_waypoints) : category) .setTitle(category.equals("") ? getString(R.string.shared_string_waypoints) : category)

View file

@ -74,6 +74,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
ImageView markerImageViewToUpdate; ImageView markerImageViewToUpdate;
int drawableResToUpdate; int drawableResToUpdate;
int markerColor = MapMarker.getColorId(marker.colorIndex); int markerColor = MapMarker.getColorId(marker.colorIndex);
int actionIconColor = night ? R.color.icon_color_primary_dark : R.color.icon_color_primary_light;
LatLon markerLatLon = new LatLon(marker.getLatitude(), marker.getLongitude()); LatLon markerLatLon = new LatLon(marker.getLatitude(), marker.getLongitude());
final boolean displayedInWidget = pos < mapActivity.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get(); final boolean displayedInWidget = pos < mapActivity.getMyApplication().getSettings().DISPLAYED_MARKERS_WIDGETS_COUNT.get();
if (showDirectionEnabled && displayedInWidget) { if (showDirectionEnabled && displayedInWidget) {
@ -98,7 +99,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.text_color_primary_dark : R.color.text_color_primary_light)); holder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.text_color_primary_dark : R.color.text_color_primary_light));
holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.app_bar_color_dark : R.color.divider_color_light)); holder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.app_bar_color_dark : R.color.divider_color_light));
holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset)); holder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
holder.optionsBtn.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_marker_passed, night ? R.color.active_buttons_and_links_text_dark : R.color.active_buttons_and_links_text_light)); holder.optionsBtn.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_marker_passed, actionIconColor));
holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder)); holder.iconReorder.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reorder));
holder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.icon_color_default_dark : R.color.icon_color_default_light)); holder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.icon_color_default_dark : R.color.icon_color_default_light));
@ -162,8 +163,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
notifyDataSetChanged(); notifyDataSetChanged();
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, night ? R.color.active_color_primary_dark : R.color.active_color_primary_light); UiUtilities.setupSnackbar(snackbar, night);
snackbar.getView().setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.list_background_color_dark : R.color.list_background_color_light));
snackbar.show(); snackbar.show();
} }
}); });
@ -229,8 +229,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
notifyDataSetChanged(); notifyDataSetChanged();
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, night ? R.color.active_color_primary_dark : R.color.active_color_primary_light); UiUtilities.setupSnackbar(snackbar, night);
snackbar.getView().setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.list_background_color_dark : R.color.list_background_color_light));
snackbar.show(); snackbar.show();
} }

View file

@ -12,7 +12,6 @@ import android.view.ViewGroup;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.ImageView; import android.widget.ImageView;
import net.osmand.AndroidUtils;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
import net.osmand.GPXUtilities; import net.osmand.GPXUtilities;
@ -272,6 +271,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
} }
ImageView markerImageViewToUpdate; ImageView markerImageViewToUpdate;
int drawableResToUpdate; int drawableResToUpdate;
int actionIconColor = night ? R.color.icon_color_primary_dark : R.color.icon_color_primary_light;
final boolean markerToHighlight = showDirectionMarkers.contains(marker); final boolean markerToHighlight = showDirectionMarkers.contains(marker);
if (showDirectionEnabled && markerToHighlight) { if (showDirectionEnabled && markerToHighlight) {
itemViewHolder.iconDirection.setVisibility(View.GONE); itemViewHolder.iconDirection.setVisibility(View.GONE);
@ -294,8 +294,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
itemViewHolder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.text_color_primary_dark : R.color.text_color_primary_light)); itemViewHolder.title.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.text_color_primary_dark : R.color.text_color_primary_light));
itemViewHolder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.app_bar_color_dark : R.color.divider_color_light)); itemViewHolder.divider.setBackgroundColor(ContextCompat.getColor(mapActivity, night ? R.color.app_bar_color_dark : R.color.divider_color_light));
itemViewHolder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset)); itemViewHolder.optionsBtn.setBackgroundDrawable(mapActivity.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getIcon(markerInHistory ? R.drawable.ic_action_reset_to_default_dark : R.drawable.ic_action_marker_passed, itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getIcon(markerInHistory ? R.drawable.ic_action_reset_to_default_dark : R.drawable.ic_action_marker_passed, actionIconColor));
night ? R.color.icon_color_primary_dark : R.color.active_buttons_and_links_text_light));
itemViewHolder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.icon_color_default_dark : R.color.icon_color_default_light)); itemViewHolder.description.setTextColor(ContextCompat.getColor(mapActivity, night ? R.color.icon_color_default_dark : R.color.icon_color_default_light));
drawableResToUpdate = R.drawable.ic_direction_arrow; drawableResToUpdate = R.drawable.ic_direction_arrow;
@ -354,8 +353,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
updateDisplayedData(); updateDisplayedData();
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, night ? R.color.active_color_primary_dark : R.color.active_color_primary_light); UiUtilities.setupSnackbar(snackbar, night);
snackbar.getView().setBackgroundColor(ContextCompat.getColor(app, night ? R.color.list_background_color_dark : R.color.list_background_color_light));
snackbar.show(); snackbar.show();
} }
} }
@ -490,7 +488,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
mapMarkersHelper.enableGroup(group); mapMarkersHelper.enableGroup(group);
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); UiUtilities.setupSnackbar(snackbar, night);
snackbar.show(); snackbar.show();
} }
} }
@ -498,6 +496,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
headerViewHolder.disableGroupSwitch.setOnCheckedChangeListener(null); headerViewHolder.disableGroupSwitch.setOnCheckedChangeListener(null);
headerViewHolder.disableGroupSwitch.setChecked(!groupIsDisabled); headerViewHolder.disableGroupSwitch.setChecked(!groupIsDisabled);
headerViewHolder.disableGroupSwitch.setOnCheckedChangeListener(checkedChangeListener); headerViewHolder.disableGroupSwitch.setOnCheckedChangeListener(checkedChangeListener);
UiUtilities.setupCompoundButton(headerViewHolder.disableGroupSwitch, night, UiUtilities.CompoundButtonType.GLOBAL);
} else { } else {
throw new IllegalArgumentException("Unsupported header"); throw new IllegalArgumentException("Unsupported header");
} }

View file

@ -118,7 +118,8 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
final MapMarker marker = (MapMarker) getItem(position); final MapMarker marker = (MapMarker) getItem(position);
itemViewHolder.iconReorder.setVisibility(View.GONE); itemViewHolder.iconReorder.setVisibility(View.GONE);
int color = R.color.icon_color_default_dark; int color = night ? R.color.icon_color_default_dark : R.color.icon_color_default_light;
int actionIconColor = night ? R.color.icon_color_primary_dark : R.color.icon_color_primary_light;
itemViewHolder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, color)); itemViewHolder.icon.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, color));
itemViewHolder.title.setText(marker.getName(app)); itemViewHolder.title.setText(marker.getName(app));
@ -134,7 +135,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
itemViewHolder.description.setText(desc); itemViewHolder.description.setText(desc);
itemViewHolder.optionsBtn.setBackgroundDrawable(app.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset)); itemViewHolder.optionsBtn.setBackgroundDrawable(app.getResources().getDrawable(night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_reset_to_default_dark)); itemViewHolder.optionsBtn.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_reset_to_default_dark, actionIconColor));
itemViewHolder.optionsBtn.setOnClickListener(new View.OnClickListener() { itemViewHolder.optionsBtn.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
@ -151,8 +152,7 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
app.getMapMarkersHelper().moveMapMarkerToHistory(marker); app.getMapMarkersHelper().moveMapMarkerToHistory(marker);
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, night ? R.color.active_color_primary_dark : R.color.active_color_primary_light); UiUtilities.setupSnackbar(snackbar, night);
snackbar.getView().setBackgroundColor(ContextCompat.getColor(app, night ? R.color.list_background_color_dark : R.color.list_background_color_light));
snackbar.show(); snackbar.show();
} }
}); });

View file

@ -550,7 +550,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment implements
super.onDismissed(transientBottomBar, event); super.onDismissed(transientBottomBar, event);
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); boolean nightMode = !app.getSettings().isLightContent();
UiUtilities.setupSnackbar(snackbar, nightMode);
snackbar.show(); snackbar.show();
} }
} }

View file

@ -226,7 +226,7 @@ public class SelectProfileBottomSheetDialogFragment extends BasePreferenceBottom
private void addButtonItem(int titleId, int iconId, OnClickListener listener) { private void addButtonItem(int titleId, int iconId, OnClickListener listener) {
OsmandApplication app = requiredMyApplication(); OsmandApplication app = requiredMyApplication();
int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light; int activeColorResId = isNightMode(app) ? R.color.active_color_primary_dark : R.color.active_color_primary_light;
View buttonView = View.inflate(app, R.layout.bottom_sheet_item_preference_btn, null); View buttonView = View.inflate(app, R.layout.bottom_sheet_item_preference_btn, null);
TextView tvTitle = buttonView.findViewById(R.id.title); TextView tvTitle = buttonView.findViewById(R.id.title);

View file

@ -1405,8 +1405,7 @@ public class MapInfoWidgetsFactory {
ctx.startActivity(Intent.createChooser(intent, ctx.getString(R.string.send_location))); ctx.startActivity(Intent.createChooser(intent, ctx.getString(R.string.send_location)));
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); UiUtilities.setupSnackbar(snackbar, nightMode, 5);
AndroidUtils.setSnackbarTextMaxLines(snackbar, 5);
snackbar.show(); snackbar.show();
} }

View file

@ -11,6 +11,7 @@ import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentActivity;
import android.text.Html; import android.text.Html;
import android.util.Log; import android.util.Log;
import android.view.ContextThemeWrapper;
import net.osmand.IndexConstants; import net.osmand.IndexConstants;
import net.osmand.ResultMatcher; import net.osmand.ResultMatcher;
@ -86,7 +87,7 @@ public class WikiArticleHelper {
activityRef = new WeakReference<>(activity); activityRef = new WeakReference<>(activity);
this.isNightMode = nightMode; this.isNightMode = nightMode;
this.url = url; this.url = url;
dialog = createProgressDialog(activity); dialog = createProgressDialog(activity, isNightMode);
} }
@Override @Override
@ -215,9 +216,9 @@ public class WikiArticleHelper {
return ""; return "";
} }
private static ProgressDialog createProgressDialog(@NonNull FragmentActivity activity) { private static ProgressDialog createProgressDialog(@NonNull FragmentActivity activity, boolean nightMode) {
if (activity != null) { if (activity != null) {
ProgressDialog dialog = new ProgressDialog(activity); ProgressDialog dialog = new ProgressDialog(new ContextThemeWrapper(activity, nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme));
dialog.setCancelable(false); dialog.setCancelable(false);
dialog.setMessage(activity.getString(R.string.wiki_article_search_text)); dialog.setMessage(activity.getString(R.string.wiki_article_search_text));
return dialog; return dialog;

View file

@ -204,7 +204,10 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter<RecyclerView.Vi
ldh.restoreSavedArticle(article); ldh.restoreSavedArticle(article);
} }
}); });
AndroidUtils.setSnackbarTextColor(snackbar, R.color.wikivoyage_active_dark); boolean nightMode = !settings.isLightContent();
UiUtilities.setupSnackbar(snackbar, nightMode);
int wikivoyageActiveColorResId = nightMode ? R.color.wikivoyage_active_dark : R.color.wikivoyage_active_light;
UiUtilities.setupSnackbar(snackbar, nightMode, null, null, wikivoyageActiveColorResId, null);
snackbar.show(); snackbar.show();
} }
} }