mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 09:49:19 +02:00
one more obsolete file
This commit is contained in:
parent
32b6d9382c
commit
5059137c68
1 changed files with 46 additions and 0 deletions
46
obsolete/external/FBReader.Opener.java
vendored
Normal file
46
obsolete/external/FBReader.Opener.java
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
private class ExtFileOpener implements FBReaderApp.ExternalFileOpener {
|
||||||
|
private void showErrorDialog(final String errName) {
|
||||||
|
runOnUiThread(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
final String title = ZLResource.resource("errorMessage").getResource(errName).getValue();
|
||||||
|
final AlertDialog dialog = new AlertDialog.Builder(FBReader.this)
|
||||||
|
.setTitle(title)
|
||||||
|
.setIcon(0)
|
||||||
|
.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.create();
|
||||||
|
if (myIsPaused) {
|
||||||
|
myDialogToShow = dialog;
|
||||||
|
} else {
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean openFile(ZLFile f, String appData) {
|
||||||
|
if (f == null) {
|
||||||
|
showErrorDialog("unzipFailed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String extension = f.getExtension();
|
||||||
|
Uri uri = Uri.parse("file://" + f.getPath());
|
||||||
|
Intent launchIntent = new Intent(Intent.ACTION_VIEW);
|
||||||
|
launchIntent.setPackage(appData);
|
||||||
|
launchIntent.setData(uri);
|
||||||
|
FileType ft = FileTypeCollection.Instance.typeForFile(f);
|
||||||
|
for (MimeType type : ft.mimeTypes()) {
|
||||||
|
launchIntent.setDataAndType(uri, type.Name);
|
||||||
|
try {
|
||||||
|
startActivity(launchIntent);
|
||||||
|
return true;
|
||||||
|
} catch (ActivityNotFoundException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
showErrorDialog("externalNotFound");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue