X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Fprofiles%2FProfileDetailFragment.java;h=f5b48aef3e22c5dc4d0ec52f9ef8670f6bbdd485;hb=93545c6fbf1244fbd96ecfc50e1115dbdc25f9ae;hp=36e39af20dfb712e798a6668e07c82d5c75e5ac6;hpb=57f795ed8e5ddb4ffeb0e3bcaaa844c65c894d31;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java index 36e39af2..f5b48aef 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/profiles/ProfileDetailFragment.java @@ -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 @@ -52,7 +52,6 @@ import net.ktnx.mobileledger.model.Data; import net.ktnx.mobileledger.model.MobileLedgerProfile; import net.ktnx.mobileledger.ui.CurrencySelectorFragment; import net.ktnx.mobileledger.ui.HueRingDialog; -import net.ktnx.mobileledger.ui.activity.ProfileDetailActivity; import net.ktnx.mobileledger.utils.Colors; import net.ktnx.mobileledger.utils.Misc; @@ -63,7 +62,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.Objects; -import java.util.UUID; import static net.ktnx.mobileledger.utils.Logger.debug; @@ -112,7 +110,7 @@ public class ProfileDetailFragment extends Fragment { builder.setTitle(mProfile.getName()); builder.setMessage(R.string.remove_profile_dialog_message); builder.setPositiveButton(R.string.Remove, (dialog, which) -> { - debug("profiles", String.format("[fragment] removing profile %s", mProfile.getUuid())); + debug("profiles", String.format("[fragment] removing profile %s", mProfile.getId())); mProfile.removeFromDB(); ArrayList oldList = Data.profiles.getValue(); if (oldList == null) @@ -206,7 +204,7 @@ public class ProfileDetailFragment extends Fragment { resetDefaultCommodity(); }); - FloatingActionButton fab = context.findViewById(R.id.fab); + FloatingActionButton fab = context.findViewById(R.id.fabAdd); fab.setOnClickListener(v -> onSaveFabClicked()); hookTextChangeSyncRoutine(binding.profileName, model::setProfileName); @@ -432,9 +430,7 @@ public class ProfileDetailFragment extends Fragment { // debug("profiles", String.format("Selected item is %d", mProfile.getThemeHue())); final MobileLedgerProfile currentProfile = Data.getProfile(); - if (mProfile.getUuid() - .equals(currentProfile.getUuid())) - { + if (mProfile.getId() == currentProfile.getId()) { Data.setCurrentProfile(mProfile); } @@ -443,7 +439,7 @@ public class ProfileDetailFragment extends Fragment { viewAdapter.notifyItemChanged(pos); } else { - mProfile = new MobileLedgerProfile(String.valueOf(UUID.randomUUID())); + mProfile = new MobileLedgerProfile(0); model.updateProfile(mProfile); mProfile.storeInDB(); final ArrayList newList = new ArrayList<>(profiles); @@ -497,7 +493,8 @@ public class ProfileDetailFragment extends Fragment { if (model.getUseAuthentication()) { String urlText = model.getUrl(); - if (urlText.startsWith("http") && !urlText.startsWith("https")) + if (urlText.startsWith("http://") || + urlText.length() >= 8 && !urlText.startsWith("https://")) showWarning = true; }