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


Java MailTo.parse方法代码示例

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


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

示例1: shouldOverrideUrlLoading

import android.net.MailTo; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.startsWith("mailto:")) {
        final Activity activity = mActivityRef.get();
        if (activity != null) {
            MailTo mt = MailTo.parse(url);
            Intent i = newEmailIntent(activity, mt.getTo(), mt.getSubject(), mt.getBody(), mt.getCc());
            activity.startActivity(i);
            view.reload();
            return true;
        }
    } else {
        view.loadUrl(url);
    }
    return true;
}
 
开发者ID:google,项目名称:watchpresenter,代码行数:17,代码来源:MailtoWebView.java

示例2: shouldOverrideUrlLoading

import android.net.MailTo; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
  if (url.startsWith("file")) {
    // Keep local assets in this WebView.
    return false;
  } else if (url.startsWith("mailto:")) {
    try {
          MailTo mt = MailTo.parse(url);
          Intent i = new Intent(Intent.ACTION_SEND);
          i.setType("message/rfc822");
          i.putExtra(Intent.EXTRA_EMAIL, new String[]{mt.getTo()});
          i.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
          context.startActivity(i);
          view.reload();
    }
    catch (ActivityNotFoundException e) {
      Log.w(TAG, "Problem with Intent.ACTION_SEND", e);
              new AlertDialog.Builder(context)
                .setTitle("Contact Info")
                .setMessage( "Please send your feedback to: [email protected]" )
                .setPositiveButton( "Done", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        Log.d("AlertDialog", "Positive");
                    }
                })
                .show();
    }
        return true;
  } else {
    // Open external URLs in Browser.
    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
    return true;
  }
}
 
开发者ID:mercuriete,项目名称:android-mrz-reader,代码行数:35,代码来源:HelpActivity.java

示例3: shouldOverrideUrlLoading

import android.net.MailTo; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.startsWith("file")) {
        // Keep local assets in this WebView.
        return false;
    } else if (url.startsWith("mailto:")) {
        try {
            MailTo mt = MailTo.parse(url);
            Intent i = new Intent(Intent.ACTION_SEND);
            i.setType("message/rfc822");
            i.putExtra(Intent.EXTRA_EMAIL, new String[]{mt.getTo()});
            i.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
            context.startActivity(i);
            view.reload();
        } catch (ActivityNotFoundException e) {
            Log.w(TAG, "Problem with Intent.ACTION_SEND", e);
            new AlertDialog.Builder(context)
                    .setTitle("Contact Info")
                    .setMessage("Please send your feedback to: [email protected]")
                    .setPositiveButton("Done", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            Log.d("AlertDialog", "Positive");
                        }
                    })
                    .show();
        }
        return true;
    } else {
        // Open external URLs in Browser.
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
        return true;
    }
}
 
开发者ID:hujiaweibujidao,项目名称:android-ocr-demo,代码行数:34,代码来源:HelpActivity.java

示例4: shouldOverrideUrlLoading

import android.net.MailTo; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    // Check if configured proxy is available
    if (mBrowserController.proxyIsNotReady()) {
        // User has been notified
        return true;
    }

    if (mIsIncognitoTab) {
        return super.shouldOverrideUrlLoading(view, url);
    }
    if (url.startsWith("about:")) {
        return super.shouldOverrideUrlLoading(view, url);
    }
    if (url.contains("mailto:")) {
        MailTo mailTo = MailTo.parse(url);
        Intent i = Utils.newEmailIntent(mailTo.getTo(), mailTo.getSubject(),
                mailTo.getBody(), mailTo.getCc());
        mActivity.startActivity(i);
        view.reload();
        return true;
    } else if (url.startsWith("intent://")) {
        Intent intent;
        try {
            intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
        } catch (URISyntaxException ex) {
            return false;
        }
        if (intent != null) {
            try {
                mActivity.startActivity(intent);
            } catch (ActivityNotFoundException e) {
                Log.e(Constants.TAG, "ActivityNotFoundException");
            }
            return true;
        }
    }
    return mIntentUtils.startActivityForUrl(mWebView, url);
}
 
开发者ID:javadtaghia,项目名称:DeeBrowser,代码行数:40,代码来源:LightningView.java

示例5: showMailDialg

import android.net.MailTo; //导入方法依赖的package包/类
public static void showMailDialg(Context context, String url) {
    MailTo mt = MailTo.parse(url);
    Intent i = new Intent(Intent.ACTION_SEND);
    i.setType("text/plain");
    i.putExtra(Intent.EXTRA_EMAIL, new String[] { mt.getTo() });
    i.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
    i.putExtra(Intent.EXTRA_CC, mt.getCc());
    i.putExtra(Intent.EXTRA_TEXT, mt.getBody());
    context.startActivity(i);
}
 
开发者ID:tonyhe109,项目名称:LifeManager,代码行数:11,代码来源:Util.java

示例6: shouldOverrideUrlLoading

import android.net.MailTo; //导入方法依赖的package包/类
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    if (url.startsWith("file")) {
        if (url.contains("{html-lang}")) {
            String page = url.substring(url.lastIndexOf('/') + 1);
            view.loadUrl(BASE_HELP_URL + page);
            return true;
        }
        return false;
    } else if (url.startsWith("mailto:")) {
        try {
            MailTo mt = MailTo.parse(url);
            Intent i = new Intent(Intent.ACTION_SEND);
            i.setType("message/rfc822");
            i.putExtra(Intent.EXTRA_EMAIL, new String[]{mt.getTo()});
            i.putExtra(Intent.EXTRA_SUBJECT, mt.getSubject());
            i.putExtra(Intent.EXTRA_TEXT, mt.getBody());
            context.startActivity(i);
            view.reload();
        } catch (ActivityNotFoundException e) {
            Log.w(TAG, "Problem with Intent.ACTION_SEND", e);
            new AlertDialog.Builder(context).setTitle("Contact Info")
                    .setMessage("Please send your feedback to: [email protected]")
                    .setPositiveButton("Done", new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            Log.d("AlertDialog", "Positive");
                        }
                    })
                    .show();
        }
        return true;
    } else {
        // Open external URLs in Browser.
        startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
        return true;
    }
}
 
开发者ID:luklanis,项目名称:esr-scanner,代码行数:38,代码来源:HelpActivity.java

示例7: shouldOverrideUrlLoading

import android.net.MailTo; //导入方法依赖的package包/类
@Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            logger.d("webLoading:shouldOverrideUrlLoading");

            // Check if configured proxy is available
//            if (!mBrowserController.isProxyReady()) {
//                // User has been notified
//                return true;
//            }

//            if (mBrowserController.isIncognito()) {
//                return super.shouldOverrideUrlLoading(view, url);
//            }
            if (url.startsWith("about:")) {
                return super.shouldOverrideUrlLoading(view, url);
            }
            if (url.contains("mailto:")) {
                MailTo mailTo = MailTo.parse(url);
                Intent i = XmWebUtils.newEmailIntent(mailTo.getTo(), mailTo.getSubject(),
                        mailTo.getBody(), mailTo.getCc());
                mContext.startActivity(i);
                view.reload();
                return true;
            } else if (url.startsWith("intent://")) {
                Intent intent;
                try {
                    intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
                } catch (URISyntaxException ex) {
                    return false;
                }
                if (intent != null) {
                    try {
                        mContext.startActivity(intent);
                    } catch (ActivityNotFoundException e) {
                        logger.e("ActivityNotFoundException");
                    }
                    return true;
                }
            }
            return mIntentUtils.startActivityForUrl(XmWebView.this, url);

        }
 
开发者ID:liftting,项目名称:android-mine-core,代码行数:43,代码来源:XmWebView.java


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