<commit_before>package com.irccloud.android;

import org.json.JSONException;
import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.MenuItem;

public class PreferencesActivity extends SherlockPreferenceActivity {
	NetworkConnection conn;
	SaveSettingsTask saveSettingsTask = null;
	SavePreferencesTask savePreferencesTask = null;
	int save_prefs_reqid = -1;
	int save_settings_reqid = -1;
	
	@SuppressWarnings("deprecation")
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		conn = NetworkConnection.getInstance();
		getSupportActionBar().setTitle("Settings");
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		addPreferencesFromResource(R.xml.preferences_account);
		addPreferencesFromResource(R.xml.preferences_display);
		addPreferencesFromResource(R.xml.preferences_device);
		addPreferencesFromResource(R.xml.preferences_notifications);
        try {
            getPackageManager().getPackageInfo("com.getpebble.android", 0);
            addPreferencesFromResource(R.xml.preferences_pebble);
        } catch (Exception e) {
        }
        try {
            getPackageManager().getPackageInfo("com.sonyericsson.extras.liveview", 0);
            addPreferencesFromResource(R.xml.preferences_sony);
        } catch (Exception e) {
        }
		addPreferencesFromResource(R.xml.preferences_about);
		findPreference("name").setOnPreferenceChangeListener(settingstoggle);
		if(conn.getUserInfo() != null)
			findPreference("name").setSummary(conn.getUserInfo().name);
		else
			findPreference("name").setSummary(((EditTextPreference)findPreference("name")).getText());
		findPreference("email").setOnPreferenceChangeListener(settingstoggle);
		if(conn.getUserInfo() != null)
			findPreference("email").setSummary(conn.getUserInfo().email);
		else
			findPreference("email").setSummary(((EditTextPreference)findPreference("email")).getText());
		findPreference("highlights").setOnPreferenceChangeListener(settingstoggle);
		if(conn.getUserInfo() != null)
			findPreference("highlights").setSummary(conn.getUserInfo().highlights);
		else
			findPreference("highlights").setSummary(((EditTextPreference)findPreference("highlights")).getText());
		findPreference("autoaway").setOnPreferenceChangeListener(settingstoggle);
		findPreference("time-24hr").setOnPreferenceChangeListener(prefstoggle);
		findPreference("time-seconds").setOnPreferenceChangeListener(prefstoggle);
		findPreference("mode-showsymbol").setOnPreferenceChangeListener(prefstoggle);
		findPreference("faq").setOnPreferenceClickListener(urlClick);
		findPreference("feedback").setOnPreferenceClickListener(urlClick);
		//findPreference("subscriptions").setOnPreferenceClickListener(urlClick);
		//findPreference("changes").setOnPreferenceClickListener(urlClick);
		findPreference("notify_type").setOnPreferenceChangeListener(notificationstoggle);
		switch(Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(this).getString("notify_type", "1"))) {
			case 0:
				findPreference("notify_type").setSummary("Disabled");
				break;<commit_msg>Check for the smartwatch app if the liveview app isn't found<commit_after>package com.irccloud.android;

import org.json.JSONException;
import org.json.JSONObject;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceManager;
import android.util.Log;
import android.widget.Toast;

import com.actionbarsherlock.app.SherlockPreferenceActivity;
import com.actionbarsherlock.view.MenuItem;

public class PreferencesActivity extends SherlockPreferenceActivity {
	NetworkConnection conn;
	SaveSettingsTask saveSettingsTask = null;
	SavePreferencesTask savePreferencesTask = null;
	int save_prefs_reqid = -1;
	int save_settings_reqid = -1;
	
	@SuppressWarnings("deprecation")
	@Override
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		conn = NetworkConnection.getInstance();
		getSupportActionBar().setTitle("Settings");
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		addPreferencesFromResource(R.xml.preferences_account);
		addPreferencesFromResource(R.xml.preferences_display);
		addPreferencesFromResource(R.xml.preferences_device);
		addPreferencesFromResource(R.xml.preferences_notifications);
        try {
            getPackageManager().getPackageInfo("com.getpebble.android", 0);
            addPreferencesFromResource(R.xml.preferences_pebble);
        } catch (Exception e) {
        }
        boolean foundSony=false;
        try {
            getPackageManager().getPackageInfo("com.sonyericsson.extras.liveview", 0);
            addPreferencesFromResource(R.xml.preferences_sony);
            foundSony = true;
        } catch (Exception e) {
        }
        if(!foundSony) {
            try {
                getPackageManager().getPackageInfo("com.sonyericsson.extras.smartwatch", 0);
                addPreferencesFromResource(R.xml.preferences_sony);
                foundSony = true;
            } catch (Exception e) {
            }
        }
		addPreferencesFromResource(R.xml.preferences_about);
		findPreference("name").setOnPreferenceChangeListener(settingstoggle);
		if(conn.getUserInfo() != null)
			findPreference("name").setSummary(conn.getUserInfo().name);
		else
			findPreference("name").setSummary(((EditTextPreference)findPreference("name")).getText());
		findPreference("email").setOnPreferenceChangeListener(settingstoggle);
		if(conn.getUserInfo() != null)
			findPreference("email").setSummary(conn.getUserInfo().email);
		else
			findPreference("email").setSummary(((EditTextPreference)findPreference("email")).getText());
		findPreference("highlights").setOnPreferenceChangeListener(settingstoggle);
		if(conn.getUserInfo() != null)
			findPreference("highlights").setSummary(conn.getUserInfo().highlights);
		else
			findPreference("highlights").setSummary(((EditTextPreference)findPreference("highlights")).getText());
		findPreference("autoaway").setOnPreferenceChangeListener(settingstoggle);
		findPreference("time-24hr").setOnPreferenceChangeListener(prefstoggle);
		findPreference("time-seconds").setOnPreferenceChangeListener(prefstoggle);
		findPreference("mode-showsymbol").setOnPreferenceChangeListener(prefstoggle);
		findPreference("faq").setOnPreferenceClickListener(urlClick);
		findPreference("feedback").setOnPreferenceClickListener(urlClick);
		//findPreference("subscriptions").setOnPreferenceClickListener(urlClick);
		//findPreference("changes").setOnPreferenceClickListener(urlClick);
		findPreference("notify_type").setOnPreferenceChangeListener(notificationstoggle);
		switch(Integer.parseInt(PreferenceManager.getDefaultSharedPreferences(this).getString("notify_type", "1"))) {
			case 0:
				findPreference("notify_type").setSummary("Disabled");
				break;
{'fraction_non_alphanumeric': 0.11551633298208641, 'fraction_numerical': 0.002239199157007376, 'mean_word_length': 6.322082931533269, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 15}, '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': '5994238', 'n_tokens_mistral': 2236, 'n_tokens_neox': 2125, 'n_words': 259}