1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 01:39:18 +02:00

one more obsolete file

This commit is contained in:
Nikolay Pultsin 2014-07-08 17:33:16 +01:00
parent 32b6d9382c
commit 5059137c68

46
obsolete/external/FBReader.Opener.java vendored Normal file
View 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;
}
}