]> gitweb.fperrin.net Git - Dictionary.git/blob - src/com/hughes/android/dictionary/PreferenceActivity.java
Auto-format everything.
[Dictionary.git] / src / com / hughes / android / dictionary / PreferenceActivity.java
1 // Copyright 2011 Google Inc. All Rights Reserved.
2 //
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
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
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.
14
15 package com.hughes.android.dictionary;
16
17 import java.util.List;
18
19 import android.os.Bundle;
20 import android.preference.ListPreference;
21
22 public class PreferenceActivity extends android.preference.PreferenceActivity {
23
24     static boolean prefsMightHaveChanged = false;
25
26     @SuppressWarnings("deprecation")
27     @Override
28     public void onCreate(Bundle savedInstanceState) {
29         setTheme(((DictionaryApplication) getApplication()).getSelectedTheme().themeId);
30
31         /**
32          * @author Dominik Köppl Preference: select default dictionary As this
33          *         list is dynamically generated, we have to do it in this
34          *         fashion
35          */
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);
42
43         final CharSequence[] entries = new CharSequence[dicts.size()];
44         final CharSequence[] entryvalues = new CharSequence[dicts.size()];
45
46         for (int i = 0; i < entries.length; ++i)
47         {
48             entries[i] = dicts.get(i).dictInfo;
49             entryvalues[i] = dicts.get(i).uncompressedFilename;
50         }
51
52         defaultDic.setEntries(entries);
53         defaultDic.setEntryValues(entryvalues);
54     }
55
56     @Override
57     public void onContentChanged() {
58         super.onContentChanged();
59     }
60 }