Merge pull request #11157 from osmandapp/fix_drawables_osmand_live

OsmAnd Live. Fix drawables on older versions of Android
This commit is contained in:
Vitaliy 2021-03-16 09:07:36 +02:00 committed by GitHub
commit 80e02521d8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 9 deletions

View file

@ -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<LocalIndexInfo> 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);

View file

@ -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)));