From 221ed8cdc34b22e2fdc6b430cbb6688557b0dd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=20?= =?UTF-8?q?=D0=97=D0=B0=D1=86=D0=B5=D0=BF=D0=B8=D0=BD?= Date: Mon, 15 Jun 2020 21:06:36 +0300 Subject: [PATCH] [android] Changeg night resources for guides gallery item ui --- android/res/drawable/ic_claim_city_night.xml | 13 +++++++++++++ android/res/drawable/ic_claim_night.xml | 13 +++++++++++++ android/res/values/colors.xml | 2 ++ android/res/values/themes-attrs.xml | 12 +++++++++--- android/res/values/themes-base.xml | 8 ++++++++ .../com/mapswithme/maps/gallery/Holders.java | 18 ++++++++++++++---- 6 files changed, 59 insertions(+), 7 deletions(-) create mode 100644 android/res/drawable/ic_claim_city_night.xml create mode 100644 android/res/drawable/ic_claim_night.xml diff --git a/android/res/drawable/ic_claim_city_night.xml b/android/res/drawable/ic_claim_city_night.xml new file mode 100644 index 0000000000..cd49b8d290 --- /dev/null +++ b/android/res/drawable/ic_claim_city_night.xml @@ -0,0 +1,13 @@ + + + + diff --git a/android/res/drawable/ic_claim_night.xml b/android/res/drawable/ic_claim_night.xml new file mode 100644 index 0000000000..fb6ec5962f --- /dev/null +++ b/android/res/drawable/ic_claim_night.xml @@ -0,0 +1,13 @@ + + + + diff --git a/android/res/values/colors.xml b/android/res/values/colors.xml index e96d1dd9e7..c66863dfcb 100644 --- a/android/res/values/colors.xml +++ b/android/res/values/colors.xml @@ -233,4 +233,6 @@ #4287DF #9B24B2 #3C8C3C + #9867FC + #93BF39 diff --git a/android/res/values/themes-attrs.xml b/android/res/values/themes-attrs.xml index 4ec3681c02..4daa9456a9 100644 --- a/android/res/values/themes-attrs.xml +++ b/android/res/values/themes-attrs.xml @@ -94,9 +94,6 @@ - - - @@ -130,6 +127,15 @@ + + + + + + + + + diff --git a/android/res/values/themes-base.xml b/android/res/values/themes-base.xml index 7f919546ee..92a40ae74a 100644 --- a/android/res/values/themes-base.xml +++ b/android/res/values/themes-base.xml @@ -186,6 +186,10 @@ @drawable/bg_bought_content @drawable/guides_layer_default_light @drawable/bg_guides_light + @color/city_color + @color/outdoor_color + @drawable/ic_claim + @drawable/ic_claim_city @@ -371,5 +375,9 @@ @drawable/bg_guides_night @drawable/guides_layer_default_dark @drawable/bg_bought_content_night + @color/city_color_night + @color/outdoor_color_night + @drawable/ic_claim_night + @drawable/ic_claim_city_night diff --git a/android/src/com/mapswithme/maps/gallery/Holders.java b/android/src/com/mapswithme/maps/gallery/Holders.java index 225fc1dd87..88d1d8ce44 100644 --- a/android/src/com/mapswithme/maps/gallery/Holders.java +++ b/android/src/com/mapswithme/maps/gallery/Holders.java @@ -16,6 +16,8 @@ import android.widget.ProgressBar; import android.widget.TextView; import androidx.annotation.CallSuper; +import androidx.annotation.ColorInt; +import androidx.annotation.DrawableRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.core.graphics.drawable.RoundedBitmapDrawable; @@ -658,7 +660,12 @@ public class Holders BookmarkManager.INSTANCE.getCategoryByServerId(item.getGuideId()); mBoughtContentBtn.setText(category.isVisible() ? R.string.hide : R.string.show); boolean isCity = item.getGuideType() == GuidesGallery.Type.City; - mBoughtContentCheckbox.setImageResource(isCity ? R.drawable.ic_claim_city : R.drawable.ic_claim); + Context context = mBoughtContentBtn.getContext(); + @DrawableRes + int drawableRes = + ThemeUtils.getResource(context, isCity ? R.attr.cityCheckbox + : R.attr.outdoorCheckbox); + mBoughtContentCheckbox.setImageResource(drawableRes); } private void bindOutdoorBlock(@NonNull GuidesGallery.OutdoorParams params) @@ -721,7 +728,8 @@ public class Holders } @NonNull - private static Spannable makeSubtitle(Context context, @NonNull GuidesGallery.Item item) + private static Spannable makeSubtitle(@NonNull Context context, + @NonNull GuidesGallery.Item item) { boolean isCity = item.getGuideType() == GuidesGallery.Type.City; SpannableStringBuilder builder = @@ -729,8 +737,10 @@ public class Holders : context.getString(R.string.routes_card_outdoor)); Resources res = context.getResources(); - int color = isCity ? res.getColor(R.color.city_color) - : res.getColor(R.color.outdoor_color); + + @ColorInt + int color = isCity ? ThemeUtils.getColor(context, R.attr.subtitleCityColor) + : ThemeUtils.getColor(context, R.attr.subtitleOutdoorColor); builder.setSpan(new ForegroundColorSpan(color), 0, builder.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);