1 // Copyright 2011 Google Inc. All Rights Reserved.
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 package com.hughes.android.dictionary;
17 import java.util.List;
19 import android.os.Bundle;
20 import android.preference.ListPreference;
22 public class PreferenceActivity extends android.preference.PreferenceActivity {
24 static boolean prefsMightHaveChanged = false;
26 @SuppressWarnings("deprecation")
28 public void onCreate(Bundle savedInstanceState) {
29 setTheme(((DictionaryApplication)getApplication()).getSelectedTheme().themeId);
32 * @author Dominik Köppl
33 * Preference: select default dictionary
34 * As this list is dynamically generated, we have to do it in this fashion
36 super.onCreate(savedInstanceState);
37 addPreferencesFromResource(R.xml.preferences);
38 ListPreference defaultDic = (ListPreference) findPreference(getResources().getString(R.string.defaultDicKey));
39 DictionaryApplication application = (DictionaryApplication) getApplication();
40 List<DictionaryInfo> dicts = application.getDictionariesOnDevice();
42 final CharSequence[] entries = new CharSequence[dicts.size()];
43 final CharSequence[] entryvalues = new CharSequence[dicts.size()];
45 for(int i = 0; i < entries.length; ++i)
47 entries[i] = dicts.get(i).dictInfo;
48 entryvalues[i] = dicts.get(i).uncompressedFilename;
51 defaultDic.setEntries(entries);
52 defaultDic.setEntryValues(entryvalues);
56 public void onContentChanged() {
57 super.onContentChanged();