diff --git a/assets/resources/application/en.xml b/assets/resources/application/en.xml index b61d56ab4..daa279691 100644 --- a/assets/resources/application/en.xml +++ b/assets/resources/application/en.xml @@ -319,7 +319,7 @@ - + @@ -327,7 +327,7 @@ - + diff --git a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java index a57ab22a2..f552c6bcc 100644 --- a/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java +++ b/src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java @@ -80,6 +80,7 @@ public class PreferenceActivity extends ZLPreferenceActivity { final FooterOptions footerOptions = viewOptions.getFooterOptions(); final PageTurningOptions pageTurningOptions = new PageTurningOptions(); final ImageOptions imageOptions = new ImageOptions(); + final SyncOptions syncOptions = new SyncOptions(); final ColorProfile profile = viewOptions.getColorProfile(); final ZLTextStyleCollection collection = viewOptions.getTextStyleCollection(); final ZLKeyBindings keyBindings = new ZLKeyBindings(); @@ -120,6 +121,27 @@ public class PreferenceActivity extends ZLPreferenceActivity { directoriesScreen.Resource, "tempDir", Paths.TempDirectoryOption, null )); + final Screen syncScreen = createPreferenceScreen("sync"); + final PreferenceSet syncPreferences = new PreferenceSet.Enabler() { + @Override + protected Boolean detectState() { + return syncOptions.Enabled.getValue(); + } + }; + syncScreen.addPreference(new ZLBooleanPreference( + this, syncOptions.Enabled, syncScreen.Resource, "enable" + ) { + @Override + protected void onClick() { + super.onClick(); + syncPreferences.run(); + } + }); + syncPreferences.add(syncScreen.addOption(syncOptions.UploadAllBooks, "uploadAllBooks")); + syncPreferences.add(syncScreen.addOption(syncOptions.Positions, "positions")); + syncPreferences.add(syncScreen.addOption(syncOptions.Metainfo, "metainfo")); + syncPreferences.add(syncScreen.addOption(syncOptions.Bookmarks, "bookmarks")); + final Screen appearanceScreen = createPreferenceScreen("appearance"); appearanceScreen.addPreference(new LanguagePreference( this, appearanceScreen.Resource, "language", ZLResource.interfaceLanguages() diff --git a/src/org/geometerplus/fbreader/fbreader/options/SyncOptions.java b/src/org/geometerplus/fbreader/fbreader/options/SyncOptions.java new file mode 100644 index 000000000..0f6be791a --- /dev/null +++ b/src/org/geometerplus/fbreader/fbreader/options/SyncOptions.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007-2014 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.fbreader.fbreader.options; + +import org.geometerplus.zlibrary.core.options.*; + +public class SyncOptions { + public final ZLBooleanOption Enabled = + new ZLBooleanOption("Sync", "Enabled", false); + + public static enum SyncCondition { + never, viaWifi, always + } + public final ZLEnumOption UploadAllBooks = + new ZLEnumOption("Sync", "UploadAllBooks", SyncCondition.viaWifi); + public final ZLBooleanOption Positions = + new ZLBooleanOption("Sync", "Positions", true); + public final ZLBooleanOption Bookmarks = + new ZLBooleanOption("Sync", "Bookmarks", true); + public final ZLBooleanOption Metainfo = + new ZLBooleanOption("Sync", "Metainfo", true); +}