mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-15 22:42:47 +00:00
tint settings icons for kitkat programmatically
This commit is contained in:
parent
8abfe26411
commit
02db89b9a0
1 changed files with 16 additions and 0 deletions
|
@ -19,9 +19,15 @@ package org.dslul.openboard.inputmethod.latin.settings;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
|
import androidx.preference.Preference;
|
||||||
|
|
||||||
import org.dslul.openboard.inputmethod.latin.AudioAndHapticFeedbackManager;
|
import org.dslul.openboard.inputmethod.latin.AudioAndHapticFeedbackManager;
|
||||||
import org.dslul.openboard.inputmethod.latin.R;
|
import org.dslul.openboard.inputmethod.latin.R;
|
||||||
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
|
import org.dslul.openboard.inputmethod.latin.RichInputMethodManager;
|
||||||
|
@ -33,6 +39,16 @@ public final class PreferencesSettingsFragment extends SubScreenFragment {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
addPreferencesFromResource(R.xml.prefs_screen_preferences);
|
addPreferencesFromResource(R.xml.prefs_screen_preferences);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
// need to set icon tint because old android versions don't use the vector drawables
|
||||||
|
for (int i = 0; i < getPreferenceScreen().getPreferenceCount(); i++) {
|
||||||
|
final Preference p = getPreferenceScreen().getPreference(0);
|
||||||
|
final Drawable icon = p.getIcon();
|
||||||
|
if (icon != null)
|
||||||
|
DrawableCompat.setTint(icon, Color.WHITE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final Resources res = getResources();
|
final Resources res = getResources();
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue