Data.backgroundTaskStarted();
try {
MobileLedgerProfile profile = Data.profile.getValue();
- assert profile != null;
+ if (profile == null) throw new AssertionError();
String profileUUID = profile.getUuid();
boolean onlyStarred = Data.optShowOnlyStarred.get();
ArrayList<LedgerAccount> newList = new ArrayList<>();
public static int getProfileIndex(MobileLedgerProfile profile) {
try (LockHolder ignored = profilesLocker.lockForReading()) {
List<MobileLedgerProfile> prList = profiles.getValue();
- assert prList != null;
+ if (prList == null) throw new AssertionError();
for (int i = 0; i < prList.size(); i++) {
MobileLedgerProfile p = prList.get(i);
if (p.equals(profile)) return i;
public static int getProfileIndex(String profileUUID) {
try (LockHolder ignored = profilesLocker.lockForReading()) {
List<MobileLedgerProfile> prList = profiles.getValue();
- assert prList != null;
+ if (prList == null) throw new AssertionError();
for (int i = 0; i < prList.size(); i++) {
MobileLedgerProfile p = prList.get(i);
if (p.getUuid().equals(profileUUID)) return i;
String.format("[fragment] removing profile %s", mProfile.getUuid()));
mProfile.removeFromDB();
ArrayList<MobileLedgerProfile> oldList = Data.profiles.getValue();
- assert oldList != null;
+ if (oldList == null) throw new AssertionError();
ArrayList<MobileLedgerProfile> newList =
(ArrayList<MobileLedgerProfile>) oldList.clone();
newList.remove(mProfile);
int index = Data.getProfileIndex(mProfile);
MobileLedgerProfile newProfile = new MobileLedgerProfile(mProfile);
final ArrayList<MobileLedgerProfile> profiles = Data.profiles.getValue();
- assert profiles != null;
+ if (profiles == null) throw new AssertionError();
profiles.set(index, newProfile);
if (mProfile.equals(Data.profile.getValue())) Data.profile.setValue(newProfile);
}
updateProfileFromUI();
mProfile.storeInDB();
final ArrayList<MobileLedgerProfile> profiles = Data.profiles.getValue();
- assert profiles != null;
+ if (profiles == null) throw new AssertionError();
ArrayList<MobileLedgerProfile> newList =
(ArrayList<MobileLedgerProfile>) profiles.clone();
newList.add(mProfile);
@NonNull RecyclerView.ViewHolder viewHolder,
@NonNull RecyclerView.ViewHolder target) {
final ArrayList<MobileLedgerProfile> profiles = Data.profiles.getValue();
- assert profiles != null;
+ if (profiles == null) throw new AssertionError();
Collections.swap(profiles, viewHolder.getAdapterPosition(),
target.getAdapterPosition());
MobileLedgerProfile.storeProfilesOrder();
@Override
public void onBindViewHolder(@NonNull final ProfileListViewHolder holder, int position) {
final ArrayList<MobileLedgerProfile> profiles = Data.profiles.getValue();
- assert profiles != null;
+ if (profiles == null) throw new AssertionError();
final MobileLedgerProfile profile = profiles.get(position);
final MobileLedgerProfile currentProfile = Data.profile.getValue();
debug("profiles", String.format(Locale.ENGLISH, "pos %d: %s, current: %s", position,