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.io.Serializable;
18 import java.util.ArrayList;
19 import java.util.List;
21 public final class QuickDicConfig implements Serializable {
23 private static final long serialVersionUID = 6711617368780900979L;
25 static final int LATEST_VERSION = 1;
27 final List<DictionaryConfig> dictionaryConfigs = new ArrayList<DictionaryConfig>();
28 int currentVersion = LATEST_VERSION;
30 public QuickDicConfig() {
31 addDefaultDictionaries();
34 public void addDefaultDictionaries() {
36 final DictionaryConfig de_en_chemnitz = new DictionaryConfig();
37 de_en_chemnitz.name = "DE<->EN (Chemnitz)";
38 de_en_chemnitz.downloadUrl = "https://sites.google.com/site/quickdic/dictionaries-1/DE-EN_chemnitz.quickdic.zip?attredirects=0&d=1";
39 de_en_chemnitz.localFile = "/sdcard/quickDic/DE-EN_chemnitz.quickdic";
40 addOrReplace(de_en_chemnitz);
44 final DictionaryConfig en_it_wiktionary = new DictionaryConfig();
45 en_it_wiktionary.name = "EN<->IT (EN Wiktionary)";
46 en_it_wiktionary.downloadUrl = "https://sites.google.com/site/quickdic/dictionaries-1/EN-IT_enwiktionary.quickdic.zip?attredirects=0&d=1";
47 en_it_wiktionary.localFile = "/sdcard/quickDic/EN-IT_enwiktionary.quickdic";
48 addOrReplace(en_it_wiktionary);
52 private void addOrReplace(final DictionaryConfig dictionaryConfig) {
53 for (int i = 0; i < dictionaryConfigs.size(); ++i) {
54 if (dictionaryConfigs.get(i).name.equals(dictionaryConfig.name)) {
55 dictionaryConfigs.set(i, dictionaryConfig);
59 dictionaryConfigs.add(dictionaryConfig);