/*
- * 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
import net.ktnx.mobileledger.model.MobileLedgerProfile;
import net.ktnx.mobileledger.utils.Logger;
import net.ktnx.mobileledger.utils.Misc;
+import net.ktnx.mobileledger.utils.SimpleDate;
import org.jetbrains.annotations.NotNull;
-import java.util.Date;
-
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
throw new RSInvalidStateException(
"getActivity() returned null within onActivityCreated()");
- list = activity.findViewById(R.id.new_transaction_accounts);
viewModel = new ViewModelProvider(activity).get(NewTransactionModel.class);
viewModel.observeDataProfile(this);
- mProfile = Data.profile.getValue();
+ mProfile = Data.getProfile();
listAdapter = new NewTransactionItemsAdapter(viewModel, mProfile);
list.setAdapter(listAdapter);
list.setLayoutManager(new LinearLayoutManager(activity));
- Data.profile.observe(getViewLifecycleOwner(), profile -> {
+
+ Data.observeProfile(getViewLifecycleOwner(), profile -> {
mProfile = profile;
listAdapter.setProfile(profile);
});
if (isSubmittable) {
if (fab != null) {
fab.show();
- fab.setEnabled(true);
}
}
else {
// p.setVisibility(View.VISIBLE);
//
// }, 10);
- p.setVisibility(View.VISIBLE);
+ p.setVisibility(View.VISIBLE);
}
else
p.setVisibility(View.INVISIBLE);
outState.putInt("focused", focusedItem);
}
private void onFabPressed() {
- fab.setEnabled(false);
+ fab.hide();
Misc.hideSoftKeyboard(this);
if (mListener != null) {
- Date date = viewModel.getDate();
+ SimpleDate date = viewModel.getDate();
LedgerTransaction tr =
new LedgerTransaction(null, date, viewModel.getDescription(), mProfile);
+ tr.setComment(viewModel.getComment());
LedgerTransactionAccount emptyAmountAccount = null;
float emptyAmountAccountBalance = 0;
for (int i = 0; i < viewModel.getAccountCount(); i++) {