mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
cleanup: ZLibrary.openInBrowser() method has been removed
This commit is contained in:
parent
ec4398d411
commit
865d5607bf
3 changed files with 19 additions and 33 deletions
|
@ -19,8 +19,15 @@
|
|||
|
||||
package org.geometerplus.android.fbreader;
|
||||
|
||||
import android.app.SearchManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||
import org.geometerplus.zlibrary.core.network.ZLNetworkException;
|
||||
|
||||
import org.geometerplus.zlibrary.text.view.ZLTextView;
|
||||
import org.geometerplus.zlibrary.text.view.ZLTextHyperlink;
|
||||
|
@ -28,12 +35,10 @@ import org.geometerplus.zlibrary.text.view.ZLTextHyperlink;
|
|||
import org.geometerplus.fbreader.fbreader.FBAction;
|
||||
import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
||||
import org.geometerplus.fbreader.bookmodel.FBHyperlinkType;
|
||||
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||
|
||||
import android.app.SearchManager;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.widget.Toast;
|
||||
import org.geometerplus.android.fbreader.network.BookDownloader;
|
||||
import org.geometerplus.android.fbreader.network.BookDownloaderService;
|
||||
|
||||
class ProcessHyperlinkAction extends FBAction {
|
||||
private final FBReader myBaseActivity;
|
||||
|
@ -55,7 +60,7 @@ class ProcessHyperlinkAction extends FBAction {
|
|||
if (hyperlink != null) {
|
||||
switch (hyperlink.Type) {
|
||||
case FBHyperlinkType.EXTERNAL:
|
||||
ZLibrary.Instance().openInBrowser(hyperlink.Id);
|
||||
openInBrowser(hyperlink.Id);
|
||||
break;
|
||||
case FBHyperlinkType.INTERNAL:
|
||||
Reader.tryOpenFootnote(hyperlink.Id);
|
||||
|
@ -90,11 +95,12 @@ class ProcessHyperlinkAction extends FBAction {
|
|||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
private void openInBrowser(String urlString) {
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
boolean externalUrl = true;
|
||||
if (BookDownloader.acceptsUri(Uri.parse(reference))) {
|
||||
intent.setClass(myActivity, BookDownloader.class);
|
||||
if (BookDownloader.acceptsUri(Uri.parse(urlString))) {
|
||||
intent.setClass(myBaseActivity, BookDownloader.class);
|
||||
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALL);
|
||||
externalUrl = false;
|
||||
}
|
||||
|
@ -103,8 +109,7 @@ class ProcessHyperlinkAction extends FBAction {
|
|||
nLibrary.initialize();
|
||||
} catch (ZLNetworkException e) {
|
||||
}
|
||||
reference = NetworkLibrary.Instance().rewriteUrl(reference, externalUrl);
|
||||
intent.setData(Uri.parse(reference));
|
||||
myActivity.startActivity(intent);
|
||||
*/
|
||||
intent.setData(Uri.parse(NetworkLibrary.Instance().rewriteUrl(urlString, externalUrl)));
|
||||
myBaseActivity.startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,5 @@ public abstract class ZLibrary {
|
|||
abstract public void setScreenBrightness(int percent);
|
||||
abstract public int getScreenBrightness();
|
||||
abstract public int getDisplayDPI();
|
||||
abstract public void openInBrowser(String reference);
|
||||
abstract public Collection<String> defaultLanguageCodes();
|
||||
}
|
||||
|
|
|
@ -81,24 +81,6 @@ public final class ZLAndroidLibrary extends ZLibrary {
|
|||
return myWidget;
|
||||
}
|
||||
|
||||
public void openInBrowser(String reference) {
|
||||
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
boolean externalUrl = true;
|
||||
if (BookDownloader.acceptsUri(Uri.parse(reference))) {
|
||||
intent.setClass(myActivity, BookDownloader.class);
|
||||
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALL);
|
||||
externalUrl = false;
|
||||
}
|
||||
final NetworkLibrary nLibrary = NetworkLibrary.Instance();
|
||||
try {
|
||||
nLibrary.initialize();
|
||||
} catch (ZLNetworkException e) {
|
||||
}
|
||||
reference = NetworkLibrary.Instance().rewriteUrl(reference, externalUrl);
|
||||
intent.setData(Uri.parse(reference));
|
||||
myActivity.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ZLResourceFile createResourceFile(String path) {
|
||||
return new AndroidAssetsFile(path);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue