<commit_before>package com.pilot51.voicenotify;

import java.util.Timer;
import java.util.TimerTask;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.widget.TimePicker;
import android.widget.Toast;

public class MainActivity extends PreferenceActivity implements OnPreferenceClickListener, OnSharedPreferenceChangeListener {
	private Common common;
	private Preference pScreen, pQuietStart, pQuietEnd, pTest, pSupport;
	private static final int DLG_SCREEN = 0, DLG_QUIET_START = 1, DLG_QUIET_END = 2, DLG_SUPPORT = 3;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		common = new Common(this);
		addPreferencesFromResource(R.xml.preferences);
		pScreen = findPreference("screen");
		pScreen.setOnPreferenceClickListener(this);
		pQuietStart = findPreference("quietStart");
		pQuietStart.setOnPreferenceClickListener(this);
		pQuietEnd = findPreference("quietEnd");
		pQuietEnd.setOnPreferenceClickListener(this);
		pTest = findPreference("test");
		pTest.setOnPreferenceClickListener(this);
		pSupport = findPreference("support");
		pSupport.setOnPreferenceClickListener(this);
		findPreference("appList").setIntent(new Intent(this, AppList.class));
		Preference pAccess = findPreference("accessibility"),
			pTTS = findPreference("ttsSettings");
		int sdkVer = android.os.Build.VERSION.SDK_INT;
		if (sdkVer > 4)
			pAccess.setIntent(new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS));
		else if (sdkVer == 4) {
			Intent intent = new Intent(Intent.ACTION_MAIN);
			intent.setClassName("com.android.settings", "com.android.settings.AccessibilitySettings");
			pAccess.setIntent(intent);
		}
		Intent intent = new Intent(Intent.ACTION_MAIN);
		intent.setClassName("com.android.settings", "com.android.settings.TextToSpeechSettings");
		if (!isCallable(intent))
			intent.setClassName("com.google.tv.settings", "com.google.tv.settings.TextToSpeechSettingsTop");
		if (isCallable(intent))
			pTTS.setIntent(intent);
		else {
			pTTS.setEnabled(false);
			pTTS.setSummary(R.string.tts_settings_summary_fail);
		}
	}
	
	private boolean isCallable(Intent intent) {
		return getPackageManager().resolveActivity(intent,
			PackageManager.MATCH_DEFAULT_ONLY) != null;
	}
	
	@Override
	public boolean onPreferenceClick(Preference preference) {
		if (preference == pScreen) {
			showDialog(DLG_SCREEN);
			return true;
		} else if (preference == pQuietStart) {
			showDialog(DLG_QUIET_START);
			return true;<commit_msg>Fix/enable TTS Settings for ICS.<commit_after>package com.pilot51.voicenotify;

import java.util.Timer;
import java.util.TimerTask;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.TimePickerDialog;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceClickListener;
import android.preference.PreferenceActivity;
import android.widget.TimePicker;
import android.widget.Toast;

public class MainActivity extends PreferenceActivity implements OnPreferenceClickListener, OnSharedPreferenceChangeListener {
	private Common common;
	private Preference pScreen, pQuietStart, pQuietEnd, pTest, pSupport;
	private static final int DLG_SCREEN = 0, DLG_QUIET_START = 1, DLG_QUIET_END = 2, DLG_SUPPORT = 3;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		common = new Common(this);
		addPreferencesFromResource(R.xml.preferences);
		pScreen = findPreference("screen");
		pScreen.setOnPreferenceClickListener(this);
		pQuietStart = findPreference("quietStart");
		pQuietStart.setOnPreferenceClickListener(this);
		pQuietEnd = findPreference("quietEnd");
		pQuietEnd.setOnPreferenceClickListener(this);
		pTest = findPreference("test");
		pTest.setOnPreferenceClickListener(this);
		pSupport = findPreference("support");
		pSupport.setOnPreferenceClickListener(this);
		findPreference("appList").setIntent(new Intent(this, AppList.class));
		Preference pAccess = findPreference("accessibility"),
			pTTS = findPreference("ttsSettings");
		int sdkVer = android.os.Build.VERSION.SDK_INT;
		if (sdkVer > 4)
			pAccess.setIntent(new Intent(android.provider.Settings.ACTION_ACCESSIBILITY_SETTINGS));
		else if (sdkVer == 4) {
			Intent intent = new Intent(Intent.ACTION_MAIN);
			intent.setClassName("com.android.settings", "com.android.settings.AccessibilitySettings");
			pAccess.setIntent(intent);
		}
		Intent intent = new Intent(Intent.ACTION_MAIN);
		intent.setClassName("com.android.settings", "com.android.settings.TextToSpeechSettings");
		if (!isCallable(intent))
			intent.setClassName("com.android.settings", "com.android.settings.Settings$TextToSpeechSettingsActivity");
		if (!isCallable(intent))
			intent.setClassName("com.google.tv.settings", "com.google.tv.settings.TextToSpeechSettingsTop");
		if (isCallable(intent))
			pTTS.setIntent(intent);
		else {
			pTTS.setEnabled(false);
			pTTS.setSummary(R.string.tts_settings_summary_fail);
		}
	}
	
	private boolean isCallable(Intent intent) {
		return getPackageManager().resolveActivity(intent,
			PackageManager.MATCH_DEFAULT_ONLY) != null;
	}
	
	@Override
	public boolean onPreferenceClick(Preference preference) {
		if (preference == pScreen) {
			showDialog(DLG_SCREEN);
			return true;
		} else if (preference == pQuietStart) {
			showDialog(DLG_QUIET_START);
			return true;
{'fraction_non_alphanumeric': 0.10419235511713934, 'fraction_numerical': 0.002466091245376079, 'mean_word_length': 6.598360655737705, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2546', 'n_tokens_mistral': 2083, 'n_tokens_neox': 1930, 'n_words': 347}