We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
WPWebViewClient
1 parent 6a05144 commit fd92adfCopy full SHA for fd92adf
WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java
@@ -1,6 +1,7 @@
1
package org.wordpress.android.util;
2
3
import android.net.Uri;
4
+import android.text.TextUtils;
5
import android.webkit.MimeTypeMap;
6
import android.webkit.URLUtil;
7
@@ -195,4 +196,14 @@ public static boolean isValidUrlAndHostNotNull(String url) {
195
196
}
197
return true;
198
199
+
200
+ // returns true if the passed url is for an image
201
+ public static boolean isImageUrl(String url) {
202
+ if (TextUtils.isEmpty(url)) return false;
203
204
+ String cleanedUrl = removeQuery(url.toLowerCase());
205
206
+ return cleanedUrl.endsWith("jpg") || cleanedUrl.endsWith("jpeg") ||
207
+ cleanedUrl.endsWith("gif") || cleanedUrl.endsWith("png");
208
+ }
209
0 commit comments