use of ca.rmen.android.networkmonitor.app.dbops.backend.export.GnuplotExport in project network-monitor by caarmen.
the class DBOpIntentService method handleActionExport.
private void handleActionExport(ExportFormat exportFileFormat, Bundle extras) {
Log.d(TAG, "handleActionExport() called with exportFileFormat = [" + exportFileFormat + "]");
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager == null)
return;
FileExport fileExport;
switch(exportFileFormat) {
case CSV:
fileExport = new CSVExport(this);
break;
case DB:
fileExport = new DBExport(this);
break;
case EXCEL:
fileExport = new ExcelExport(this);
break;
case HTML:
fileExport = new HTMLExport(this);
break;
case KML:
String placemarkColumnName = extras.getString(EXTRA_EXPORT_KML_PLACEMARK_COLUMN_NAME);
fileExport = new KMLExport(this, placemarkColumnName);
break;
case GNUPLOT:
fileExport = new GnuplotExport(this);
break;
case SUMMARY:
default:
fileExport = null;
}
mDBOperation = fileExport;
File file = null;
if (fileExport != null) {
fileExport.execute(mExportProgressListener);
file = fileExport.getFile();
}
// Start the summary report
Intent shareIntent = FileExport.getShareIntent(this, file);
// All done
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, shareIntent, PendingIntent.FLAG_UPDATE_CURRENT);
final NotificationCompat.Builder notificationBuilder;
if (fileExport != null && fileExport.isCanceled()) {
notificationBuilder = prepareFileExportNotification(getString(R.string.export_notif_canceled_title), getString(R.string.export_notif_canceled_content), pendingIntent);
} else {
notificationBuilder = prepareFileExportNotification(getString(R.string.export_notif_complete_title), getString(R.string.export_notif_complete_content), pendingIntent);
}
notificationBuilder.addAction(R.drawable.ic_pref_share, getString(R.string.action_share), pendingIntent);
notificationManager.notify(FileExport.class.hashCode(), notificationBuilder.build());
}
use of ca.rmen.android.networkmonitor.app.dbops.backend.export.GnuplotExport in project network-monitor by caarmen.
the class ReportEmailer method createAttachment.
/**
* @param fileType one of the file types the user selected in the preference
* @return the BodyPart containing the exported file of this type.
*/
private File createAttachment(String fileType) {
Log.v(TAG, "createAttachment: fileType = " + fileType);
// Get the FileExport instance which can export mContext file type.
final FileExport fileExport;
switch(fileType) {
case "csv":
fileExport = new CSVExport(mContext);
break;
case "html":
fileExport = new HTMLExport(mContext);
break;
case "excel":
fileExport = new ExcelExport(mContext);
break;
case "kml":
fileExport = new KMLExport(mContext, NetMonColumns.SOCKET_CONNECTION_TEST);
break;
case "gnuplot":
fileExport = new GnuplotExport(mContext);
break;
case "db":
default:
fileExport = new DBExport(mContext);
break;
}
fileExport.execute(null);
return fileExport.getFile();
}
Aggregations