From 776e2740fc0237e4305a6cb2dcf6653c0a62c484 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sat, 15 Aug 2020 15:44:52 +0300 Subject: [PATCH] replace with FragmentContainerView as recommended supposedly more flexible about fragment transactions --- .../mobileledger/ui/activity/NewTransactionActivity.java | 8 +++++--- app/src/main/res/layout/activity_new_transaction.xml | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java index 45e75b5b..74996417 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java @@ -1,5 +1,5 @@ /* - * Copyright © 2019 Damyan Ivanov. + * Copyright © 2020 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 @@ -26,7 +26,7 @@ import android.view.View; import androidx.appcompat.widget.Toolbar; import androidx.lifecycle.ViewModelProvider; import androidx.navigation.NavController; -import androidx.navigation.Navigation; +import androidx.navigation.fragment.NavHostFragment; import net.ktnx.mobileledger.BuildConfig; import net.ktnx.mobileledger.R; @@ -53,7 +53,9 @@ public class NewTransactionActivity extends ProfileThemedActivity implements Tas Data.observeProfile(this, mobileLedgerProfile -> toolbar.setSubtitle(mobileLedgerProfile.getName())); - navController = Navigation.findNavController(this, R.id.new_transaction_nav); + NavHostFragment navHostFragment = (NavHostFragment) Objects.requireNonNull( + getSupportFragmentManager().findFragmentById(R.id.new_transaction_nav)); + navController = navHostFragment.getNavController(); Objects.requireNonNull(getSupportActionBar()) .setDisplayHomeAsUpEnabled(true); diff --git a/app/src/main/res/layout/activity_new_transaction.xml b/app/src/main/res/layout/activity_new_transaction.xml index 7a37dbf8..d95d8fb0 100644 --- a/app/src/main/res/layout/activity_new_transaction.xml +++ b/app/src/main/res/layout/activity_new_transaction.xml @@ -66,11 +66,12 @@ -