replace more Drawable.setColorFilter() with Drawable.setTint()

This commit is contained in:
Christophe Beyls 2024-05-03 14:49:27 +02:00
parent e793688c8c
commit 33a3858d11
2 changed files with 5 additions and 7 deletions

View File

@ -517,7 +517,7 @@ public class NotificationsAdapter extends RecyclerView.Adapter<RecyclerView.View
Drawable getIconWithColor(Context context, @DrawableRes int drawable, @ColorRes int color) {
Drawable icon = ContextCompat.getDrawable(context, drawable);
if (icon != null) {
icon.setColorFilter(context.getColor(color), PorterDuff.Mode.SRC_ATOP);
icon.setTint(context.getColor(color));
}
return icon;
}

View File

@ -23,8 +23,6 @@ import android.content.Intent
import android.content.SharedPreferences
import android.content.pm.PackageManager
import android.graphics.Bitmap
import android.graphics.PorterDuff
import android.graphics.PorterDuffColorFilter
import android.icu.text.BreakIterator
import android.net.Uri
import android.os.Build
@ -829,7 +827,7 @@ class ComposeActivity :
)
}
}
binding.composeHideMediaButton.drawable.colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)
binding.composeHideMediaButton.drawable.setTint(color)
var oneMediaWithoutDescription = false
for (media in viewModel.media.value) {
@ -855,7 +853,7 @@ class ComposeActivity :
} else {
getColor(R.color.tusky_blue)
}
binding.composeScheduleButton.drawable.colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)
binding.composeScheduleButton.drawable.setTint(color)
}
}
@ -1186,7 +1184,7 @@ class ComposeActivity :
}
)
binding.addPollTextActionTextView.setTextColor(textColor)
binding.addPollTextActionTextView.compoundDrawablesRelative[0].colorFilter = PorterDuffColorFilter(textColor, PorterDuff.Mode.SRC_IN)
binding.addPollTextActionTextView.compoundDrawablesRelative[0].setTint(textColor)
}
private fun editImageInQueue(item: QueuedMedia) {
@ -1277,7 +1275,7 @@ class ComposeActivity :
android.R.attr.textColorTertiary
)
}
binding.composeContentWarningButton.drawable.colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)
binding.composeContentWarningButton.drawable.setTint(color)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {