From: Damyan Ivanov Date: Sun, 31 Jan 2021 11:38:41 +0000 (+0000) Subject: Rename QEScanAbleFragment to QRScanCapableFragment X-Git-Tag: v0.17.0~191 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=5aec3808de833367e5c9f2967978ecb64e69c97f;p=mobile-ledger.git Rename QEScanAbleFragment to QRScanCapableFragment --- diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/QRScanAbleFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/QRScanAbleFragment.java deleted file mode 100644 index 6acb4497..00000000 --- a/app/src/main/java/net/ktnx/mobileledger/ui/QRScanAbleFragment.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 - * the Free Software Foundation, either version 3 of the License, or - * (at your opinion), any later version. - * - * MoLe is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License terms for details. - * - * You should have received a copy of the GNU General Public License - * along with MoLe. If not, see . - */ - -package net.ktnx.mobileledger.ui; - -import android.content.Context; - -import androidx.activity.result.ActivityResultLauncher; -import androidx.annotation.NonNull; -import androidx.fragment.app.Fragment; -import androidx.lifecycle.MutableLiveData; - -public abstract class QRScanAbleFragment extends Fragment { - private static final MutableLiveData qrScanTrigger = new MutableLiveData<>(); - protected final ActivityResultLauncher scanQrLauncher = QR.registerLauncher(this, this::onQrScanned); - public static void triggerQRScan() { - qrScanTrigger.setValue(1); - } - protected abstract void onQrScanned(String text); - @Override - public void onAttach(@NonNull Context context) { - super.onAttach(context); - qrScanTrigger.observe(this, ignored -> { - scanQrLauncher.launch(null); - }); - } -} diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/QRScanCapableFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/QRScanCapableFragment.java new file mode 100644 index 00000000..a23a402a --- /dev/null +++ b/app/src/main/java/net/ktnx/mobileledger/ui/QRScanCapableFragment.java @@ -0,0 +1,41 @@ +/* + * 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 + * the Free Software Foundation, either version 3 of the License, or + * (at your opinion), any later version. + * + * MoLe is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License terms for details. + * + * You should have received a copy of the GNU General Public License + * along with MoLe. If not, see . + */ + +package net.ktnx.mobileledger.ui; + +import android.content.Context; + +import androidx.activity.result.ActivityResultLauncher; +import androidx.annotation.NonNull; +import androidx.fragment.app.Fragment; +import androidx.lifecycle.MutableLiveData; + +public abstract class QRScanCapableFragment extends Fragment { + private static final MutableLiveData qrScanTrigger = new MutableLiveData<>(); + protected final ActivityResultLauncher scanQrLauncher = QR.registerLauncher(this, this::onQrScanned); + public static void triggerQRScan() { + qrScanTrigger.setValue(1); + } + protected abstract void onQrScanned(String text); + @Override + public void onAttach(@NonNull Context context) { + super.onAttach(context); + qrScanTrigger.observe(this, ignored -> { + scanQrLauncher.launch(null); + }); + } +} diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionFragment.java index 9a2226f3..0b82c27b 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionFragment.java @@ -56,7 +56,7 @@ import net.ktnx.mobileledger.model.Data; import net.ktnx.mobileledger.model.LedgerTransaction; import net.ktnx.mobileledger.model.LedgerTransactionAccount; import net.ktnx.mobileledger.model.MobileLedgerProfile; -import net.ktnx.mobileledger.ui.QRScanAbleFragment; +import net.ktnx.mobileledger.ui.QRScanCapableFragment; import net.ktnx.mobileledger.ui.patterns.PatternsActivity; import net.ktnx.mobileledger.utils.Logger; import net.ktnx.mobileledger.utils.Misc; @@ -79,7 +79,7 @@ import java.util.regex.Pattern; // TODO: offer to undo account remove-on-swipe -public class NewTransactionFragment extends QRScanAbleFragment { +public class NewTransactionFragment extends QRScanCapableFragment { private NewTransactionItemsAdapter listAdapter; private NewTransactionModel viewModel; private FloatingActionButton fab; diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java b/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java index 25083fac..1484eab7 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/patterns/PatternDetailsAdapter.java @@ -36,7 +36,7 @@ import net.ktnx.mobileledger.db.PatternBase; import net.ktnx.mobileledger.model.Data; import net.ktnx.mobileledger.model.PatternDetailsItem; import net.ktnx.mobileledger.ui.PatternDetailSourceSelectorFragment; -import net.ktnx.mobileledger.ui.QRScanAbleFragment; +import net.ktnx.mobileledger.ui.QRScanCapableFragment; import net.ktnx.mobileledger.utils.Logger; import net.ktnx.mobileledger.utils.Misc; @@ -417,7 +417,7 @@ class PatternDetailsAdapter extends RecyclerView.Adapter