From d347ae32b580fcdc4026ef7c561c8b37d09c5b11 Mon Sep 17 00:00:00 2001 From: Skalii Date: Mon, 15 Mar 2021 23:31:35 +0200 Subject: [PATCH] fix drawables on older versions of Android --- .../plus/liveupdates/LiveUpdatesFragmentNew.java | 12 ++++-------- .../LiveUpdatesSettingsDialogFragmentNew.java | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java index 92877d6e2c..756f6a3551 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragmentNew.java @@ -27,6 +27,7 @@ import androidx.annotation.ColorRes; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; +import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.SwitchCompat; import androidx.appcompat.widget.Toolbar; @@ -374,12 +375,6 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements } } - public void notifyLiveUpdatesChanged() { - if (getActivity() != null) { - runSort(); - } - } - public static int updateCountEnabled(TextView countView, ArrayList mapsList, OsmandSettings settings) { int countEnabled = 0; if (countView != null) { @@ -544,12 +539,13 @@ public class LiveUpdatesFragmentNew extends BaseOsmAndDialogFragment implements subTitleText += " • " + getString(timeOfDay.getLocalizedId()); }*/ subTitle.setText(subTitleText); - subTitle.setTextColor(ContextCompat.getColor(app, liveUpdateOn ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode))); + subTitle.setTextColor(ContextCompat.getColor(app, liveUpdateOn + ? getActiveTextColorId(nightMode) : getSecondaryTextColorId(nightMode))); Typeface typeface = FontCache.getFont(app, getString(R.string.font_roboto_medium)); subTitle.setTypeface(typeface); } - Drawable statusDrawable = ContextCompat.getDrawable(app, R.drawable.ic_map); + Drawable statusDrawable = AppCompatResources.getDrawable(app, R.drawable.ic_map); int resColorId = !localUpdateOn.get() ? getSecondaryIconColorId(nightMode) : !liveUpdateOn ? getDefaultIconColorId(nightMode) : getOsmandIconColorId(nightMode); int statusColor = ContextCompat.getColor(app, resColorId); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java index bf9839eef0..776368e6a7 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesSettingsDialogFragmentNew.java @@ -249,7 +249,7 @@ public class LiveUpdatesSettingsDialogFragmentNew extends MenuBottomSheetDialogF AndroidUtils.setMargins(itemUpdateNowParams, dp12, dp12, dp16, dp12); itemUpdateNowButton.setLayoutParams(itemUpdateNowParams); ((AppCompatImageView) itemUpdateNowButton.findViewById(R.id.button_icon)).setImageDrawable( - ContextCompat.getDrawable(app, R.drawable.ic_action_update)); + AppCompatResources.getDrawable(app, R.drawable.ic_action_update)); UiUtilities.setupDialogButton(nightMode, itemUpdateNowButton, UiUtilities.DialogButtonType.SECONDARY, getString(R.string.update_now)); itemUpdateNowButton.setMinimumHeight(AndroidUtils.dpToPx(app, app.getResources().getDimension(R.dimen.dialog_button_height)));