diff --git a/OsmAnd/res/layout/bottom_sheet_item_in_frame_with_descr_and_icon.xml b/OsmAnd/res/layout/bottom_sheet_item_in_frame_with_descr_and_icon.xml index a4748728f0..6e64f26691 100644 --- a/OsmAnd/res/layout/bottom_sheet_item_in_frame_with_descr_and_icon.xml +++ b/OsmAnd/res/layout/bottom_sheet_item_in_frame_with_descr_and_icon.xml @@ -46,6 +46,7 @@ android:ellipsize="end" android:maxLines="2" android:lineSpacingMultiplier="@dimen/text_button_line_spacing_multiplier" + android:textColor="?android:textColorSecondary" android:textSize="@dimen/default_sub_text_size" tools:text="Some description" /> diff --git a/OsmAnd/res/layout/download_build_list_item.xml b/OsmAnd/res/layout/download_build_list_item.xml index c1d1d8f783..75171d28c9 100644 --- a/OsmAnd/res/layout/download_build_list_item.xml +++ b/OsmAnd/res/layout/download_build_list_item.xml @@ -13,6 +13,7 @@ android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" + android:textColor="?android:textColorPrimary" android:textSize="@dimen/default_list_text_size"/> diff --git a/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml b/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml index d0d9d30d29..c62ee0a14a 100644 --- a/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml +++ b/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml @@ -64,6 +64,7 @@ android:layout_gravity="fill_horizontal" android:layout_marginBottom="24dp" android:layout_marginTop="4dp" + android:textColor="?android:textColorSecondary" android:text="@string/application_dir_description" android:textSize="16sp"/> diff --git a/OsmAnd/res/layout/map_marker_item.xml b/OsmAnd/res/layout/map_marker_item.xml index 0ad46644e0..1bb0b74cb4 100644 --- a/OsmAnd/res/layout/map_marker_item.xml +++ b/OsmAnd/res/layout/map_marker_item.xml @@ -74,7 +74,7 @@ android:layout_marginLeft="6dp" android:drawablePadding="2dp" android:maxLines="1" - android:textColor="@color/text_color_secondary_dark" + android:textColor="?android:textColorSecondary" android:textSize="@dimen/default_sub_text_size"/> Build.VERSION_CODES.LOLLIPOP) { diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java index 8ac7996f92..a8c08752ba 100644 --- a/OsmAnd/src/net/osmand/plus/UiUtilities.java +++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java @@ -15,6 +15,7 @@ import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; import android.support.annotation.DrawableRes; import android.support.annotation.StringRes; +import android.support.design.widget.Snackbar; import android.support.v4.content.ContextCompat; import android.support.v4.graphics.drawable.DrawableCompat; import android.support.v4.text.TextUtilsCompat; @@ -343,6 +344,40 @@ public class UiUtilities { 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) { Context ctx = layout.getContext(); Locale currentLocale = ctx.getResources().getConfiguration().locale; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java index acaceda8a7..3ed13c1ffd 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/CoordinateInputDialogFragment.java @@ -65,6 +65,7 @@ import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; import net.osmand.plus.Version; import net.osmand.plus.activities.SavingTrackHelper; import net.osmand.plus.activities.TrackActivity; @@ -1092,7 +1093,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm startActivity(intent); } }); - AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); + UiUtilities.setupSnackbar(snackbar, !lightTheme); snackbar.show(); } }; @@ -1119,7 +1120,7 @@ public class CoordinateInputDialogFragment extends DialogFragment implements Osm adapter.notifyDataSetChanged(); } }); - AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); + UiUtilities.setupSnackbar(snackbar, !lightTheme); snackbar.show(); } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java index ff628d377e..0caa56c355 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersDialogFragment.java @@ -33,6 +33,7 @@ import net.osmand.plus.MapMarkersHelper.OnGroupSyncedListener; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; +import net.osmand.plus.UiUtilities; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.activities.TrackActivity; 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(); } } @@ -494,7 +495,7 @@ public class MapMarkersDialogFragment extends android.support.v4.app.DialogFragm startActivity(intent); } }); - AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); + UiUtilities.setupSnackbar(snackbar, !lightTheme); snackbar.show(); } }; diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java index 1ed6666726..f176c016c2 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersGroupsFragment.java @@ -207,7 +207,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL updateAdapter(); } }); - AndroidUtils.setSnackbarTextColor(snackbar, R.color.active_color_primary_dark); + UiUtilities.setupSnackbar(snackbar, night); snackbar.show(); } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java index 260efd704d..5729e38bbf 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkersHistoryFragment.java @@ -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); - snackbar.getView().setBackgroundColor(ContextCompat.getColor(app, night ? R.color.list_background_color_dark : R.color.list_background_color_light)); + UiUtilities.setupSnackbar(snackbar, night); snackbar.show(); } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java index df26ab2561..83f23ac7e9 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/SelectWptCategoriesBottomSheetDialogFragment.java @@ -48,6 +48,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee if (gpxFile == null) { return; } + int activeColorResId = nightMode ? R.color.active_color_primary_dark : R.color.active_color_primary_light; isUpdateMode = getArguments().getBoolean(UPDATE_CATEGORIES_KEY); List categories = getArguments().getStringArrayList(ACTIVE_CATEGORIES_KEY); @@ -58,6 +59,7 @@ public class SelectWptCategoriesBottomSheetDialogFragment extends MenuBottomShee final BottomSheetItemWithCompoundButton[] selectAllItem = new BottomSheetItemWithCompoundButton[1]; selectAllItem[0] = (BottomSheetItemWithCompoundButton) new BottomSheetItemWithCompoundButton.Builder() .setChecked(!isUpdateMode || categories!=null&&categories.size() == gpxFile.getPointsByCategories().size()) + .setCompoundButtonColorId(activeColorResId) .setDescription(getString(R.string.shared_string_total) + ": " + gpxFile.getPoints().size()) .setIcon(getContentIcon(R.drawable.ic_action_group_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())) .setIcon(getContentIcon(R.drawable.ic_action_folder)) .setTitle(category.equals("") ? getString(R.string.shared_string_waypoints) : category) diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java index 37c41b14cd..3d487e3831 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/adapters/MapMarkersActiveAdapter.java @@ -74,6 +74,7 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter