List of usage examples for android.net Uri getQueryParameter
@Nullable
public String getQueryParameter(String key)
From source file:Main.java
public static String parseRequestCode(Uri data) { return data.getQueryParameter("code"); }
From source file:Main.java
public static String getGroupBy(Uri uri) { return uri.getQueryParameter(GROUP_BY); }
From source file:Main.java
public static String getOverrideAccountName(Uri uri) { return uri.getQueryParameter(QUERY_PARAMETER_OVERRIDE_ACCOUNT_NAME); }
From source file:Main.java
public static boolean isQueryDistinct(Uri uri) { return !TextUtils.isEmpty(uri.getQueryParameter(QUERY_PARAMETER_DISTINCT)); }
From source file:Main.java
static boolean isQueryDistinct(Uri uri) { return !TextUtils.isEmpty(uri.getQueryParameter(QUERY_PARAMETER_DISTINCT)); }
From source file:Main.java
private static boolean isEncrypt(String url) { int ret = 0;/*ww w .ja v a 2s . c om*/ try { Uri uri = Uri.parse(url); ret = Integer.parseInt(uri.getQueryParameter("isEncrypted")); } catch (Exception e) { e.printStackTrace(); } return ret == 1; }
From source file:Main.java
public static boolean getBooleanQueryParameter(Uri uri, String key, boolean defaultValue) { String flag = uri.getQueryParameter(key); if (flag == null) { return defaultValue; }//from www . j a v a 2 s. c o m flag = flag.toLowerCase(Locale.ROOT); return (!"false".equals(flag) && !"0".equals(flag)); }
From source file:Main.java
static Uri uriStripQueryParameter(Uri uri, String paramKey) { String queryParam = uri.getQueryParameter(paramKey); if (queryParam == null) { // nothing to strip return uri; } else {/* ww w.j ava2 s .c o m*/ String uriString = uri.toString(); String paramString = paramKey + "=" + queryParam; if (uri.getQuery().length() == paramString.length()) { paramString = "?" + paramString; } else if (uriString.length() - paramString.length() == uriString.indexOf(paramString)) { paramString = "&" + paramString; } else { paramString = paramString + "&"; } return Uri.parse(uriString.replace(paramString, "")); } }
From source file:Main.java
/** * Checks to see if URL is DuckDuckGo SERP * Returns the query if it's a SERP, otherwise null * /*from w ww. j a va 2 s. c o m*/ * @param url * @return */ static public String getQueryIfSerp(String url) { if (!isSerpUrl(url)) { return null; } Uri uri = Uri.parse(url); String query = uri.getQueryParameter("q"); if (query != null) return query; String lastPath = uri.getLastPathSegment(); if (lastPath == null) return null; if (!lastPath.contains(".html")) { return lastPath.replace("_", " "); } return null; }
From source file:Main.java
private static long getLongParamFromUri(Uri uri, String paramName, long defaultValue) { final String value = uri.getQueryParameter(paramName); if (!TextUtils.isEmpty(value)) { try {/*from w w w .j a v a2 s . co m*/ return Long.parseLong(value); } catch (NumberFormatException e) { // return default } } return defaultValue; }