mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +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;
|
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.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.ZLTextView;
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextHyperlink;
|
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.FBAction;
|
||||||
import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
||||||
import org.geometerplus.fbreader.bookmodel.FBHyperlinkType;
|
import org.geometerplus.fbreader.bookmodel.FBHyperlinkType;
|
||||||
|
import org.geometerplus.fbreader.network.NetworkLibrary;
|
||||||
|
|
||||||
import android.app.SearchManager;
|
import org.geometerplus.android.fbreader.network.BookDownloader;
|
||||||
import android.content.ActivityNotFoundException;
|
import org.geometerplus.android.fbreader.network.BookDownloaderService;
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
class ProcessHyperlinkAction extends FBAction {
|
class ProcessHyperlinkAction extends FBAction {
|
||||||
private final FBReader myBaseActivity;
|
private final FBReader myBaseActivity;
|
||||||
|
@ -55,7 +60,7 @@ class ProcessHyperlinkAction extends FBAction {
|
||||||
if (hyperlink != null) {
|
if (hyperlink != null) {
|
||||||
switch (hyperlink.Type) {
|
switch (hyperlink.Type) {
|
||||||
case FBHyperlinkType.EXTERNAL:
|
case FBHyperlinkType.EXTERNAL:
|
||||||
ZLibrary.Instance().openInBrowser(hyperlink.Id);
|
openInBrowser(hyperlink.Id);
|
||||||
break;
|
break;
|
||||||
case FBHyperlinkType.INTERNAL:
|
case FBHyperlinkType.INTERNAL:
|
||||||
Reader.tryOpenFootnote(hyperlink.Id);
|
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);
|
final Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||||
boolean externalUrl = true;
|
boolean externalUrl = true;
|
||||||
if (BookDownloader.acceptsUri(Uri.parse(reference))) {
|
if (BookDownloader.acceptsUri(Uri.parse(urlString))) {
|
||||||
intent.setClass(myActivity, BookDownloader.class);
|
intent.setClass(myBaseActivity, BookDownloader.class);
|
||||||
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALL);
|
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALL);
|
||||||
externalUrl = false;
|
externalUrl = false;
|
||||||
}
|
}
|
||||||
|
@ -103,8 +109,7 @@ class ProcessHyperlinkAction extends FBAction {
|
||||||
nLibrary.initialize();
|
nLibrary.initialize();
|
||||||
} catch (ZLNetworkException e) {
|
} catch (ZLNetworkException e) {
|
||||||
}
|
}
|
||||||
reference = NetworkLibrary.Instance().rewriteUrl(reference, externalUrl);
|
intent.setData(Uri.parse(NetworkLibrary.Instance().rewriteUrl(urlString, externalUrl)));
|
||||||
intent.setData(Uri.parse(reference));
|
myBaseActivity.startActivity(intent);
|
||||||
myActivity.startActivity(intent);
|
}
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,5 @@ public abstract class ZLibrary {
|
||||||
abstract public void setScreenBrightness(int percent);
|
abstract public void setScreenBrightness(int percent);
|
||||||
abstract public int getScreenBrightness();
|
abstract public int getScreenBrightness();
|
||||||
abstract public int getDisplayDPI();
|
abstract public int getDisplayDPI();
|
||||||
abstract public void openInBrowser(String reference);
|
|
||||||
abstract public Collection<String> defaultLanguageCodes();
|
abstract public Collection<String> defaultLanguageCodes();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,24 +81,6 @@ public final class ZLAndroidLibrary extends ZLibrary {
|
||||||
return myWidget;
|
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
|
@Override
|
||||||
public ZLResourceFile createResourceFile(String path) {
|
public ZLResourceFile createResourceFile(String path) {
|
||||||
return new AndroidAssetsFile(path);
|
return new AndroidAssetsFile(path);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue