protected void sendByEmail() { List<TableExporter> exporters = mSmartTable.getTableExporters(); TableExporter exporter; if (exporters.size() == 1) { exporter = exporters.get(0); } else { // TODO exporter chooser exporter = exporters.get(0); } TableExporter.OnExportDoneListener onExportDoneListener = new TableExporter.OnExportDoneListener() { @Override public void onExportDone(Uri uri) { try { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/csv"); intent.putExtra(Intent.EXTRA_SUBJECT, mProvider.toString()); intent.putExtra(Intent.EXTRA_TEXT, mProvider.toString()); intent.putExtra(Intent.EXTRA_STREAM, uri); intent.setFlags( Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); startActivity(Intent.createChooser(intent, getString(R.string.send_by_email))); } catch (Exception e) { Log.e(TAG, e.getLocalizedMessage()); } } }; exporter.setOnExportDoneListener(onExportDoneListener); exporter.export(getActivity(), mProvider.toString(), mProvider, mSmartTable.getCursor(), true); }
protected void export() { List<TableExporter> exporters = mSmartTable.getTableExporters(); if (exporters.size() == 1) { exporters .get(0) .export(getActivity(), mProvider.toString(), mProvider, mSmartTable.getCursor()); } else { // TODO exporter chooser } }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.default_menu, menu); super.onCreateOptionsMenu(menu, inflater); setMenuIconsTint( menu, MaterialHelper.isLight(MaterialHelper.getPrimaryColor(getActivity())) ? Color.BLACK : Color.WHITE); mSearchMenuItem = menu.findItem(R.id.search); mSearchMenuItem.setVisible(mProvider.isSearchable()); }