From 0ef53a968c083b3c4d054eed72febf3610538dc2 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Mon, 11 Jan 2021 23:27:07 +0200 Subject: [PATCH] first step towards pattern-assisted auto-filling of transactions in the end will support deducing transactions via QR-code scan, clipboard paste and text messages --- app/build.gradle | 4 +- app/src/main/AndroidManifest.xml | 6 +- .../ktnx/mobileledger/model/PatternEntry.java | 33 +++++++ .../ui/activity/MainActivity.java | 25 +++--- .../ui/activity/NewTransactionFragment.java | 89 ++++++++++++++++++- .../ui/activity/PatternsActivity.java | 66 ++++++++++++++ .../ui/patterns/PatternViewHolder.java | 35 ++++++++ .../ui/patterns/PatternsModel.java | 58 ++++++++++++ .../patterns/PatternsRecyclerViewAdapter.java | 74 +++++++++++++++ .../net/ktnx/mobileledger/utils/MLDB.java | 6 +- .../ic_baseline_auto_graph_24.xml | 30 +++++++ .../drawable-anydpi/ic_baseline_help_24.xml | 30 +++++++ .../ic_baseline_help_24_white.xml | 30 +++++++ .../ic_baseline_qr_code_scanner_24.xml | 30 +++++++ app/src/main/res/layout/activity_main.xml | 10 ++- app/src/main/res/layout/activity_patterns.xml | 82 +++++++++++++++++ app/src/main/res/layout/pattern_layout.xml | 44 +++++++++ .../res/menu/new_transaction_fragment.xml | 14 ++- app/src/main/res/menu/pattern_list_menu.xml | 27 ++++++ app/src/main/res/values-bg/strings.xml | 6 +- app/src/main/res/values/strings.xml | 8 +- 21 files changed, 681 insertions(+), 26 deletions(-) create mode 100644 app/src/main/java/net/ktnx/mobileledger/model/PatternEntry.java create mode 100644 app/src/main/java/net/ktnx/mobileledger/ui/activity/PatternsActivity.java create mode 100644 app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternViewHolder.java create mode 100644 app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsModel.java create mode 100644 app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternsRecyclerViewAdapter.java create mode 100644 app/src/main/res/drawable-anydpi/ic_baseline_auto_graph_24.xml create mode 100644 app/src/main/res/drawable-anydpi/ic_baseline_help_24.xml create mode 100644 app/src/main/res/drawable-anydpi/ic_baseline_help_24_white.xml create mode 100644 app/src/main/res/drawable-anydpi/ic_baseline_qr_code_scanner_24.xml create mode 100644 app/src/main/res/layout/activity_patterns.xml create mode 100644 app/src/main/res/layout/pattern_layout.xml create mode 100644 app/src/main/res/menu/pattern_list_menu.xml diff --git a/app/build.gradle b/app/build.gradle index c73b9157..d21f3ee5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright © 2020 Damyan Ivanov. + * Copyright © 2021 Damyan Ivanov. * This file is part of MoLe. * MoLe is free software: you can distribute it and/or modify it * under the term of the GNU General Public License as published by @@ -50,6 +50,8 @@ android { } dependencies { + implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0' + implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0' def nav_version = '2.3.1' implementation fileTree(include: ['*.jar'], dir: 'libs') implementation 'androidx.legacy:legacy-support-v4:1.0.0' diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index aca6ce21..a865bf9d 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,5 +1,5 @@ + + + + diff --git a/app/src/main/res/drawable-anydpi/ic_baseline_help_24.xml b/app/src/main/res/drawable-anydpi/ic_baseline_help_24.xml new file mode 100644 index 00000000..47d7b42d --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_baseline_help_24.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/app/src/main/res/drawable-anydpi/ic_baseline_help_24_white.xml b/app/src/main/res/drawable-anydpi/ic_baseline_help_24_white.xml new file mode 100644 index 00000000..3cbf7156 --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_baseline_help_24_white.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/app/src/main/res/drawable-anydpi/ic_baseline_qr_code_scanner_24.xml b/app/src/main/res/drawable-anydpi/ic_baseline_qr_code_scanner_24.xml new file mode 100644 index 00000000..051367b6 --- /dev/null +++ b/app/src/main/res/drawable-anydpi/ic_baseline_qr_code_scanner_24.xml @@ -0,0 +1,30 @@ + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index d30b88a1..ede0f620 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -1,5 +1,5 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/pattern_layout.xml b/app/src/main/res/layout/pattern_layout.xml new file mode 100644 index 00000000..6c1928fa --- /dev/null +++ b/app/src/main/res/layout/pattern_layout.xml @@ -0,0 +1,44 @@ + + + + + + \ No newline at end of file diff --git a/app/src/main/res/menu/new_transaction_fragment.xml b/app/src/main/res/menu/new_transaction_fragment.xml index c44acf51..1fe38243 100644 --- a/app/src/main/res/menu/new_transaction_fragment.xml +++ b/app/src/main/res/menu/new_transaction_fragment.xml @@ -1,6 +1,6 @@ + xmlns:app="http://schemas.android.com/apk/res-auto" + > + + app:showAsAction="never" + /> + + + + + \ No newline at end of file diff --git a/app/src/main/res/values-bg/strings.xml b/app/src/main/res/values-bg/strings.xml index d52c59ce..17f038ec 100644 --- a/app/src/main/res/values-bg/strings.xml +++ b/app/src/main/res/values-bg/strings.xml @@ -1,6 +1,6 @@