Skip to content

Commit

Permalink
Replaced all deprecated getColor functions
Browse files Browse the repository at this point in the history
  • Loading branch information
choiman1559 committed Jul 13, 2024
1 parent bd2aec8 commit 7f34187
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion app/src/main/java/com/noti/main/ui/HolderFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void setType(String type) {
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.activity_options, container, false);
view.setBackgroundColor(getResources().getColor(R.color.ui_bg_surface));
view.setBackgroundColor(getResources().getColor(R.color.ui_bg_surface, null));

mToolbar = view.findViewById(R.id.toolbar);
mToolbar.setTitle(R.string.app_name);
Expand Down
26 changes: 13 additions & 13 deletions app/src/main/java/com/noti/main/ui/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ protected void onCreate(Bundle savedInstanceState) {
});

boolean isNightMode = (getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;
ServiceToggle.setTextColor(getResources().getColor(isNightMode ? R.color.ui_bg : R.color.ui_fg));
ServiceToggle.setTextColor(getResources().getColor(isNightMode ? R.color.ui_bg : R.color.ui_fg, null));

boolean isUIDBlank = prefs.getString("UID", "").isEmpty();
if (isUIDBlank) {
Expand Down Expand Up @@ -377,31 +377,31 @@ void markSelectedMenu(MaterialCardView cardView) {
if (Application.isTablet()) {
if (selectedCardView == null) {
selectedCardView = cardView;
selectedCardView.setCardBackgroundColor(getResources().getColor(R.color.ui_menu_accent));
selectedCardView.setCardBackgroundColor(getResources().getColor(R.color.ui_menu_accent, null));

if (isNightMode) {
ImageView icon = (ImageView) ((RelativeLayout) selectedCardView.getChildAt(0)).getChildAt(0);
icon.setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.ui_bg)));
icon.setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.ui_bg, null)));

LinearLayout layout = (LinearLayout) ((RelativeLayout) selectedCardView.getChildAt(0)).getChildAt(1);
((TextView) layout.getChildAt(0)).setTextColor(getResources().getColor(R.color.ui_bg));
((TextView) layout.getChildAt(1)).setTextColor(getResources().getColor(R.color.ui_bg));
((TextView) layout.getChildAt(0)).setTextColor(getResources().getColor(R.color.ui_bg, null));
((TextView) layout.getChildAt(1)).setTextColor(getResources().getColor(R.color.ui_bg, null));
}
} else if (selectedCardView.getId() != cardView.getId()) {
selectedCardView.setCardBackgroundColor(getResources().getColor(R.color.ui_bg));
cardView.setCardBackgroundColor(getResources().getColor(R.color.ui_menu_accent));
selectedCardView.setCardBackgroundColor(getResources().getColor(R.color.ui_bg, null));
cardView.setCardBackgroundColor(getResources().getColor(R.color.ui_menu_accent, null));

if (isNightMode) {
((ImageView) ((RelativeLayout) selectedCardView.getChildAt(0)).getChildAt(0)).setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.ui_fg)));
((ImageView) ((RelativeLayout) cardView.getChildAt(0)).getChildAt(0)).setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.ui_bg)));
((ImageView) ((RelativeLayout) selectedCardView.getChildAt(0)).getChildAt(0)).setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.ui_fg, null)));
((ImageView) ((RelativeLayout) cardView.getChildAt(0)).getChildAt(0)).setImageTintList(ColorStateList.valueOf(getResources().getColor(R.color.ui_bg, null)));

LinearLayout layout1 = (LinearLayout) ((RelativeLayout) selectedCardView.getChildAt(0)).getChildAt(1);
((TextView) layout1.getChildAt(0)).setTextColor(getResources().getColor(R.color.ui_fg));
((TextView) layout1.getChildAt(1)).setTextColor(getResources().getColor(R.color.ui_fg));
((TextView) layout1.getChildAt(0)).setTextColor(getResources().getColor(R.color.ui_fg, null));
((TextView) layout1.getChildAt(1)).setTextColor(getResources().getColor(R.color.ui_fg, null));

LinearLayout layout2 = (LinearLayout) ((RelativeLayout) cardView.getChildAt(0)).getChildAt(1);
((TextView) layout2.getChildAt(0)).setTextColor(getResources().getColor(R.color.ui_bg));
((TextView) layout2.getChildAt(1)).setTextColor(getResources().getColor(R.color.ui_bg));
((TextView) layout2.getChildAt(0)).setTextColor(getResources().getColor(R.color.ui_bg, null));
((TextView) layout2.getChildAt(1)).setTextColor(getResources().getColor(R.color.ui_bg, null));
}
selectedCardView = cardView;
}
Expand Down

0 comments on commit 7f34187

Please sign in to comment.