Skip to content

Commit

Permalink
Fix media isVideo/isValidImage/... utils method
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Feb 15, 2016
1 parent 3ed94cf commit 73e3d28
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,23 @@ public static boolean isValidImage(String url) {
if (url == null) {
return false;
}

url = url.toLowerCase();
return url.endsWith(".png") || url.endsWith(".jpg") || url.endsWith(".jpeg") || url.endsWith(".gif");
}

public static boolean isDocument(String url) {
if (url == null) {
return false;
}

url = url.toLowerCase();
return url.endsWith(".doc") || url.endsWith(".docx") || url.endsWith(".odt") || url.endsWith(".pdf");
}

public static boolean isPowerpoint(String url) {
if (url == null) {
return false;
}

url = url.toLowerCase();
return url.endsWith(".ppt") || url.endsWith(".pptx") || url.endsWith(".pps") || url.endsWith(".ppsx") ||
url.endsWith(".key");
}
Expand All @@ -58,14 +58,15 @@ public static boolean isSpreadsheet(String url) {
if (url == null) {
return false;
}

url = url.toLowerCase();
return url.endsWith(".xls") || url.endsWith(".xlsx");
}

public static boolean isVideo(String url) {
if (url == null) {
return false;
}
url = url.toLowerCase();
return url.endsWith(".ogv") || url.endsWith(".mp4") || url.endsWith(".m4v") || url.endsWith(".mov") ||
url.endsWith(".wmv") || url.endsWith(".avi") || url.endsWith(".mpg") || url.endsWith(".3gp") ||
url.endsWith(".3g2") || url.contains("video");
Expand All @@ -75,6 +76,7 @@ public static boolean isAudio(String url) {
if (url == null) {
return false;
}
url = url.toLowerCase();
return url.endsWith(".mp3") || url.endsWith(".ogg") || url.endsWith(".wav") || url.endsWith(".wma") ||
url.endsWith(".aiff") || url.endsWith(".aif") || url.endsWith(".aac") || url.endsWith(".m4a");
}
Expand Down

0 comments on commit 73e3d28

Please sign in to comment.