mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
new implementation of add custom catalog/open catalog actions
This commit is contained in:
parent
74a3cb54e5
commit
dec2e84b5f
5 changed files with 63 additions and 46 deletions
|
@ -33,6 +33,7 @@ import org.geometerplus.fbreader.network.authentication.litres.LitResAuthenticat
|
|||
import org.geometerplus.fbreader.network.tree.NetworkBookTree;
|
||||
import org.geometerplus.fbreader.network.urlInfo.UrlInfo;
|
||||
|
||||
import org.geometerplus.android.util.UIUtil;
|
||||
import org.geometerplus.android.util.PackageUtil;
|
||||
|
||||
public abstract class Util implements UserRegistrationConstants {
|
||||
|
@ -49,6 +50,23 @@ public abstract class Util implements UserRegistrationConstants {
|
|||
return intent.setData(Uri.parse(link.getUrl(UrlInfo.Type.Catalog)));
|
||||
}
|
||||
|
||||
static void initLibrary(Activity activity) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
if (library.isInitialized()) {
|
||||
return;
|
||||
}
|
||||
|
||||
UIUtil.wait("loadingNetworkLibrary", new Runnable() {
|
||||
public void run() {
|
||||
if (SQLiteNetworkDatabase.Instance() == null) {
|
||||
new SQLiteNetworkDatabase();
|
||||
}
|
||||
|
||||
library.initialize();
|
||||
}
|
||||
}, activity);
|
||||
}
|
||||
|
||||
private static boolean testService(Activity activity, String action, String url) {
|
||||
return url != null && PackageUtil.canBeStarted(activity, new Intent(action, Uri.parse(url)), true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue