<commit_before>package info.guardianproject.notepadbot;


import net.simonvt.numberpicker.NumberPicker;
import info.guardianproject.cacheword.CacheWordActivityHandler;
import info.guardianproject.cacheword.Constants;
import info.guardianproject.cacheword.ICacheWordSubscriber;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.v4.app.NavUtils;
import android.util.Log;

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

@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public class Settings extends SherlockPreferenceActivity implements ICacheWordSubscriber {
	
	public static final String LANG_SEL_KEY = "langSelected";
	
	private CacheWordActivityHandler mCacheWord;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		
		mCacheWord = new CacheWordActivityHandler(this, ((App)getApplication()).getCWSettings());
		
		// If in android 3+ use a preference fragment which is the new recommended way
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			getFragmentManager().beginTransaction()
					.replace(android.R.id.content, new PreferenceFragment() {
						@Override
						public void onCreate(final Bundle savedInstanceState) {
							super.onCreate(savedInstanceState);
							addPreferencesFromResource(R.xml.settings);
							findPreference(Constants.SHARED_PREFS_TIMEOUT)
								.setOnPreferenceClickListener(changeLockTimeoutListener);
							findPreference(Constants.SHARED_PREFS_VIBRATE)
								.setOnPreferenceChangeListener(vibrateChangeListener);
						}
					})
					.commit();
		} else {
			// Otherwise load the preferences.xml in the Activity like in previous android versions
			addPreferencesFromResource(R.xml.settings);
			findPreference(Constants.SHARED_PREFS_TIMEOUT)
				.setOnPreferenceClickListener(changeLockTimeoutListener);
			findPreference(Constants.SHARED_PREFS_VIBRATE)
				.setOnPreferenceChangeListener(vibrateChangeListener);
		}
	}
	
	
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			NavUtils.navigateUpFromSameTask(this);
			return true;
		}<commit_msg>fix home button in settings not working on old android versions<commit_after>package info.guardianproject.notepadbot;


import net.simonvt.numberpicker.NumberPicker;
import info.guardianproject.cacheword.CacheWordActivityHandler;
import info.guardianproject.cacheword.Constants;
import info.guardianproject.cacheword.ICacheWordSubscriber;

import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.v4.app.NavUtils;
import android.util.Log;

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

@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public class Settings extends SherlockPreferenceActivity implements ICacheWordSubscriber {
	
	public static final String LANG_SEL_KEY = "langSelected";
	
	private CacheWordActivityHandler mCacheWord;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		
		mCacheWord = new CacheWordActivityHandler(this, ((App)getApplication()).getCWSettings());
		
		// If in android 3+ use a preference fragment which is the new recommended way
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
			getFragmentManager().beginTransaction()
					.replace(android.R.id.content, new PreferenceFragment() {
						@Override
						public void onCreate(final Bundle savedInstanceState) {
							super.onCreate(savedInstanceState);
							addPreferencesFromResource(R.xml.settings);
							findPreference(Constants.SHARED_PREFS_TIMEOUT)
								.setOnPreferenceClickListener(changeLockTimeoutListener);
							findPreference(Constants.SHARED_PREFS_VIBRATE)
								.setOnPreferenceChangeListener(vibrateChangeListener);
						}
					})
					.commit();
		} else {
			// Otherwise load the preferences.xml in the Activity like in previous android versions
			addPreferencesFromResource(R.xml.settings);
			findPreference(Constants.SHARED_PREFS_TIMEOUT)
				.setOnPreferenceClickListener(changeLockTimeoutListener);
			findPreference(Constants.SHARED_PREFS_VIBRATE)
				.setOnPreferenceChangeListener(vibrateChangeListener);
		}
	}
	
	
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			NavUtils.navigateUpTo(this, new Intent(this, NoteCipher.class));
			return true;
		}
{'fraction_non_alphanumeric': 0.08339524517087667, 'fraction_numerical': 0.0007429420505200594, 'mean_word_length': 5.739674593241552, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, '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': '1786200', 'n_tokens_mistral': 1722, 'n_tokens_neox': 1494, 'n_words': 279}