]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - src/com/hughes/android/dictionary/QuickDicConfig.java
Major refactor of down dictionary list is stored by app.
[Dictionary.git] / src / com / hughes / android / dictionary / QuickDicConfig.java
index 602fc24c54dcc5da48ed15b2f2d853d25d9b3113..e98f0152ba2f721e303b8c3946ea3cc97ded0903 100644 (file)
@@ -1,48 +1,45 @@
+// 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.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.RandomAccessFile;
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import android.content.Context;
+import android.os.Environment;
+import android.util.Log;
+
+import com.hughes.android.dictionary.engine.Dictionary;
+import com.hughes.android.dictionary.engine.Language;
 
 public final class QuickDicConfig implements Serializable {
   
+  private static final String LOG = "QuickDicConfig";
+
   private static final long serialVersionUID = 6711617368780900979L;
   
-  static final int LATEST_VERSION = 1;
   
-  final List<DictionaryConfig> dictionaryConfigs = new ArrayList<DictionaryConfig>();
-  int currentVersion = LATEST_VERSION;
-  
-  public QuickDicConfig() {
-    addDefaultDictionaries();
-  }
-
-  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 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);
-    }
-  }
-
-  private void addOrReplace(final DictionaryConfig dictionaryConfig) {
-    for (int i = 0; i < dictionaryConfigs.size(); ++i) {
-      if (dictionaryConfigs.get(i).name.equals(dictionaryConfig.name)) {
-        dictionaryConfigs.set(i, dictionaryConfig);
-        return;
-      }
-    }
-    dictionaryConfigs.add(dictionaryConfig);
-  }
 
 }