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/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"/> diff --git a/OsmAnd/res/layout/purchase_dialog_card_button_active_ex.xml b/OsmAnd/res/layout/purchase_dialog_card_button_active_ex.xml index 4d1b662dc3..15ac723740 100644 --- a/OsmAnd/res/layout/purchase_dialog_card_button_active_ex.xml +++ b/OsmAnd/res/layout/purchase_dialog_card_button_active_ex.xml @@ -46,7 +46,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" 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:visibility="gone" osmand:typeface="@string/font_roboto_regular" @@ -56,7 +56,7 @@ android:id="@+id/description" android:layout_width="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" osmand:typeface="@string/font_roboto_regular" tools:text="Monthly payment" /> diff --git a/OsmAnd/res/layout/purchase_dialog_card_button_ex.xml b/OsmAnd/res/layout/purchase_dialog_card_button_ex.xml index 05465c67db..4af46efd8b 100644 --- a/OsmAnd/res/layout/purchase_dialog_card_button_ex.xml +++ b/OsmAnd/res/layout/purchase_dialog_card_button_ex.xml @@ -38,7 +38,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" 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:visibility="gone" osmand:typeface="@string/font_roboto_regular" @@ -48,7 +48,7 @@ android:id="@+id/description" android:layout_width="match_parent" 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" osmand:typeface="@string/font_roboto_regular" tools:text="$0.62 / month • Save 68%" /> diff --git a/OsmAnd/src/net/osmand/AndroidUtils.java b/OsmAnd/src/net/osmand/AndroidUtils.java index f60e069c4c..3e119e15f0 100644 --- a/OsmAnd/src/net/osmand/AndroidUtils.java +++ b/OsmAnd/src/net/osmand/AndroidUtils.java @@ -28,7 +28,6 @@ import android.support.annotation.AttrRes; import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; import android.support.annotation.NonNull; -import android.support.design.widget.Snackbar; import android.support.v4.content.ContextCompat; import android.support.v4.content.FileProvider; import android.support.v4.text.TextUtilsCompat; @@ -342,18 +341,6 @@ public class AndroidUtils { 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) { Drawable drawable; if (Build.VERSION.SDK_INT > 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/activities/ContributionVersionActivity.java b/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java index 6cbdf7641d..7dde1b05c7 100644 --- a/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/ContributionVersionActivity.java @@ -264,7 +264,7 @@ public class ContributionVersionActivity extends OsmandListActivity { StringBuilder format = new StringBuilder(); format.append(AndroidUtils.formatDateTime(getMyApplication(), build.date.getTime()))/*.append(" : ").append(build.size).append(" MB")*/; 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.before(build.date)) { color = getResources().getColor(R.color.color_update); 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(activity); this.isNightMode = nightMode; this.url = url; - dialog = createProgressDialog(activity); + dialog = createProgressDialog(activity, isNightMode); } @Override @@ -215,9 +216,9 @@ public class WikiArticleHelper { return ""; } - private static ProgressDialog createProgressDialog(@NonNull FragmentActivity activity) { + private static ProgressDialog createProgressDialog(@NonNull FragmentActivity activity, boolean nightMode) { 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.setMessage(activity.getString(R.string.wiki_article_search_text)); return dialog; diff --git a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java index a07fe37927..264d9f723c 100644 --- a/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java +++ b/OsmAnd/src/net/osmand/plus/wikivoyage/explore/SavedArticlesRvAdapter.java @@ -204,7 +204,10 @@ public class SavedArticlesRvAdapter extends RecyclerView.Adapter