當前位置: 首頁>>代碼示例>>Java>>正文


Java Uri.getQuery方法代碼示例

本文整理匯總了Java中android.net.Uri.getQuery方法的典型用法代碼示例。如果您正苦於以下問題:Java Uri.getQuery方法的具體用法?Java Uri.getQuery怎麽用?Java Uri.getQuery使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.net.Uri的用法示例。


在下文中一共展示了Uri.getQuery方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: needsSpecialsInAssetUrlFix

import android.net.Uri; //導入方法依賴的package包/類
private static boolean needsSpecialsInAssetUrlFix(Uri uri) {
    if (CordovaResourceApi.getUriType(uri) != CordovaResourceApi.URI_TYPE_ASSET) {
        return false;
    }
    if (uri.getQuery() != null || uri.getFragment() != null) {
        return true;
    }

    if (!uri.toString().contains("%")) {
        return false;
    }

    switch(Build.VERSION.SDK_INT){
        case Build.VERSION_CODES.ICE_CREAM_SANDWICH:
        case Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
            return true;
    }
    return false;
}
 
開發者ID:runner525,項目名稱:x5webview-cordova-plugin,代碼行數:20,代碼來源:X5WebViewClient.java

示例2: needsSpecialsInAssetUrlFix

import android.net.Uri; //導入方法依賴的package包/類
private static boolean needsSpecialsInAssetUrlFix(Uri uri) {
    if (CordovaResourceApi.getUriType(uri) != CordovaResourceApi.URI_TYPE_ASSET) {
        return false;
    }
    if (uri.getQuery() != null || uri.getFragment() != null) {
        return true;
    }

    if (!uri.toString().contains("%")) {
        return false;
    }

    switch(android.os.Build.VERSION.SDK_INT){
        case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH:
        case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
            return true;
    }
    return false;
}
 
開發者ID:fachrihawari,項目名稱:cordova-vuetify,代碼行數:20,代碼來源:SystemWebViewClient.java

示例3: needsSpecialsInAssetUrlFix

import android.net.Uri; //導入方法依賴的package包/類
private static boolean needsSpecialsInAssetUrlFix(Uri uri) {
  if (CordovaResourceApi.getUriType(uri) != CordovaResourceApi.URI_TYPE_ASSET) {
    return false;
  }
  if (uri.getQuery() != null || uri.getFragment() != null) {
    return true;
  }

  if (!uri.toString().contains("%")) {
    return false;
  }

  switch (android.os.Build.VERSION.SDK_INT) {
    case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH:
    case android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1:
      return true;
  }
  return false;
}
 
開發者ID:zsxsoft,項目名稱:cordova-plugin-x5-tbs,代碼行數:20,代碼來源:X5WebViewClient.java

示例4: matchesSafely

import android.net.Uri; //導入方法依賴的package包/類
@Override
protected boolean matchesSafely(Uri item) {
    if (!item.isAbsolute()
            || !item.isHierarchical()
            || TextUtils.isEmpty(item.getScheme())
            || TextUtils.isEmpty(item.getAuthority())) {
        return false;
    }

    if (!mPermittedSchemes.isEmpty() && !mPermittedSchemes.contains(item.getScheme())) {
        return false;
    }

    if (mAllowPathQueryOrFragment) {
        return true;
    }

    return TextUtils.isEmpty(item.getPath())
            && item.getQuery() == null
            && item.getFragment() == null;
}
 
開發者ID:openid,項目名稱:OpenYOLO-Android,代碼行數:22,代碼來源:CustomMatchers.java

示例5: setUrl

import android.net.Uri; //導入方法依賴的package包/類
public void setUrl(String url) {
    this.url = url;
    Uri uri = Uri.parse(url);
    host = uri.getHost();
    path = uri.getPath() + ((uri.getQuery() != null) ? "?" + uri.getQuery() : "");
    scheme = uri.getScheme();
}
 
開發者ID:jgilfelt,項目名稱:chuck,代碼行數:8,代碼來源:HttpTransaction.java

示例6: loadTestUrlFromIntent

import android.net.Uri; //導入方法依賴的package包/類
private void loadTestUrlFromIntent()
{
  Uri uri = getIntent().getData();
  if (uri == null && this.m_newIntent != null && this.m_newIntent.getData() != null)
  {
    uri = this.m_newIntent.getData();
  }
  if (uri == null)
  {
    Log.i(LOG_TAG, "Activity " + this + " launched without a URI.");
    return;
  }
  else
  {
    Log.i(LOG_TAG, "Storing URI " + uri + " for activity " + this);

    // Separate the TouchTest Driver parameter string from the "un-adorned" launch URL.
    String paramsList = uri.getQuery();
    String driverParams = paramsList.substring(paramsList.indexOf(TTD_PREFIX) + TTD_PREFIX.length());
    Log.i(LOG_TAG, "Driver param string: " + driverParams);

    Map<String, String> sessionSettings = TouchTestHelper.getLaunchParams(driverParams);
    String startingURL = sessionSettings.get("startingURL");
    
    if (startingURL != null)
    {
      loadStartingUrl(startingURL);
    }
  }
}
 
開發者ID:SOASTA,項目名稱:touchtestweb-android,代碼行數:31,代碼來源:MainActivity.java

示例7: getInitialUrlForDocument

import android.net.Uri; //導入方法依賴的package包/類
/**
 * Parse out the URL for a document Intent.
 * @param intent Intent to check.
 * @return The URL that the Intent was fired to display, or null if it couldn't be retrieved.
 */
public static String getInitialUrlForDocument(Intent intent) {
    if (intent == null || intent.getData() == null) return null;
    Uri data = intent.getData();
    return TextUtils.equals(data.getScheme(), UrlConstants.DOCUMENT_SCHEME)
            ? data.getQuery() : null;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:12,代碼來源:ActivityDelegate.java

示例8: match

import android.net.Uri; //導入方法依賴的package包/類
@Override
public boolean match(Context context, Uri uri, @Nullable String route, RouteRequest routeRequest) {
    if (isEmpty(route)) {
        return false;
    }
    Uri routeUri = Uri.parse(route);
    if (uri.isAbsolute() && routeUri.isAbsolute()) { // scheme != null
        if (!uri.getScheme().equals(routeUri.getScheme())) {
            // http != https
            return false;
        }
        if (isEmpty(uri.getAuthority()) && isEmpty(routeUri.getAuthority())) {
            // host1 == host2 == empty
            return true;
        }
        // google.com == google.com:443 (include port)
        if (!isEmpty(uri.getAuthority()) && !isEmpty(routeUri.getAuthority())
                && uri.getAuthority().equals(routeUri.getAuthority())) {
            if (!cutSlash(uri.getPath()).equals(cutSlash(routeUri.getPath()))) {
                return false;
            }

            // bundle parser
            if (uri.getQuery() != null) {
                parseParams(uri, routeRequest);
            }
            return true;
        }
    }
    return false;
}
 
開發者ID:chenenyu,項目名稱:Router,代碼行數:32,代碼來源:SchemeMatcher.java

示例9: parseBitcoinUri

import android.net.Uri; //導入方法依賴的package包/類
static public BarcodeData parseBitcoinUri(String uri) {
    Timber.d("parseBitcoinUri=%s", uri);

    if (uri == null) return null;

    if (!uri.startsWith(BTC_SCHEME)) return null;

    String noScheme = uri.substring(BTC_SCHEME.length());
    Uri bitcoin = Uri.parse(noScheme);
    Map<String, String> parms = new HashMap<>();
    String query = bitcoin.getQuery();
    if (query != null) {
        String[] args = query.split("&");
        for (String arg : args) {
            String[] namevalue = arg.split("=");
            if (namevalue.length == 0) {
                continue;
            }
            parms.put(Uri.decode(namevalue[0]).toLowerCase(),
                    namevalue.length > 1 ? Uri.decode(namevalue[1]) : "");
        }
    }
    String address = bitcoin.getPath();
    String amount = parms.get(BTC_AMOUNT);
    if (amount != null) {
        try {
            Double.parseDouble(amount);
        } catch (NumberFormatException ex) {
            Timber.d(ex.getLocalizedMessage());
            return null; // we have an amount but its not a number!
        }
    }
    if (!BitcoinAddressValidator.validate(address, WalletManager.getInstance().isTestNet())) {
        Timber.d("address invalid");
        return null;
    }
    return new BarcodeData(BarcodeData.Asset.BTC, address, amount);
}
 
開發者ID:m2049r,項目名稱:xmrwallet,代碼行數:39,代碼來源:BarcodeData.java

示例10: convertUriToFilePath

import android.net.Uri; //導入方法依賴的package包/類
/**
 * 截取請求,轉化成本地文件夾形式
 *
 * @param uri
 * @return
 */
private static String convertUriToFilePath(Uri uri) {
    if (null == uri || TextUtils.isEmpty(uri.toString())) {
        return null;
    }

    // 獲取SD卡主緩存目錄
    String cacheDir = getCacheDir();
    if (TextUtils.isEmpty(cacheDir)) {
        return null;
    }
    File file = new File(cacheDir, DIR_H5);
    if (!file.exists()) {
        file.mkdirs();
    }
    cacheDir = file.getAbsolutePath();

    // 取出host + path信息
    StringBuilder filePathSB = new StringBuilder(cacheDir);
    filePathSB.append(File.separator);
    String host = uri.getHost();
    if (!TextUtils.isEmpty(host)) {
        filePathSB.append(host);
    }

    String path = uri.getPath();
    if (!TextUtils.isEmpty(path)) {
        filePathSB.append(path);
    }

    // Query信息
    String query = uri.getQuery();
    if (!TextUtils.isEmpty(query)) {
        filePathSB.append(query);
    }

    // host + path不為空
    if (filePathSB.length() > 0) {
        return filePathSB.toString();
    }

    return null;
}
 
開發者ID:snailycy,項目名稱:AndroidHybridLib,代碼行數:49,代碼來源:CacheUtils.java

示例11: getUrlForCustomTab

import android.net.Uri; //導入方法依賴的package包/類
private static String getUrlForCustomTab(Intent intent) {
    if (intent == null || intent.getData() == null) return null;
    Uri data = intent.getData();
    return TextUtils.equals(data.getScheme(), UrlConstants.CUSTOM_TAB_SCHEME)
            ? data.getQuery() : null;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:7,代碼來源:IntentHandler.java

示例12: callJava

import android.net.Uri; //導入方法依賴的package包/類
public static String callJava(Activity webLoader, WebView webView, String uriString) {
    String methodName = "";
    String apiName = "";
    String param = "{}";
    String port = "";
    String error;

    if (TextUtils.isEmpty(uriString)) {
        return "uri不能為空";
    }

    Uri uri = Uri.parse(uriString);
    if (uri == null) {
        return "參數不合法";
    }

    apiName = uri.getHost();
    param = uri.getQuery();
    port = uri.getPort() + "";
    methodName = uri.getPath();

    if (TextUtils.isEmpty(apiName)) {
        return "API_Name不能為空";
    }
    if (TextUtils.isEmpty(port)) {
        return "callbackId不能為空";
    }
    methodName = methodName.replace("/", "");
    if (TextUtils.isEmpty(methodName)) {
        return "handlerName不能為空";
    }

    if (uriString.contains("#")) {
        error = "參數中不能有#";
        new Callback(webView, port).apply(getFailJSONObject(error));
        return error;
    }
    if (!uriString.startsWith(EJS_SCHEME)) {
        error = "SCHEME不正確";
        new Callback(webView, port).apply(getFailJSONObject(error));
        return error;
    }

    if (exposedMethods.containsKey(apiName)) {
        HashMap<String, Method> methodHashMap = exposedMethods.get(apiName);
        if (methodHashMap != null && methodHashMap.size() != 0 && methodHashMap.containsKey(methodName)) {
            Method method = methodHashMap.get(methodName);
            if (method != null) {
                try {
                    method.invoke(null, webLoader, webView, new JSONObject(param), new Callback(webView, port));
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    } else {
        //未注冊API
        error = apiName + "未注冊";
        new Callback(webView, port).apply(getFailJSONObject(error));
        return error;
    }
    return null;
}
 
開發者ID:dailc,項目名稱:hybrid-jsbridge-simple,代碼行數:64,代碼來源:JSBridge.java

示例13: parseMoneroUri

import android.net.Uri; //導入方法依賴的package包/類
/**
 * Parse and decode a monero scheme string. It is here because it needs to validate the data.
 *
 * @param uri String containing a monero URL
 * @return BarcodeData object or null if uri not valid
 */

static public BarcodeData parseMoneroUri(String uri) {
    Timber.d("parseMoneroUri=%s", uri);

    if (uri == null) return null;

    if (!uri.startsWith(XMR_SCHEME)) return null;

    String noScheme = uri.substring(XMR_SCHEME.length());
    Uri monero = Uri.parse(noScheme);
    Map<String, String> parms = new HashMap<>();
    String query = monero.getQuery();
    if (query != null) {
        String[] args = query.split("&");
        for (String arg : args) {
            String[] namevalue = arg.split("=");
            if (namevalue.length == 0) {
                continue;
            }
            parms.put(Uri.decode(namevalue[0]).toLowerCase(),
                    namevalue.length > 1 ? Uri.decode(namevalue[1]) : "");
        }
    }
    String address = monero.getPath();
    String paymentId = parms.get(XMR_PAYMENTID);
    String amount = parms.get(XMR_AMOUNT);
    if (amount != null) {
        try {
            Double.parseDouble(amount);
        } catch (NumberFormatException ex) {
            Timber.d(ex.getLocalizedMessage());
            return null; // we have an amount but its not a number!
        }
    }
    if ((paymentId != null) && !Wallet.isPaymentIdValid(paymentId)) {
        Timber.d("paymentId invalid");
        return null;
    }

    if (!Wallet.isAddressValid(address)) {
        Timber.d("address invalid");
        return null;
    }
    return new BarcodeData(Asset.XMR, address, paymentId, amount);
}
 
開發者ID:m2049r,項目名稱:xmrwallet,代碼行數:52,代碼來源:BarcodeData.java


注:本文中的android.net.Uri.getQuery方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。