use of com.faltenreich.diaguard.feature.export.job.FileType in project Diaguard by Faltenreich.
the class ExportFragment method export.
private void export() {
progressComponent.show(getContext());
progressComponent.setMessage(getString(R.string.export_progress));
DateTime dateStart = this.dateStart != null ? this.dateStart.withTimeAtStartOfDay() : null;
DateTime dateEnd = this.dateEnd != null ? this.dateEnd.withTimeAtStartOfDay() : null;
Category[] categories = categoryListAdapter.getSelectedCategories();
PdfExportConfig config = new PdfExportConfig(getContext(), this, dateStart, dateEnd, categories, getStyle(), getBinding().headerCheckbox.isChecked(), getBinding().footerCheckbox.isChecked(), getBinding().noteCheckbox.isChecked(), getBinding().tagsCheckbox.isChecked(), getBinding().emptyDaysCheckbox.isChecked(), categoryListAdapter.exportFood(), categoryListAdapter.splitInsulin(), categoryListAdapter.highlightLimits());
config.persistInSharedPreferences();
FileType type = getFormat();
switch(type) {
case PDF:
Export.exportPdf(config);
break;
case CSV:
Export.exportCsv(getContext(), this, dateStart, dateEnd, categories);
break;
}
}
use of com.faltenreich.diaguard.feature.export.job.FileType in project Diaguard by Faltenreich.
the class ExportHistoryViewHolder method onBind.
@Override
protected void onBind(ExportHistoryListItem item) {
FileType format = FileType.valueOf(item.getFile());
getBinding().formatIcon.setColorFilter(ContextCompat.getColor(getContext(), format != null ? format.colorRes : R.color.gray));
getBinding().formatLabel.setText(format != null ? format.extension : null);
getBinding().createdAtLabel.setText(DateTimeFormat.mediumDateTime().print(item.getCreatedAt()));
getBinding().container.setOnClickListener(view -> openExport());
getBinding().moreButton.setOnClickListener(this::openMenu);
}
Aggregations