return -1;
}
+ public static MobileLedgerProfile getProfile(String profileUUID) {
+ MobileLedgerProfile profile;
+ if (profiles.isEmpty()) {
+ profile = MobileLedgerProfile.loadAllFromDB(profileUUID);
+ }
+ else {
+ try (LockHolder lh = profiles.lockForReading()) {
+ int i = getProfileIndex(profileUUID);
+ if (i == -1) i = 0;
+ profile = profiles.get(i);
+ }
+ }
+ return profile;
+ }
}
String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
MobileLedgerProfile profile;
- if (Data.profiles.isEmpty()) {
- profile = MobileLedgerProfile.loadAllFromDB(profileUUID);
- }
- else {
- try (LockHolder lh = Data.profiles.lockForReading()) {
- int i = Data.getProfileIndex(profileUUID);
- if (i == -1) i = 0;
- profile = Data.profiles.get(i);
- }
- }
+ profile = Data.getProfile(profileUUID);
if (Data.profiles.isEmpty()) {
findViewById(R.id.no_profiles_layout).setVisibility(View.VISIBLE);