]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/QuickDicConfig.java
String changes, focus changes.
[Dictionary.git] / src / com / hughes / android / dictionary / QuickDicConfig.java
index 602fc24c54dcc5da48ed15b2f2d853d25d9b3113..b042d401f6d4174ad13810395bf8af917d6f8458 100644 (file)
@@ -1,14 +1,31 @@
+// Copyright 2011 Google Inc. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package com.hughes.android.dictionary;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
+import com.hughes.android.dictionary.engine.Language;
+
 public final class QuickDicConfig implements Serializable {
   
   private static final long serialVersionUID = 6711617368780900979L;
   
-  static final int LATEST_VERSION = 1;
+  // Just increment this to have them all update...
+  static final int LATEST_VERSION = 3;
   
   final List<DictionaryConfig> dictionaryConfigs = new ArrayList<DictionaryConfig>();
   int currentVersion = LATEST_VERSION;
@@ -16,23 +33,29 @@ public final class QuickDicConfig implements Serializable {
   public QuickDicConfig() {
     addDefaultDictionaries();
   }
+  
+  static final String BASE_URL = "http://quickdic-dictionary.googlecode.com/files/";
 
   public void addDefaultDictionaries() {
     {
-      final DictionaryConfig de_en_chemnitz = new DictionaryConfig();
-      de_en_chemnitz.name = "DE<->EN (Chemnitz)";
-      de_en_chemnitz.downloadUrl = "https://sites.google.com/site/quickdic/dictionaries-1/DE-EN_chemnitz.quickdic.zip?attredirects=0&d=1";
-      de_en_chemnitz.localFile = "/sdcard/quickDic/DE-EN_chemnitz.quickdic";
-      addOrReplace(de_en_chemnitz);
+      final DictionaryConfig config = new DictionaryConfig();
+      config.name = "German<->English";
+      config.downloadUrl = BASE_URL + "DE-EN_chemnitz_enwiktionary.quickdic.zip";
+      config.localFile = "/sdcard/quickDic/DE-EN_chemnitz_enwiktionary.quickdic";
+      addOrReplace(config);
     }
-
-    {
-      final DictionaryConfig en_it_wiktionary = new DictionaryConfig();
-      en_it_wiktionary.name = "EN<->IT (EN Wiktionary)";
-      en_it_wiktionary.downloadUrl = "https://sites.google.com/site/quickdic/dictionaries-1/EN-IT_enwiktionary.quickdic.zip?attredirects=0&d=1";
-      en_it_wiktionary.localFile = "/sdcard/quickDic/EN-IT_enwiktionary.quickdic";
-      addOrReplace(en_it_wiktionary);
+    
+    for (final String iso : Language.isoCodeToWikiName.keySet()) {
+      if (iso.equals("EN") || iso.equals("DE")) {
+        continue;
+      }
+      final DictionaryConfig config = new DictionaryConfig();
+      config.name = String.format("English<->%s", Language.isoCodeToWikiName.get(iso));
+      config.downloadUrl = String.format("%sEN-%s_enwiktionary.quickdic.zip", BASE_URL, iso);
+      config.localFile = String.format("/sdcard/quickDic/EN-%s_enwiktionary.quickdic", iso);
+      addOrReplace(config);
     }
+
   }
 
   private void addOrReplace(final DictionaryConfig dictionaryConfig) {