From df5f8c46f76010c084e17e08631c44d4c26dddc0 Mon Sep 17 00:00:00 2001 From: Severiano Jaramillo Date: Fri, 1 Feb 2019 15:57:56 -0600 Subject: [PATCH] Create Export filtered transactions dialog in TransactionsFragment, which opens when the user clicks on the Toolbar's export button, with the corresponding Spanish translation of the new strings. --- app/build.gradle | 2 +- .../fragments/TransactionsFragment.kt | 17 ++++++++++++++++- app/src/main/res/values-es/strings.xml | 5 +++++ app/src/main/res/values/arrays.xml | 7 +++++++ app/src/main/res/values/strings.xml | 5 +++++ 5 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/values/arrays.xml diff --git a/app/build.gradle b/app/build.gradle index fd78cf6..4108b52 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -107,7 +107,7 @@ dependencies { implementation 'org.bitcoinj:bitcoinj-core:0.14.3' implementation 'com.moldedbits.r2d2:r2d2:1.0.1' implementation 'me.dm7.barcodescanner:zxing:1.9.8' - implementation 'com.afollestad.material-dialogs:core:2.0.0-rc7' + implementation 'com.afollestad.material-dialogs:core:2.0.0-rc9' // Android Debug Database debugImplementation 'com.amitshekhar.android:debug-db:1.0.4' diff --git a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt index 890b772..8d11447 100644 --- a/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt +++ b/app/src/main/java/cy/agorise/bitsybitshareswallet/fragments/TransactionsFragment.kt @@ -10,6 +10,8 @@ import androidx.fragment.app.FragmentActivity import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProviders import androidx.recyclerview.widget.LinearLayoutManager +import com.afollestad.materialdialogs.MaterialDialog +import com.afollestad.materialdialogs.list.listItemsMultiChoice import com.jakewharton.rxbinding3.appcompat.queryTextChangeEvents import cy.agorise.bitsybitshareswallet.R import cy.agorise.bitsybitshareswallet.adapters.TransfersDetailsAdapter @@ -118,7 +120,15 @@ class TransactionsFragment : Fragment(), FilterOptionsDialog.OnFilterOptionsSele true } R.id.menu_export -> { - // TODO add export options + MaterialDialog(context!!).show { + title(R.string.title_export_transactions) + listItemsMultiChoice(R.array.export_options, initialSelection = intArrayOf(0,1)) { _, indices, _ -> + val exportPDF = indices.contains(0) + val exportCSV = indices.contains(1) + exportFilteredTransactions(exportPDF, exportCSV) + } + positiveButton(R.string.title_export) + } true } else -> super.onOptionsItemSelected(item) @@ -215,6 +225,11 @@ class TransactionsFragment : Fragment(), FilterOptionsDialog.OnFilterOptionsSele applyFilterOptions(true) } + /** Created the export procedures for PDF and CSV, depending on the user selection. */ + private fun exportFilteredTransactions(exportPDF: Boolean, exportCSV: Boolean) { + + } + override fun onDestroy() { super.onDestroy() diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index cc13d4b..7fdd6fa 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -58,6 +58,11 @@ Ignorar cuotas de red Filtrar + + Exportar transacciones filtradas + PDF + CSV + Comerciantes Tellers diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml new file mode 100644 index 0000000..64b1ff2 --- /dev/null +++ b/app/src/main/res/values/arrays.xml @@ -0,0 +1,7 @@ + + + + @string/text__pdf + @string/text__csv + + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0123e2a..21c2577 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -58,6 +58,11 @@ Ignore Network fees Filter + + Export filtered transactions + PDF + CSV + Merchants Tellers