本文整理汇总了Java中android.webkit.URLUtil.isHttpUrl方法的典型用法代码示例。如果您正苦于以下问题:Java URLUtil.isHttpUrl方法的具体用法?Java URLUtil.isHttpUrl怎么用?Java URLUtil.isHttpUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.URLUtil
的用法示例。
在下文中一共展示了URLUtil.isHttpUrl方法的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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!"));
}
}
}
示例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;
}
示例7: setURL
import android.webkit.URLUtil; //导入方法依赖的package包/类
public void setURL(String url, String username) throws URLInvalid
{
// check whether the URL is valid... otherwise there is no use going on....
if (!URLUtil.isValidUrl(url) || !URLUtil.isHttpUrl(url))
{
throw new URLInvalid(url);
}
if (this.url.contentEquals(url) && this.username.contentEquals(username) && !username.isEmpty())
{
return;
}
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint(url)
.setClient(new HueConnectionClient())
//.setLogLevel(RestAdapter.LogLevel.FULL)
.build();
hueRestInterface = restAdapter.create(HueRestInterface.class);
this.url = url;
connectionGood = false;
lights = null;
this.username = username;
isConnected = false;
}
示例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;
}
示例9: 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;
}
示例10: 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();
}
示例11: 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;
}
示例12: 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;
}
}
示例13: 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;
}
}
示例14: isConfigUrlValid
import android.webkit.URLUtil; //导入方法依赖的package包/类
public static boolean isConfigUrlValid(){
if (OpenTokConfig.CHAT_SERVER_URL == null) {
configErrorMessage = "CHAT_SERVER_URL in OpenTokConfig.java must not be null";
return false;
} else if ( !( URLUtil.isHttpsUrl(OpenTokConfig.CHAT_SERVER_URL) || URLUtil.isHttpUrl(OpenTokConfig.CHAT_SERVER_URL)) ) {
configErrorMessage = "CHAT_SERVER_URL in OpenTokConfig.java must be specified as either http or https";
return false;
} else if ( !URLUtil.isValidUrl(OpenTokConfig.CHAT_SERVER_URL) ) {
configErrorMessage = "CHAT_SERVER_URL in OpenTokConfig.java is not a valid URL";
return false;
} else {
return true;
}
}
示例15: validateUrl
import android.webkit.URLUtil; //导入方法依赖的package包/类
public static boolean validateUrl(String url)
{
if (!URLUtil.isHttpUrl(url) && !URLUtil.isHttpsUrl(url))
{
//if (LOCAL_LOGV) log("not a valid http or https url", "v");
return false;
}
//check for empty after prefix
if (url.equals("http://") || url.equals("https://"))
{
return false;
}
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try
{
mediaPlayer.setDataSource(url);
mediaPlayer.release();
}
catch (IOException e)
{
return false;
}
return true;
}