mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-16 09:15:30 +01:00
improve code scores
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
ed7a762b4c
commit
61e0c88188
@ -101,6 +101,7 @@ import androidx.annotation.XmlRes;
|
|||||||
import androidx.appcompat.widget.AppCompatDrawableManager;
|
import androidx.appcompat.widget.AppCompatDrawableManager;
|
||||||
import androidx.appcompat.widget.SearchView;
|
import androidx.appcompat.widget.SearchView;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
import androidx.core.content.res.ResourcesCompat;
|
||||||
import androidx.core.graphics.ColorUtils;
|
import androidx.core.graphics.ColorUtils;
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
import androidx.core.graphics.drawable.DrawableCompat;
|
||||||
import androidx.emoji.text.EmojiCompat;
|
import androidx.emoji.text.EmojiCompat;
|
||||||
@ -160,7 +161,7 @@ public class DisplayUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Bitmap getRoundedBitmapFromVectorDrawableResource(Resources resources, int resource) {
|
public static Bitmap getRoundedBitmapFromVectorDrawableResource(Resources resources, int resource) {
|
||||||
VectorDrawable vectorDrawable = (VectorDrawable) resources.getDrawable(resource);
|
VectorDrawable vectorDrawable = (VectorDrawable) ResourcesCompat.getDrawable(resources, resource,null);
|
||||||
Bitmap bitmap = getBitmap(vectorDrawable);
|
Bitmap bitmap = getBitmap(vectorDrawable);
|
||||||
new RoundPostprocessor(true).process(bitmap);
|
new RoundPostprocessor(true).process(bitmap);
|
||||||
return bitmap;
|
return bitmap;
|
||||||
@ -260,13 +261,14 @@ public class DisplayUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Drawable getTintedDrawable(Resources res, @DrawableRes int drawableResId, @ColorRes int colorResId) {
|
public static Drawable getTintedDrawable(Resources res, @DrawableRes int drawableResId, @ColorRes int colorResId) {
|
||||||
Drawable drawable = res.getDrawable(drawableResId);
|
Drawable drawable = ResourcesCompat.getDrawable(res, drawableResId,null);;
|
||||||
int color = res.getColor(colorResId);
|
int color = res.getColor(colorResId);
|
||||||
|
if (drawable != null) {
|
||||||
drawable.setTint(color);
|
drawable.setTint(color);
|
||||||
|
}
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static Drawable getDrawableForMentionChipSpan(Context context, String id, CharSequence label,
|
public static Drawable getDrawableForMentionChipSpan(Context context, String id, CharSequence label,
|
||||||
UserEntity conversationUser, String type,
|
UserEntity conversationUser, String type,
|
||||||
@XmlRes int chipResource,
|
@XmlRes int chipResource,
|
||||||
|
Loading…
Reference in New Issue
Block a user