|
@@ -20,6 +20,8 @@ package com.owncloud.android.utils;
|
|
|
|
|
|
import android.graphics.drawable.Drawable;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.net.Uri;
|
|
import android.net.Uri;
|
|
|
|
+import android.support.annotation.ColorRes;
|
|
|
|
+import android.support.annotation.DrawableRes;
|
|
import android.support.v4.content.res.ResourcesCompat;
|
|
import android.support.v4.content.res.ResourcesCompat;
|
|
import android.support.v4.graphics.drawable.DrawableCompat;
|
|
import android.support.v4.graphics.drawable.DrawableCompat;
|
|
import android.webkit.MimeTypeMap;
|
|
import android.webkit.MimeTypeMap;
|
|
@@ -119,6 +121,13 @@ public class MimeTypeUtil {
|
|
return getFolderTypeIcon(false, false);
|
|
return getFolderTypeIcon(false, false);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static Drawable tintDrawable(@DrawableRes int id, @ColorRes int color) {
|
|
|
|
+ Drawable drawable = ResourcesCompat.getDrawable(MainApp.getAppContext().getResources(), id, null);
|
|
|
|
+ drawable = DrawableCompat.wrap(drawable);
|
|
|
|
+ DrawableCompat.setTint(drawable, MainApp.getAppContext().getResources().getColor(color));
|
|
|
|
+ return drawable;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Returns a single MIME type of all the possible, by inspection of the file extension, and taking
|
|
* Returns a single MIME type of all the possible, by inspection of the file extension, and taking
|
|
* into account the MIME types known by ownCloud first.
|
|
* into account the MIME types known by ownCloud first.
|