<commit_before>package net.sharermax.m_news.fragment;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.SwitchPreference;
import android.widget.Toast;

import net.sharermax.m_news.R;
import net.sharermax.m_news.activity.SettingsActivity;
import net.sharermax.m_news.support.Setting;
import net.sharermax.m_news.support.Utility;

/**
 * Author: SharerMax
 * Time  : 2015/3/22
 * E-Mail: <EMAIL>
 */
public class SettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener {

    private SwitchPreference mAutoRefreshPreference;
    private SwitchPreference mSwipeBackPreference;
    private Preference mWeiboPreference;
    private Preference mTwitterPreference;
    private Preference mGithubPreference;
    private Preference mLicensePreference;
    private Preference mVersionPreference;

    public static SettingsFragment newInstance() {
        return new SettingsFragment();
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.prefer_main);
        mAutoRefreshPreference = (SwitchPreference)findPreference(Setting.KEY_USE_CARD_VIEW);
        mSwipeBackPreference = (SwitchPreference)findPreference(Setting.KEY_SWIPE_BACK);
        mWeiboPreference = findPreference(Setting.KEY_WEIBO);
        mTwitterPreference = findPreference(Setting.KEY_TWITTER);
        mGithubPreference = findPreference(Setting.KEY_GITHUB);
        mLicensePreference = findPreference(Setting.KEY_LICENSE);
        mVersionPreference = findPreference(Setting.KEY_VERSION);
        mVersionPreference.setSummary(Utility.getVersionInfo(getActivity()));
        mAutoRefreshPreference.setOnPreferenceClickListener(this);
        mSwipeBackPreference.setOnPreferenceClickListener(this);
        mWeiboPreference.setOnPreferenceClickListener(this);
        mTwitterPreference.setOnPreferenceClickListener(this);
        mGithubPreference.setOnPreferenceClickListener(this);
        mLicensePreference.setOnPreferenceClickListener(this);
//        mVersionPreference.setOnPreferenceClickListener(this);
    }

    @Override
    public boolean onPreferenceClick(Preference preference) {
        if (preference == mAutoRefreshPreference
                || preference == mSwipeBackPreference) {
            Toast.makeText(getActivity(), getString(R.string.toast_you_need_restart), Toast.LENGTH_LONG).show();
            return true;
        }

        if (preference == mWeiboPreference) {
            openWebSite(getString(R.string.author_Weibo_url));
            return true;
        }

        if (preference == mGithubPreference) {
            openWebSite(getString(R.string.github_url));
            return true;
        }

        if (preference == mLicensePreference) {
            SettingsActivity.launcherActivity(getActivity(), SettingsActivity.FLAG_LICENSE);
            return true;
        }

        return false;
    }

    private void openWebSite(String url) {
        Uri uri = Uri.parse(url);
        startActivity(new Intent(Intent.ACTION_VIEW, uri));
    }
}<commit_msg>bringup<commit_after>package net.sharermax.m_news.fragment;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.SwitchPreference;
import android.widget.Toast;

import net.sharermax.m_news.R;
import net.sharermax.m_news.activity.SettingsActivity;
import net.sharermax.m_news.support.Setting;
import net.sharermax.m_news.support.Utility;

/**
 * Author: SharerMax
 * Time  : 2015/3/22
 * E-Mail: <EMAIL>
 */
public class SettingsFragment extends PreferenceFragment implements Preference.OnPreferenceClickListener {

    private SwitchPreference mAutoRefreshPreference;
    private SwitchPreference mSwipeBackPreference;
    private Preference mWeiboPreference;
    private Preference mTwitterPreference;
    private Preference mGithubPreference;
    private Preference mLicensePreference;
    private Preference mVersionPreference;

    public static SettingsFragment newInstance() {
        return new SettingsFragment();
    }
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addPreferencesFromResource(R.xml.prefer_main);
        mAutoRefreshPreference = (SwitchPreference)findPreference(Setting.KEY_USE_CARD_VIEW);
        mSwipeBackPreference = (SwitchPreference)findPreference(Setting.KEY_SWIPE_BACK);
        mWeiboPreference = findPreference(Setting.KEY_WEIBO);
        mTwitterPreference = findPreference(Setting.KEY_TWITTER);
        mGithubPreference = findPreference(Setting.KEY_GITHUB);
        mLicensePreference = findPreference(Setting.KEY_LICENSE);
        mVersionPreference = findPreference(Setting.KEY_VERSION);
        mVersionPreference.setSummary(Utility.getVersionInfo(getActivity()));
        mAutoRefreshPreference.setOnPreferenceClickListener(this);
        mSwipeBackPreference.setOnPreferenceClickListener(this);
        mWeiboPreference.setOnPreferenceClickListener(this);
        mTwitterPreference.setOnPreferenceClickListener(this);
        mGithubPreference.setOnPreferenceClickListener(this);
        mLicensePreference.setOnPreferenceClickListener(this);
//        mVersionPreference.setOnPreferenceClickListener(this);
    }

    @Override
    public boolean onPreferenceClick(Preference preference) {
        if (preference == mAutoRefreshPreference
                || preference == mSwipeBackPreference) {
            Toast.makeText(getActivity(), getString(R.string.toast_you_need_restart), Toast.LENGTH_LONG).show();
            return true;
        }

        if (preference == mWeiboPreference) {
            openWebSite(getString(R.string.author_Weibo_url));
            return true;
        }

        if(preference == mTwitterPreference) {
            openWebSite(getString(R.string.author_Twitter_url));
            return true;
        }

        if (preference == mGithubPreference) {
            openWebSite(getString(R.string.github_url));
            return true;
        }

        if (preference == mLicensePreference) {
            SettingsActivity.launcherActivity(getActivity(), SettingsActivity.FLAG_LICENSE);
            return true;
        }

        return false;
    }

    private void openWebSite(String url) {
        Uri uri = Uri.parse(url);
        startActivity(new Intent(Intent.ACTION_VIEW, uri));
    }
}
{'fraction_non_alphanumeric': 0.08174962292609352, 'fraction_numerical': 0.0021116138763197585, 'mean_word_length': 3.7162162162162162, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '4627968', 'n_tokens_mistral': 1873, 'n_tokens_neox': 1799, 'n_words': 285}