Skip to content
Snippets Groups Projects
Commit cdf74561 authored by yansans's avatar yansans
Browse files

fix: setting and exporter

parent 2f702ba6
Branches
Tags
1 merge request!13Release
......@@ -40,7 +40,6 @@ class SettingsFragment : Fragment() {
private val transactionsViewModel: TransactionsViewModel by viewModels {
TransactionsViewModelFactory((requireContext().applicationContext as TransactionsApplication).repository)
}
private val database = MockDatabase()
private lateinit var exporter: TransactionsExporter
override fun onCreateView(
......
......@@ -35,7 +35,7 @@ class TransactionsExporter(private val transactionsViewModel: TransactionsViewMo
}
}
private fun writeToExcel(fileName: String, transactions: List<Transaction>) {
private fun writeToExcel(fileName: String, transactions: List<Transactions>) {
val documentsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS)
val file = File(documentsDir, fileName)
......@@ -79,22 +79,8 @@ class TransactionsExporter(private val transactionsViewModel: TransactionsViewMo
}
}.write(file.absolutePath)
workbook {
sheet("Transactions") {
transactionsHeader()
for (transaction in transactions) {
row {
cell(transaction.date)
cell(transaction.category)
cell(transaction.amount)
cell(transaction.name)
cell(transaction.location)
}
}
}
}.write(fileCache.absolutePath)
file.copyTo(fileCache, true)
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment