当前位置: 首页>>代码示例>>Java>>正文


Java URLUtil.isHttpsUrl方法代码示例

本文整理汇总了Java中android.webkit.URLUtil.isHttpsUrl方法的典型用法代码示例。如果您正苦于以下问题:Java URLUtil.isHttpsUrl方法的具体用法?Java URLUtil.isHttpsUrl怎么用?Java URLUtil.isHttpsUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.URLUtil的用法示例。


在下文中一共展示了URLUtil.isHttpsUrl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleUrlLoading

import android.webkit.URLUtil; //导入方法依赖的package包/类
private boolean handleUrlLoading(WebView view, String url) {
		Log.d(TAG, "handleUrlLoading() called with: " + " url = [" + url + "]");

		if (!(view instanceof PagerWebView)) {
			return false;
		}

		if (url.equals(view.getUrl())) {
			Log.d(TAG, "handleUrlLoading() is same as old url let webview process it " + url);
			return false;
		}
		mLastRequestTime = System.currentTimeMillis();
//		Log.d(TAG, "**getUrl() " + view.getUrl());
//		Log.d(TAG, "**getOriginalUrl() " + view.getOriginalUrl());
//		Log.d(TAG, "**url " + url);
		if (URLUtil.isHttpUrl(url) || URLUtil.isHttpsUrl(url)) {
			if (!isUserClick(view)) {
				Log.d(TAG, "handleUrlLoading checkIfRedirectRequest is true processed by webview.");
				return false;
			}
			Log.d(TAG, "handleUrlLoading process by pager, create new page.");
			pager.loadUrl(url);
			return true;
		}
		return false;
	}
 
开发者ID:fengshihao,项目名称:WebPager,代码行数:27,代码来源:PagerWebViewClient.java

示例2: validateUrl

import android.webkit.URLUtil; //导入方法依赖的package包/类
private boolean validateUrl(String url) {
  if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) {
    return true;
  }

  new AlertDialog.Builder(this)
      .setTitle(getText(R.string.invalid_url_title))
      .setMessage(getString(R.string.invalid_url_text, url))
      .setCancelable(false)
      .setNeutralButton(R.string.ok,
          new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
              dialog.cancel();
            }
          })
      .create()
      .show();
  return false;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:20,代码来源:ConnectActivity.java

示例3: validateUrl

import android.webkit.URLUtil; //导入方法依赖的package包/类
private boolean validateUrl(String url) {
    if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) {
        return true;
    }

    new AlertDialog.Builder(this)
            .setTitle(getText(R.string.invalid_url_title))
            .setMessage(getString(R.string.invalid_url_text, url))
            .setCancelable(false)
            .setNeutralButton(R.string.ok,
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int id) {
                            dialog.cancel();
                        }
                    })
            .create()
            .show();
    return false;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:20,代码来源:ConnectActivity.java

示例4: shouldOverrideUrlLoading

import android.webkit.URLUtil; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
	Log.d(SmartConstants.APP_NAME, "shouldOverrideUrlLoading->url:" + url);
	// Special handling for shouldOverrideUrlLoading
	// Make sure that we call the base class implementation and do
	// not interfere
	// with the base class redirects
	boolean redirected = super.shouldOverrideUrlLoading(view, url);
	Log.d(SmartConstants.APP_NAME, "shouldOverrideUrlLoading->redirected:" + redirected);

	// Do your own redirects here and set the return flag
	if (!redirected) {
		// Redirect HTTP and HTTPS urls to the external browser
		if (url != null && URLUtil.isHttpUrl(url) || URLUtil.isHttpsUrl(url)) {
			view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
			redirected = true;
		}
	}

	return redirected;
}
 
开发者ID:appez,项目名称:appez-android,代码行数:22,代码来源:SmartWebViewClient.java

示例5: download

import android.webkit.URLUtil; //导入方法依赖的package包/类
public void download(String url, int width, int height, DownloadListener listener) {

        mHandler = new Handler(Looper.getMainLooper());

        if (listener == null) {
            Log.w(TAG, "download won't start since there is no assigned listener to It");
        } else {
            mDownloadListener = listener;
            mURL = url;
            mWidth = width;
            mHeight = height;
            if (TextUtils.isEmpty(url)) {
                invokeFail(new Exception("Image URL is empty"));
            } else if (URLUtil.isHttpUrl(url) || URLUtil.isHttpsUrl(url)) {
                downloadImage();
            } else if (URLUtil.isFileUrl(url)) {
                loadCachedImage();
            } else {
                invokeFail(new Exception("Wrong file URL!"));
            }
        }
    }
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:23,代码来源:PNBitmapDownloader.java

示例6: validateUrl

import android.webkit.URLUtil; //导入方法依赖的package包/类
private boolean validateUrl(String url) {
	if (URLUtil.isHttpsUrl(url) || URLUtil.isHttpUrl(url)) {
		return true;
	}

	new AlertDialog.Builder(this)
			.setTitle(getText(R.string.invalid_url_title))
			.setMessage(getString(R.string.invalid_url_text, url))
			.setCancelable(false)
			.setNeutralButton(R.string.ok, new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int id) {
					dialog.cancel();
				}
			}).create().show();
	return false;
}
 
开发者ID:ardnezar,项目名称:webrtc-android,代码行数:17,代码来源:ConnectActivity.java

示例7: isValidURL

import android.webkit.URLUtil; //导入方法依赖的package包/类
/**
 * checks whether the <code>String</code> passed in the <code>EditText</code> object is a valid https-url
 * is valid if:
 * <li>string is not empty</li>
 * <li>string is a valid URL (according to <code>URLUtil.isValidUrl()</code></li>
 * <li>string is a https-URL (according to <code>URLUtil.isHttpsUrl()</code>)</li>
 * <li>string is at least 13 characters long (example for minimum url: https://ab.at)</li>
 * <p>If String ends with a slash ("/"), it is removed.</p>
 * 
 * @param toCheck	<code>EditText</code> containing the String to be checked
 * @return	<code>true</code> iff the <code>String</code> contains a valid https-url
 */
public boolean isValidURL(EditText toCheck)
{
	String stringToCheck = toCheck.getText().toString();
	
	if(stringToCheck.isEmpty()					|| 
			!URLUtil.isValidUrl(stringToCheck)	|| 
			!URLUtil.isHttpsUrl(stringToCheck) 	|| 
			stringToCheck.length() < 13 )
	{
		return false;
	}
	else if(stringToCheck.charAt(stringToCheck.length() - 1 ) == '/') //input url ends with "/" (e.g.: https://example.org/  )
	{
		//remove slash at end
		String newAddressWithoutSlashAtEnd = stringToCheck.substring(0, stringToCheck.length() - 1 );
		toCheck.setText(newAddressWithoutSlashAtEnd);
		
		return isValidURL(toCheck);
	}
	else
	{
		return true;
	}
}
 
开发者ID:aykit,项目名称:MyOwnNotes,代码行数:37,代码来源:SettingsActivity.java

示例8: getUrlFromM3u

import android.webkit.URLUtil; //导入方法依赖的package包/类
private String getUrlFromM3u(String url) throws IOException, StreamHttpException
{
    if (LOCAL_LOGD) log("Get URL from M3U", "d");
    if (mStream == null)
    {
        getInputStream(url);
    }
    String newUrl = url;
    BufferedReader reader = new BufferedReader(new InputStreamReader(mStream));
    String line;
    while ((line = reader.readLine()) != null)
    {
        if (LOCAL_LOGV) log("read line:" + line, "v");
        if (!line.startsWith("#") && URLUtil.isHttpUrl(line) || URLUtil.isHttpsUrl(line))
        {
            newUrl = line;
            break;
        }
    }
    return newUrl;
}
 
开发者ID:shinymayhem,项目名称:radio-presets-widget,代码行数:22,代码来源:ServiceAudioFormat.java

示例9: setImageFromLink

import android.webkit.URLUtil; //导入方法依赖的package包/类
public static void setImageFromLink(final ImageView imageView, final String url) {
    if (imageView == null) {
        return;
    }
    String filePath = url;
    if (!TextUtils.isEmpty(url) && !URLUtil.isHttpsUrl(url)) {
        if (!filePath.contains(FileUtils.FILE_PREFIX)) {
            filePath = FileUtils.getImageFilePathUrl(url);
        }
    }
    ImageLoader.getInstance().displayImage(filePath, imageView);
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:13,代码来源:UIUtils.java

示例10: saveUrl

import android.webkit.URLUtil; //导入方法依赖的package包/类
public int saveUrl(String url) {
    if (!URLUtil.isValidUrl(url)) {
        return 2;
    }

    if (!URLUtil.isHttpsUrl(url)) {
        return 3;
    }

    if (sendLocation != null) {
        int result = sendLocation.pingNewServer(url);

        if (result == 0) {
            SharedPreferences sharedPreferences = preferences.getPreferenceObject();
            SharedPreferences.Editor editor = sharedPreferences.edit();
            editor.putString("url", url);

            if (!editor.commit()) {
                return 5;
            }

            changedSettings();
        }

        return result;
    } else {
        return -1;
    }
}
 
开发者ID:intxcc,项目名称:OwnTrack,代码行数:30,代码来源:TrackingService.java

示例11: validateForm

import android.webkit.URLUtil; //导入方法依赖的package包/类
/**
 * Validates the login form, and provides visual feedback of any problems.
 *
 * @return true if the form is valid, otherwise false.
 */
private boolean validateForm() {
    boolean valid = true;

    // Check the server field contains a valid HTTP or HTTPS URL.
    final String serverText = serverView.getText().toString();
    if (!URLUtil.isHttpUrl(serverText) && !URLUtil.isHttpsUrl(serverText)) {
        valid = false;
        serverView.setError(getResources().getString(R.string.co_login_server_error));
    }

    // Check the email field contains a valid-looking email address.
    final Pattern emailPattern = Patterns.EMAIL_ADDRESS;
    if (!emailPattern.matcher(emailView.getText()).matches()) {
        valid = false;
        emailView.setError(getResources().getString(R.string.co_login_email_error));
    }

    // Check the password field contains at least 1 character.
    final String passwordText = passwordView.getText().toString();
    if (passwordText.length() < 1) {
        valid = false;
        passwordView.setError(getResources().getString(R.string.co_login_password_error));
    }

    return valid;
}
 
开发者ID:grundleborg,项目名称:matterdroid,代码行数:32,代码来源:LoginActivity.java

示例12: getDomainName

import android.webkit.URLUtil; //导入方法依赖的package包/类
/**
 * Extracts the domain name from a URL.
 *
 * @param url the URL to extract the domain from.
 * @return the domain name, or the URL if the domain
 * could not be extracted. The domain name may include
 * HTTPS if the URL is an SSL supported URL.
 */
@Nullable
public static String getDomainName(@Nullable String url) {
    if (url == null || url.isEmpty()) return "";

    boolean ssl = URLUtil.isHttpsUrl(url);
    int index = url.indexOf('/', 8);
    if (index != -1) {
        url = url.substring(0, index);
    }

    URI uri;
    String domain;
    try {
        uri = new URI(url);
        domain = uri.getHost();
    } catch (URISyntaxException e) {
        e.printStackTrace();
        domain = null;
    }

    if (domain == null || domain.isEmpty()) {
        return url;
    }
    if (ssl)
        return Constants.HTTPS + domain;
    else
        return domain.startsWith("www.") ? domain.substring(4) : domain;
}
 
开发者ID:JTechMe,项目名称:JumpGo,代码行数:37,代码来源:Utils.java

示例13: a

import android.webkit.URLUtil; //导入方法依赖的package包/类
public final void a(String paramString1, String paramString2, int paramInt, lbb paramlbb)
{
  if (paramInt == -2) {
    return;
  }
  if (TextUtils.isEmpty(paramString1))
  {
    int k = ev.H;
    paramlbb.a(g().getString(k));
    return;
  }
  if (TextUtils.isEmpty(paramString2))
  {
    int j = ev.J;
    paramlbb.b(g().getString(j));
    return;
  }
  String str1 = URLUtil.guessUrl(paramString2);
  if ((Patterns.WEB_URL.matcher(str1).matches()) && ((URLUtil.isHttpUrl(str1)) || (URLUtil.isHttpsUrl(str1)))) {}
  for (String str2 = str1; str2 == null; str2 = null)
  {
    int i = ev.I;
    paramlbb.b(g().getString(i));
    return;
  }
  odq localodq1 = (odq)this.c.get(this.ab);
  if ((!mfx.a(localodq1.b, paramString1)) || (!mfx.a(localodq1.a, str2)))
  {
    this.c.remove(this.ab);
    odq localodq2 = new odq();
    localodq2.b = paramString1;
    localodq2.a = str2;
    this.c.add(this.ab, localodq2);
    w();
    this.d.notifyDataSetChanged();
    this.a = true;
  }
  paramlbb.d.dismiss();
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:40,代码来源:laz.java

示例14: getDownloader

import android.webkit.URLUtil; //导入方法依赖的package包/类
private Downloader getDownloader(DownloadRequest request) {
    if (URLUtil.isHttpUrl(request.getSource())
            || URLUtil.isHttpsUrl(request.getSource())) {
        return new HttpDownloader(request);
    }
    Log.e(TAG,
            "Could not find appropriate downloader for "
                    + request.getSource()
    );
    return null;
}
 
开发者ID:danieloeh,项目名称:AntennaPodSP,代码行数:12,代码来源:DownloadService.java

示例15: isWebServerConfigUrlValid

import android.webkit.URLUtil; //导入方法依赖的package包/类
public static boolean isWebServerConfigUrlValid(){

        if (OpenTokConfig.CHAT_SERVER_URL == null || OpenTokConfig.CHAT_SERVER_URL.isEmpty()) {
            webServerConfigErrorMessage = "CHAT_SERVER_URL in OpenTokConfig.java must not be null or empty";
            return false;
        } else if ( !( URLUtil.isHttpsUrl(OpenTokConfig.CHAT_SERVER_URL) || URLUtil.isHttpUrl(OpenTokConfig.CHAT_SERVER_URL)) ) {
            webServerConfigErrorMessage = "CHAT_SERVER_URL in OpenTokConfig.java must be specified as either http or https";
            return false;
        } else if ( !URLUtil.isValidUrl(OpenTokConfig.CHAT_SERVER_URL) ) {
            webServerConfigErrorMessage = "CHAT_SERVER_URL in OpenTokConfig.java is not a valid URL";
            return false;
        } else {
            return true;
        }
    }
 
开发者ID:opentok,项目名称:opentok-android-sdk-samples,代码行数:16,代码来源:OpenTokConfig.java


注:本文中的android.webkit.URLUtil.isHttpsUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。