sm.setDynamicShortcuts(shortcuts);
}
private void onProfileListChanged(List<MobileLedgerProfile> newList) {
+ if (newList == null) {
+ // profiles not yet loaded from DB
+ findViewById(R.id.loading_layout).setVisibility(View.VISIBLE);
+ findViewById(R.id.no_profiles_layout).setVisibility(View.GONE);
+ findViewById(R.id.pager_layout).setVisibility(View.GONE);
+ return;
+ }
+
if (newList.isEmpty()) {
findViewById(R.id.no_profiles_layout).setVisibility(View.VISIBLE);
findViewById(R.id.pager_layout).setVisibility(View.GONE);
createShortcuts(newList);
}
- /** called when the current profile has changed */
+ /**
+ * called when the current profile has changed
+ */
private void onProfileChanged(MobileLedgerProfile profile) {
boolean haveProfile = profile != null;
findViewById(R.id.no_profiles_layout).setVisibility(haveProfile ? View.GONE : View.VISIBLE);
startActivity(intent, args);
}
private void setupProfile() {
- MLDB.getOption(MLDB.OPT_PROFILE_UUID, null, new GetOptCallback(){
+ MLDB.getOption(MLDB.OPT_PROFILE_UUID, null, new GetOptCallback() {
@Override
protected void onResult(String profileUUID) {
MobileLedgerProfile startupProfile;
}
}
public void updateLastUpdateTextFromDB() {
- long last_update = (profile != null) ? profile.getLongOption(MLDB.OPT_LAST_SCRAPE, 0L) : 0;
+ if (profile == null) return;
+
+ long last_update = profile.getLongOption(MLDB.OPT_LAST_SCRAPE, 0L);
debug("transactions", String.format(Locale.ENGLISH, "Last update = %d", last_update));
if (last_update == 0) {