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 Preference: select default dictionary As this
33 * list is dynamically generated, we have to do it in this
36 super.onCreate(savedInstanceState);
37 addPreferencesFromResource(R.xml.preferences);
38 ListPreference defaultDic = (ListPreference) findPreference(getResources().getString(
39 R.string.defaultDicKey));
40 DictionaryApplication application = (DictionaryApplication) getApplication();
41 List<DictionaryInfo> dicts = application.getDictionariesOnDevice(null);
43 final CharSequence[] entries = new CharSequence[dicts.size()];
44 final CharSequence[] entryvalues = new CharSequence[dicts.size()];
46 for (int i = 0; i < entries.length; ++i)
48 entries[i] = dicts.get(i).dictInfo;
49 entryvalues[i] = dicts.get(i).uncompressedFilename;
52 defaultDic.setEntries(entries);
53 defaultDic.setEntryValues(entryvalues);
57 public void onContentChanged() {
58 super.onContentChanged();