当前位置: 首页>>代码示例>>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;未经允许,请勿转载。