|
@@ -1,23 +1,24 @@
|
|
|
/**
|
|
|
* ownCloud Android client application
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* Copyright (C) 2016 ownCloud Inc.
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
* it under the terms of the GNU General Public License version 2,
|
|
|
* as published by the Free Software Foundation.
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
* GNU General Public License for more details.
|
|
|
- *
|
|
|
+ * <p>
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
|
|
|
|
package com.owncloud.android.utils;
|
|
|
|
|
|
+import android.graphics.drawable.Drawable;
|
|
|
import android.net.Uri;
|
|
|
import android.webkit.MimeTypeMap;
|
|
|
|
|
@@ -94,16 +95,25 @@ public class MimeTypeUtil {
|
|
|
* @param isSharedViaLink flag if the folder is publicly shared via link
|
|
|
* @return Identifier of an image resource.
|
|
|
*/
|
|
|
- public static int getFolderTypeIconId(boolean isSharedViaUsers, boolean isSharedViaLink) {
|
|
|
+ public static Drawable getFolderTypeIcon(boolean isSharedViaUsers, boolean isSharedViaLink) {
|
|
|
+ int drawableId;
|
|
|
+
|
|
|
if (isSharedViaLink) {
|
|
|
- return R.drawable.folder_public;
|
|
|
+ drawableId = R.drawable.folder_public;
|
|
|
} else if (isSharedViaUsers) {
|
|
|
- return R.drawable.shared_with_me_folder;
|
|
|
+ drawableId = R.drawable.shared_with_me_folder;
|
|
|
+ } else {
|
|
|
+ drawableId = R.drawable.ic_menu_archive;
|
|
|
}
|
|
|
|
|
|
- return R.drawable.ic_menu_archive;
|
|
|
+ return DisplayUtils.tintDrawable(drawableId, R.color.primary);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static Drawable getDefaultFolderIcon() {
|
|
|
+ return getFolderTypeIcon(false, false);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 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.
|