diff --git a/assets/resources/application/cs.xml b/assets/resources/application/cs.xml index f2fdba0ff..6fc51fb6c 100644 --- a/assets/resources/application/cs.xml +++ b/assets/resources/application/cs.xml @@ -480,6 +480,7 @@ + diff --git a/assets/resources/application/de.xml b/assets/resources/application/de.xml index 4e4169a6f..ec5a97ace 100644 --- a/assets/resources/application/de.xml +++ b/assets/resources/application/de.xml @@ -481,6 +481,7 @@ + diff --git a/assets/resources/application/en.xml b/assets/resources/application/en.xml index 114927f62..00b1e0d61 100644 --- a/assets/resources/application/en.xml +++ b/assets/resources/application/en.xml @@ -479,6 +479,7 @@ + diff --git a/assets/resources/application/fr.xml b/assets/resources/application/fr.xml index 0d8bbf214..fcc300b7d 100644 --- a/assets/resources/application/fr.xml +++ b/assets/resources/application/fr.xml @@ -483,6 +483,7 @@ + diff --git a/assets/resources/application/hu.xml b/assets/resources/application/hu.xml index 7c9af7f2b..5f21c8fc6 100644 --- a/assets/resources/application/hu.xml +++ b/assets/resources/application/hu.xml @@ -480,6 +480,7 @@ + diff --git a/assets/resources/application/it.xml b/assets/resources/application/it.xml index 274202d91..514aa6bad 100644 --- a/assets/resources/application/it.xml +++ b/assets/resources/application/it.xml @@ -480,6 +480,7 @@ + diff --git a/assets/resources/application/ru.xml b/assets/resources/application/ru.xml index 6a120b932..43c27a53c 100644 --- a/assets/resources/application/ru.xml +++ b/assets/resources/application/ru.xml @@ -487,6 +487,7 @@ + diff --git a/assets/resources/application/uk.xml b/assets/resources/application/uk.xml index 2ea60e97e..8968704a3 100644 --- a/assets/resources/application/uk.xml +++ b/assets/resources/application/uk.xml @@ -480,6 +480,7 @@ + diff --git a/assets/resources/application/vi.xml b/assets/resources/application/vi.xml index a856a896b..cfe23aa49 100644 --- a/assets/resources/application/vi.xml +++ b/assets/resources/application/vi.xml @@ -480,6 +480,7 @@ + diff --git a/assets/resources/application/zh.xml b/assets/resources/application/zh.xml index 4586892fe..eaca21e0f 100644 --- a/assets/resources/application/zh.xml +++ b/assets/resources/application/zh.xml @@ -480,6 +480,7 @@ + diff --git a/src/org/geometerplus/android/fbreader/DictionaryUtil.java b/src/org/geometerplus/android/fbreader/DictionaryUtil.java index 9bfeb5cbe..6d468450f 100644 --- a/src/org/geometerplus/android/fbreader/DictionaryUtil.java +++ b/src/org/geometerplus/android/fbreader/DictionaryUtil.java @@ -34,19 +34,7 @@ import org.geometerplus.zlibrary.core.resources.ZLResource; import org.geometerplus.android.util.UIUtil; import org.geometerplus.android.util.PackageUtil; -class PackageInfo { - public final String PackageName; - public final String ClassName; - public final String Title; - - PackageInfo(String packageName, String className, String title) { - PackageName = packageName; - ClassName = className; - Title = title; - } -} - -abstract class DictionaryUtil { +public abstract class DictionaryUtil { private static LinkedList ourDictionaryInfos = new LinkedList(); private static ZLStringOption ourDictionaryOption; diff --git a/src/org/geometerplus/android/fbreader/PackageInfo.java b/src/org/geometerplus/android/fbreader/PackageInfo.java new file mode 100644 index 000000000..d1cd0fab9 --- /dev/null +++ b/src/org/geometerplus/android/fbreader/PackageInfo.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010-2011 Geometer Plus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +package org.geometerplus.android.fbreader; + +public class PackageInfo { + public final String PackageName; + public final String ClassName; + public final String Title; + + PackageInfo(String packageName, String className, String title) { + PackageName = packageName; + ClassName = className; + Title = title; + } +} diff --git a/src/org/geometerplus/android/fbreader/preferences/DictionaryPreference.java b/src/org/geometerplus/android/fbreader/preferences/DictionaryPreference.java new file mode 100644 index 000000000..369f65f62 --- /dev/null +++ b/src/org/geometerplus/android/fbreader/preferences/DictionaryPreference.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009-2011 Geometer Plus + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +package org.geometerplus.android.fbreader.preferences; + +import java.util.List; + +import android.content.Context; + +import org.geometerplus.zlibrary.core.options.ZLStringOption; +import org.geometerplus.zlibrary.core.resources.ZLResource; + +import org.geometerplus.android.fbreader.DictionaryUtil; +import org.geometerplus.android.fbreader.PackageInfo; + +class DictionaryPreference extends ZLStringListPreference { + private final ZLStringOption myOption; + + DictionaryPreference(Context context, ZLResource resource, String resourceKey) { + super(context, resource, resourceKey); + + myOption = DictionaryUtil.dictionaryOption(); + final List infos = DictionaryUtil.dictionaryInfos(); + + final String[] values = new String[infos.size()]; + final String[] texts = new String[infos.size()]; + int index = 0; + for (PackageInfo i : infos) { + values[index] = i.ClassName; + texts[index] = i.Title; + ++index; + } + setLists(values, texts); + + setInitialValue(myOption.getValue()); + } + + public void onAccept() { + myOption.setValue(getValue()); + } +} diff --git a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java index 3fbd1fa5c..be9182991 100644 --- a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java +++ b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java @@ -334,6 +334,11 @@ public class PreferenceActivity extends ZLPreferenceActivity { scrollingScreen.addOption(scrollingPreferences.HorizontalOption, "horizontal"); final Screen dictionaryScreen = createPreferenceScreen("dictionary"); + dictionaryScreen.addPreference(new DictionaryPreference( + this, + dictionaryScreen.Resource, + "dictionary" + )); dictionaryScreen.addPreference(new ZLBooleanPreference( this, fbReader.NavigateAllWordsOption,