mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-04 18:29:23 +02:00
special network link for synchronization service
This commit is contained in:
parent
34cea5fe4d
commit
1d755b9888
44 changed files with 276 additions and 26 deletions
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="مكتبة الشبكة">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="حسب المؤلف">
|
||||
<node name="summary" value="ترتيب الكتب حسب المؤلف"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Сеткавая бібліятэка FBReader">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Па аўтары">
|
||||
<node name="summary" value="Кнігі адсартаваныя па аўтары"/>
|
||||
</node>
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader: мрежова библиотека">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Автор">
|
||||
<node name="summary" value="Книги, подредени по автори"/>
|
||||
</node>
|
||||
|
|
|
@ -75,6 +75,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Biblioteca en xarxa de l'FBReader">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Per autor">
|
||||
<node name="summary" value="Llibres ordenats per autor"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Síťová knihovna FBReaderu">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Podle autora">
|
||||
<node name="summary" value="Knihy seřazeny podle autora"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FB-Læser netværksbibliotek">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Efter forfatter">
|
||||
<node name="summary" value="Bøger sorteret efter forfatter"/>
|
||||
</node>
|
||||
|
|
|
@ -74,6 +74,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader Netzwerk-Bibliothek">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Nach Autoren gruppiert">
|
||||
<node name="summary" value="Bücher nach Autoren auswählen"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="δικτυακή βιβλιοθήκη FBReader">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Κατηγοριοποίηση ανά συγγραφείς">
|
||||
<node name="summary" value="Επιλογή βιβλίου κατά συγγραφέα"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader network library">
|
||||
<node name="sync" value="FBReader® book network">
|
||||
<node name="summary" value="My personal catalog"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="By author">
|
||||
<node name="summary" value="Books sorted by author"/>
|
||||
</node>
|
||||
|
|
|
@ -74,6 +74,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Biblioteca en red de FBReader">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Por autor">
|
||||
<node name="summary" value="Libros ordenados por autor"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReadereko sare-liburutegia">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Egileagatik">
|
||||
<node name="summary" value="Egileagatik sailkatutako liburuak"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="شبکه کتابخانه اف بی ریدر">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="بر اساس نویسنده">
|
||||
<node name="summary" value="کتابها بر اساس نویسنده دسته بندی شده"/>
|
||||
</node>
|
||||
|
|
|
@ -72,6 +72,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Librairie réseau">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Par auteur">
|
||||
<node name="summary" value="Livres triés par auteur"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader network library" toBeTranslated="true">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Por autor">
|
||||
<node name="summary" value="Libros ordenados por autor"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader internetes könyvtár">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Szerző">
|
||||
<node name="summary" value="Könyvek szerző szerint"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader. ցանցային գրադարան">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Ըստ հեղինակի">
|
||||
<node name="summary" value="Գրքեր՝ դասավորված ըստ հեղինակի"/>
|
||||
</node>
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Libreria di rete FBReader">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Per autore">
|
||||
<node name="summary" value="Libri ordinati per autore"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader: ქსელური ბიბლიოთეკა">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="ავტორებით">
|
||||
<node name="summary" value="წიგნები, დალაგებული ავტორების მიხედვით"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader nettverksbibliotek">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Etter forfatter">
|
||||
<node name="summary" value="Bøker sortert på forfatter"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader netwerkbibliotheek">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Auteurs">
|
||||
<node name="summary" value="Boeken gesorteerd op auteur"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Sieciowa biblioteka FBReadera">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Po autorze">
|
||||
<node name="summary" value="Książki posortowane po autorze"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Tentar de novo"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Rede de bibliotecas FBReader">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Pelo autor">
|
||||
<node name="summary" value="Livros classificados por autor"/>
|
||||
</node>
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Reteaua de biblioteci Online">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Dupa autor">
|
||||
<node name="summary" value="Carti sortate dupa autor"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Попробовать снова"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader: сетевая библиотека">
|
||||
<node name="sync" value="Книжная сеть FBReader®">
|
||||
<node name="summary" value="Моя книжная полка"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="По авторам">
|
||||
<node name="summary" value="Книги, разложенные по авторам"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader мрежна библиотека">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="По аутору">
|
||||
<node name="summary" value="Књиге поређане по аутору"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader network library" toBeTranslated="true">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="ชื่อผู้แต่ง ">
|
||||
<node name="summary" value="เรียงตามชื่อผู้แต่ง"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader ağ kitaplığı">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Yazarlar">
|
||||
<node name="summary" value="Kitaplar yazarlarına göre sıralansın"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="Мережева бібліотека FBReader">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="За автором">
|
||||
<node name="summary" value="Книги відсортовані за автором"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader network library" toBeTranslated="true">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="Theo tác giả">
|
||||
<node name="summary" value="Sách được xếp theo tác giả"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader 网络书库">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="作者">
|
||||
<node name="summary" value="按作者排序"/>
|
||||
</node>
|
||||
|
|
|
@ -69,6 +69,9 @@
|
|||
<node name="tryAgain" value="Try again" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="networkLibrary" value="FBReader network library" toBeTranslated="true">
|
||||
<node name="sync" value="FBReader® book network" toBeTranslated="true">
|
||||
<node name="summary" value="My personal catalog" toBeTranslated="true"/>
|
||||
</node>
|
||||
<node name="byAuthor" value="作者">
|
||||
<node name="summary" value="以作者排序"/>
|
||||
</node>
|
||||
|
|
|
@ -236,7 +236,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
myOptionsMenuActions.add(new ReloadCatalogAction(this, myNetworkContext));
|
||||
myOptionsMenuActions.add(new SignInAction(this));
|
||||
myOptionsMenuActions.add(new SignUpAction(this));
|
||||
myOptionsMenuActions.add(new SignOutAction(this));
|
||||
myOptionsMenuActions.add(new SignOutAction(this, myNetworkContext));
|
||||
myOptionsMenuActions.add(new TopupAction(this));
|
||||
myOptionsMenuActions.add(new BuyBasketBooksAction(this));
|
||||
myOptionsMenuActions.add(new ClearBasketAction(this));
|
||||
|
@ -248,7 +248,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
|
|||
myContextMenuActions.add(new OpenInBrowserAction(this));
|
||||
myContextMenuActions.add(new RunSearchAction(this, true));
|
||||
myContextMenuActions.add(new AddCustomCatalogAction(this));
|
||||
myContextMenuActions.add(new SignOutAction(this));
|
||||
myContextMenuActions.add(new SignOutAction(this, myNetworkContext));
|
||||
myContextMenuActions.add(new TopupAction(this));
|
||||
myContextMenuActions.add(new SignInAction(this));
|
||||
myContextMenuActions.add(new EditCustomCatalogAction(this));
|
||||
|
|
|
@ -21,8 +21,7 @@ package org.geometerplus.android.fbreader.network.action;
|
|||
|
||||
import android.app.Activity;
|
||||
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
import org.geometerplus.fbreader.network.NetworkTree;
|
||||
import org.geometerplus.fbreader.network.*;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogRootTree;
|
||||
|
||||
public class DisableCatalogAction extends Action {
|
||||
|
@ -32,7 +31,9 @@ public class DisableCatalogAction extends Action {
|
|||
|
||||
@Override
|
||||
public boolean isVisible(NetworkTree tree) {
|
||||
return tree instanceof NetworkCatalogRootTree;
|
||||
return
|
||||
tree instanceof NetworkCatalogRootTree &&
|
||||
tree.getLink().getType() != INetworkLink.Type.Sync;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,16 +21,20 @@ package org.geometerplus.android.fbreader.network.action;
|
|||
|
||||
import android.app.Activity;
|
||||
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
import org.geometerplus.fbreader.network.NetworkTree;
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkContext;
|
||||
|
||||
import org.geometerplus.fbreader.network.*;
|
||||
import org.geometerplus.fbreader.network.tree.NetworkCatalogRootTree;
|
||||
import org.geometerplus.fbreader.network.authentication.NetworkAuthenticationManager;
|
||||
|
||||
import org.geometerplus.android.util.UIUtil;
|
||||
|
||||
public class SignOutAction extends Action {
|
||||
public SignOutAction(Activity activity) {
|
||||
private final ZLNetworkContext myNetworkContext;
|
||||
|
||||
public SignOutAction(Activity activity, ZLNetworkContext context) {
|
||||
super(activity, ActionCode.SIGNOUT, "signOut", -1);
|
||||
myNetworkContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -39,13 +43,24 @@ public class SignOutAction extends Action {
|
|||
return false;
|
||||
}
|
||||
|
||||
final NetworkAuthenticationManager mgr = tree.getLink().authenticationManager();
|
||||
final INetworkLink link = tree.getLink();
|
||||
if (link instanceof ISyncNetworkLink) {
|
||||
return ((ISyncNetworkLink)link).isLoggedIn(myNetworkContext);
|
||||
}
|
||||
|
||||
final NetworkAuthenticationManager mgr = link.authenticationManager();
|
||||
return mgr != null && mgr.mayBeAuthorised(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(NetworkTree tree) {
|
||||
final NetworkAuthenticationManager mgr = tree.getLink().authenticationManager();
|
||||
final INetworkLink link = tree.getLink();
|
||||
if (link instanceof ISyncNetworkLink) {
|
||||
((ISyncNetworkLink)link).logout(myNetworkContext);
|
||||
return;
|
||||
}
|
||||
|
||||
final NetworkAuthenticationManager mgr = link.authenticationManager();
|
||||
final Runnable runnable = new Runnable() {
|
||||
public void run() {
|
||||
if (mgr.mayBeAuthorised(false)) {
|
||||
|
|
|
@ -42,7 +42,8 @@ import org.geometerplus.fbreader.Paths;
|
|||
import org.geometerplus.fbreader.bookmodel.FBTextKind;
|
||||
import org.geometerplus.fbreader.fbreader.*;
|
||||
import org.geometerplus.fbreader.fbreader.options.*;
|
||||
import org.geometerplus.fbreader.tips.TipsManager;
|
||||
import org.geometerplus.fbreader.network.sync.SyncUtil;
|
||||
//import org.geometerplus.fbreader.tips.TipsManager;
|
||||
|
||||
import org.geometerplus.android.fbreader.DictionaryUtil;
|
||||
import org.geometerplus.android.fbreader.FBReader;
|
||||
|
@ -143,7 +144,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
|||
) {
|
||||
{
|
||||
if (isChecked()) {
|
||||
setOnSummary(myNetworkContext.getAccountName(SyncOptions.DOMAIN, SyncOptions.REALM));
|
||||
setOnSummary(SyncUtil.getAccountName(myNetworkContext));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,8 +153,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
|||
super.onClick();
|
||||
syncPreferences.run();
|
||||
|
||||
myNetworkContext.removeCookiesForDomain(SyncOptions.DOMAIN);
|
||||
myNetworkContext.setAccountName(SyncOptions.DOMAIN, SyncOptions.REALM, null);
|
||||
SyncUtil.logout(myNetworkContext);
|
||||
|
||||
if (!isChecked()) {
|
||||
setOnSummary(null);
|
||||
|
@ -164,7 +164,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
|||
public void run() {
|
||||
try {
|
||||
myNetworkContext.perform(
|
||||
new JsonRequest(SyncOptions.URL + "login/test") {
|
||||
new JsonRequest(SyncOptions.BASE_URL + "login/test") {
|
||||
@Override
|
||||
public void processResponse(Object response) {
|
||||
setOnSummary((String)((Map)response).get("user"));
|
||||
|
@ -657,8 +657,8 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
|||
keyBindings.getOption(KeyEvent.KEYCODE_BACK, true), backKeyLongPressActions
|
||||
));
|
||||
|
||||
final Screen tipsScreen = createPreferenceScreen("tips");
|
||||
tipsScreen.addOption(TipsManager.Instance().ShowTipsOption, "showTips");
|
||||
//final Screen tipsScreen = createPreferenceScreen("tips");
|
||||
//tipsScreen.addOption(TipsManager.Instance().ShowTipsOption, "showTips");
|
||||
|
||||
final Screen aboutScreen = createPreferenceScreen("about");
|
||||
aboutScreen.addPreference(new InfoPreference(
|
||||
|
|
|
@ -36,6 +36,7 @@ import org.geometerplus.zlibrary.core.util.MiscUtil;
|
|||
import org.geometerplus.zlibrary.ui.android.network.SQLiteCookieDatabase;
|
||||
import org.geometerplus.fbreader.book.*;
|
||||
import org.geometerplus.fbreader.fbreader.options.SyncOptions;
|
||||
import org.geometerplus.fbreader.network.sync.SyncUtil;
|
||||
import org.geometerplus.android.fbreader.libraryService.BookCollectionShadow;
|
||||
import org.geometerplus.android.fbreader.network.auth.ServiceNetworkContext;
|
||||
|
||||
|
@ -77,7 +78,7 @@ public class SyncService extends Service implements IBookCollection.Listener, Ru
|
|||
if (!canPerformRequest()) {
|
||||
throw new SyncronizationDisabledException();
|
||||
}
|
||||
final String accountName = getAccountName(SyncOptions.DOMAIN, SyncOptions.REALM);
|
||||
final String accountName = SyncUtil.getAccountName(this);
|
||||
if (!MiscUtil.equals(myAccountName, accountName)) {
|
||||
reloadCookie();
|
||||
myAccountName = accountName;
|
||||
|
@ -230,7 +231,7 @@ public class SyncService extends Service implements IBookCollection.Listener, Ru
|
|||
|
||||
private static abstract class PostRequest extends ZLNetworkRequest.PostWithMap {
|
||||
PostRequest(String app, Map<String,String> data) {
|
||||
super(SyncOptions.URL + "app/" + app, false);
|
||||
super(SyncOptions.BASE_URL + "app/" + app, false);
|
||||
if (data != null) {
|
||||
for (Map.Entry<String, String> entry : data.entrySet()) {
|
||||
addPostParameter(entry.getKey(), entry.getValue());
|
||||
|
@ -250,7 +251,7 @@ public class SyncService extends Service implements IBookCollection.Listener, Ru
|
|||
boolean Success = false;
|
||||
|
||||
UploadRequest(File file) {
|
||||
super(SyncOptions.URL + "app/book.upload", file, false);
|
||||
super(SyncOptions.BASE_URL + "app/book.upload", file, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,8 @@ import org.geometerplus.zlibrary.core.options.*;
|
|||
|
||||
public class SyncOptions {
|
||||
public static final String DOMAIN = "demo.fbreader.org";
|
||||
public static final String URL = "https://" + DOMAIN + "/";
|
||||
public static final String BASE_URL = "https://" + DOMAIN + "/";
|
||||
public static final String OPDS_URL = "https://" + DOMAIN + "/opds";
|
||||
public static final String REALM = "FBReader book network";
|
||||
|
||||
public final ZLBooleanOption Enabled =
|
||||
|
|
|
@ -32,7 +32,8 @@ public interface INetworkLink extends Comparable<INetworkLink> {
|
|||
public enum Type {
|
||||
Predefined(0),
|
||||
Custom(1),
|
||||
Local(2);
|
||||
Local(2),
|
||||
Sync(3);
|
||||
|
||||
public final int Index;
|
||||
|
||||
|
|
27
src/org/geometerplus/fbreader/network/ISyncNetworkLink.java
Normal file
27
src/org/geometerplus/fbreader/network/ISyncNetworkLink.java
Normal file
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2014 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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.network;
|
||||
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkContext;
|
||||
|
||||
public interface ISyncNetworkLink extends INetworkLink {
|
||||
boolean isLoggedIn(ZLNetworkContext context);
|
||||
void logout(ZLNetworkContext context);
|
||||
}
|
|
@ -27,12 +27,14 @@ import org.geometerplus.zlibrary.core.library.ZLibrary;
|
|||
import org.geometerplus.zlibrary.core.network.*;
|
||||
import org.geometerplus.zlibrary.core.options.*;
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
import org.geometerplus.zlibrary.core.util.ZLNetworkUtil;
|
||||
import org.geometerplus.zlibrary.core.util.MimeType;
|
||||
import org.geometerplus.zlibrary.core.util.ZLNetworkUtil;
|
||||
|
||||
import org.geometerplus.fbreader.fbreader.options.SyncOptions;
|
||||
import org.geometerplus.fbreader.tree.FBTree;
|
||||
import org.geometerplus.fbreader.network.tree.*;
|
||||
import org.geometerplus.fbreader.network.opds.OPDSSyncNetworkLink;
|
||||
import org.geometerplus.fbreader.network.opds.OPDSLinkReader;
|
||||
import org.geometerplus.fbreader.network.tree.*;
|
||||
import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
||||
|
||||
public class NetworkLibrary {
|
||||
|
@ -158,6 +160,11 @@ public class NetworkLibrary {
|
|||
}
|
||||
|
||||
final List<INetworkLink> result = new LinkedList<INetworkLink>();
|
||||
INetworkLink syncLink = linksById.get(SyncOptions.DOMAIN);
|
||||
if (syncLink == null) {
|
||||
syncLink = new OPDSSyncNetworkLink();
|
||||
}
|
||||
result.add(syncLink);
|
||||
for (String id : activeIds()) {
|
||||
final INetworkLink link = linksById.get(id);
|
||||
if (link != null) {
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* Copyright (C) 2010-2014 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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.network.opds;
|
||||
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkContext;
|
||||
import org.geometerplus.zlibrary.core.network.QuietNetworkContext;
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
import org.geometerplus.zlibrary.core.util.MimeType;
|
||||
|
||||
import org.geometerplus.fbreader.fbreader.options.SyncOptions;
|
||||
import org.geometerplus.fbreader.network.ISyncNetworkLink;
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
import org.geometerplus.fbreader.network.sync.SyncUtil;
|
||||
import org.geometerplus.fbreader.network.urlInfo.*;
|
||||
|
||||
public class OPDSSyncNetworkLink extends OPDSNetworkLink implements ISyncNetworkLink {
|
||||
private static UrlInfoCollection<UrlInfoWithDate> initialUrlInfos() {
|
||||
final UrlInfoCollection<UrlInfoWithDate> infos = new UrlInfoCollection<UrlInfoWithDate>();
|
||||
infos.addInfo(new UrlInfoWithDate(
|
||||
UrlInfo.Type.Catalog,
|
||||
SyncOptions.OPDS_URL,
|
||||
MimeType.OPDS
|
||||
));
|
||||
infos.addInfo(new UrlInfoWithDate(
|
||||
UrlInfo.Type.Search,
|
||||
SyncOptions.BASE_URL + "opds/search/%s",
|
||||
MimeType.OPDS
|
||||
));
|
||||
infos.addInfo(new UrlInfoWithDate(
|
||||
UrlInfo.Type.Image,
|
||||
SyncOptions.BASE_URL + "static/images/logo-120x120.png",
|
||||
MimeType.IMAGE_PNG
|
||||
));
|
||||
infos.addInfo(new UrlInfoWithDate(
|
||||
UrlInfo.Type.SearchIcon,
|
||||
SyncOptions.BASE_URL + "static/images/folders-light/search.png",
|
||||
MimeType.IMAGE_PNG
|
||||
));
|
||||
return infos;
|
||||
}
|
||||
|
||||
private static ZLResource resource() {
|
||||
return NetworkLibrary.resource().getResource("sync");
|
||||
}
|
||||
|
||||
private static String accountName(ZLNetworkContext context) {
|
||||
return SyncUtil.getAccountName(context);
|
||||
}
|
||||
|
||||
private static String summary() {
|
||||
final String account = accountName(new QuietNetworkContext());
|
||||
return account != null ? account : resource().getResource("summary").getValue();
|
||||
}
|
||||
|
||||
public OPDSSyncNetworkLink() {
|
||||
this(-1, resource().getValue(), summary(), null, initialUrlInfos());
|
||||
}
|
||||
|
||||
private OPDSSyncNetworkLink(int id, String title, String summary, String language, UrlInfoCollection<UrlInfoWithDate> infos) {
|
||||
super(id, SyncOptions.DOMAIN, title, summary, language, infos);
|
||||
}
|
||||
|
||||
public Type getType() {
|
||||
return Type.Sync;
|
||||
}
|
||||
|
||||
public boolean isLoggedIn(ZLNetworkContext context) {
|
||||
return accountName(context) != null;
|
||||
}
|
||||
|
||||
public void logout(ZLNetworkContext context) {
|
||||
SyncUtil.logout(context);
|
||||
}
|
||||
}
|
|
@ -19,11 +19,12 @@
|
|||
|
||||
package org.geometerplus.fbreader.network.tree;
|
||||
|
||||
import org.geometerplus.zlibrary.core.image.ZLImage;
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkContext;
|
||||
import org.geometerplus.zlibrary.core.util.MimeType;
|
||||
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
import org.geometerplus.fbreader.network.SearchItem;
|
||||
import org.geometerplus.fbreader.network.*;
|
||||
import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
||||
|
||||
public class SearchCatalogTree extends NetworkCatalogTree {
|
||||
public SearchCatalogTree(RootTree parent, SearchItem item) {
|
||||
|
@ -87,4 +88,14 @@ public class SearchCatalogTree extends NetworkCatalogTree {
|
|||
public void startItemsLoader(ZLNetworkContext nc, String pattern) {
|
||||
new Searcher(nc, this, pattern).start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZLImage createCover() {
|
||||
final INetworkLink link = getLink();
|
||||
if (link == null) {
|
||||
return null;
|
||||
}
|
||||
final UrlInfo info = link.getUrlInfo(UrlInfo.Type.SearchIcon);
|
||||
return info != null ? createCover(info.Url, info.Mime) : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ public class UrlInfo implements Serializable {
|
|||
Related,
|
||||
Image,
|
||||
Thumbnail,
|
||||
SearchIcon,
|
||||
Search,
|
||||
ListBooks,
|
||||
SignIn,
|
||||
|
|
|
@ -100,6 +100,7 @@ public final class MimeType {
|
|||
// http://www.iana.org/assignments/media-types/application/index.html
|
||||
public static final MimeType APP_ATOM_XML = get("application/atom+xml");
|
||||
public static final MimeType APP_ATOM_XML_ENTRY = get("application/atom+xml;type=entry");
|
||||
public static final MimeType OPDS = get("application/atom+xml;profile=opds");
|
||||
// http://tools.ietf.org/id/draft-nottingham-rss-media-type-00.txt
|
||||
public static final MimeType APP_RSS_XML = get("application/rss+xml");
|
||||
// ???
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue