@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
- final DictionaryApplication application = (DictionaryApplication) getApplication();
+ DictionaryApplication.INSTANCE.init(getApplicationContext());
+ final DictionaryApplication application = DictionaryApplication.INSTANCE;
setTheme(application.getSelectedTheme().themeId);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.edit().putString(getString(R.string.wordListFileKey), application.getWordListFile().getAbsolutePath()).commit();
}
- /**
- * @author Dominik Köppl Preference: select default dictionary As this
+ /*
+ @author Dominik Köppl Preference: select default dictionary As this
* list is dynamically generated, we have to do it in this
* fashion
*/
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
ListPreference defaultDic = (ListPreference) findPreference(getResources().getString(
- R.string.defaultDicKey));
+ R.string.defaultDicKey));
List<DictionaryInfo> dicts = application.getDictionariesOnDevice(null);
final CharSequence[] entries = new CharSequence[dicts.size()];
final CharSequence[] entryvalues = new CharSequence[dicts.size()];
- for (int i = 0; i < entries.length; ++i)
- {
+ for (int i = 0; i < entries.length; ++i) {
entries[i] = dicts.get(i).dictInfo;
entryvalues[i] = dicts.get(i).uncompressedFilename;
}
prefs.registerOnSharedPreferenceChangeListener(this);
}
- @Override
- public void onContentChanged() {
- super.onContentChanged();
- }
-
@Override
public void onSharedPreferenceChanged(SharedPreferences p, String v) {
- final DictionaryApplication application = (DictionaryApplication)getApplication();
+ DictionaryApplication.INSTANCE.init(getApplicationContext());
+ final DictionaryApplication application = DictionaryApplication.INSTANCE;
File dictDir = application.getDictDir();
if (!dictDir.isDirectory() || !dictDir.canWrite() ||
- !application.checkFileCreate(dictDir)) {
+ !DictionaryApplication.checkFileCreate(dictDir)) {
String dirs = "";
String externalDir = Environment.getExternalStorageDirectory().getAbsolutePath();
if (new File(externalDir).canWrite())
if (fd.canWrite())
dirs += "\n" + fd.getAbsolutePath();
new AlertDialog.Builder(this).setTitle(getString(R.string.error))
- .setMessage(getString(R.string.chosenNotWritable) + dirs)
- .setNeutralButton("Close", null).show();
+ .setMessage(getString(R.string.chosenNotWritable) + dirs)
+ .setNeutralButton("Close", null).show();
}
}
}