Skip to content

Commit

Permalink
Fix icons being invisible when using dark theme
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Sep 30, 2019
1 parent e421942 commit 3ba31c0
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package be.ugent.zeus.hydra.preferences;

import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;

import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;

import be.ugent.zeus.hydra.common.ui.ViewUtils;

/**
* Display an overview of the settings.
*
Expand All @@ -25,7 +27,9 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
preference.setSummary(entry.getDescription());
preference.setPersistent(false);
if (entry.getIcon() != 0) {
preference.setIcon(entry.getIcon());
int textColour = ViewUtils.getColor(context, android.R.attr.textColor);
Drawable drawable = ViewUtils.getTintedVectorDrawableInt(context, entry.getIcon(), textColour);
preference.setIcon(drawable);
}
preference.setOnPreferenceClickListener(p -> {
PreferenceActivity.start(requireContext(), entry);
Expand Down

0 comments on commit 3ba31c0

Please sign in to comment.