<commit_before>package com.zfdang.zsmth_android.helpers;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.widget.Toast;

import com.klinker.android.link_builder.Link;
import com.zfdang.SMTHApplication;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zfdang on 2016-5-14.
 */
public class ActivityUtils {
    private static final String TAG = "ActivityUtils";

    public static void openLink(String link, Activity activity) {
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(link));
        try {
            activity.startActivity(browserIntent);
        } catch(ActivityNotFoundException e) {
            Toast.makeText(activity, "链接打开错误:" + e.toString(), Toast.LENGTH_LONG).show();
        }
    }

    public static void sendEmail(String link, Activity activity) {
        /* Create the Intent */
        final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

        /* Fill it with Data */
        emailIntent.setType("plain/text");
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{link});
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, " \n \n \n \n--\n来自zSMTH的邮件\n");<commit_msg>add http to link if there is no available scheme<commit_after>package com.zfdang.zsmth_android.helpers;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.widget.Toast;

import com.klinker.android.link_builder.Link;
import com.zfdang.SMTHApplication;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by zfdang on 2016-5-14.
 */
public class ActivityUtils {
    private static final String TAG = "ActivityUtils";

    public static void openLink(String link, Activity activity) {
        Uri uri = Uri.parse(link);
        if(uri.getScheme() == null) {
            uri = Uri.parse("http://" + link);
        }
        Intent browserIntent = new Intent(Intent.ACTION_VIEW, uri);
        try {
            activity.startActivity(browserIntent);
        } catch(ActivityNotFoundException e) {
            Toast.makeText(activity, "链接打开错误:" + e.toString(), Toast.LENGTH_LONG).show();
        }
    }

    public static void sendEmail(String link, Activity activity) {
        /* Create the Intent */
        final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);

        /* Fill it with Data */
        emailIntent.setType("plain/text");
        emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{link});
        emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "");
        emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, " \n \n \n \n--\n来自zSMTH的邮件\n");
{'fraction_non_alphanumeric': 0.1151219512195122, 'fraction_numerical': 0.0045528455284552845, 'mean_word_length': 3.4195402298850577, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1373856', 'n_tokens_mistral': 917, 'n_tokens_neox': 908, 'n_words': 194}