use of org.geometerplus.fbreader.network.tree.NetworkCatalogRootTree in project FBReaderJ by geometer.
the class SignOutAction method isVisible.
@Override
public boolean isVisible(NetworkTree tree) {
if (!(tree instanceof NetworkCatalogRootTree)) {
return false;
}
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);
}
use of org.geometerplus.fbreader.network.tree.NetworkCatalogRootTree in project FBReaderJ by geometer.
the class SignOutAction method run.
@Override
public void run(NetworkTree tree) {
final INetworkLink link = tree.getLink();
if (link instanceof ISyncNetworkLink) {
((ISyncNetworkLink) link).logout(myNetworkContext);
((NetworkCatalogRootTree) tree).clearCatalog();
return;
}
final NetworkAuthenticationManager mgr = link.authenticationManager();
final Runnable runnable = new Runnable() {
public void run() {
if (mgr.mayBeAuthorised(false)) {
mgr.logOut();
myActivity.runOnUiThread(new Runnable() {
public void run() {
myLibrary.invalidateVisibility();
myLibrary.synchronize();
}
});
}
}
};
UIUtil.wait("signOut", runnable, myActivity);
}
Aggregations