Beispiel #1
0
  private void updateMainList(List<AppInfo> apps) {

    if (apps != null) {

      if (apps.size() > 0) {
        footer.setVisibility(View.VISIBLE);

        String autosyncSet = Preferences.getAutosyncSet(Main.this, accountname);
        if (autosyncSet == null) {

          // set autosync default value
          AutosyncHandlerFactory.getInstance(Main.this)
              .setAutosyncPeriod(accountname, AutosyncHandler.DEFAULT_PERIOD);

          Preferences.saveAutosyncSet(Main.this, accountname);
        }
      }

      adapter.setAppInfos(apps);
      adapter.notifyDataSetChanged();

      Date lastUpdateDate = null;

      for (int i = 0; i < apps.size(); i++) {
        Date dateObject = apps.get(i).getLastUpdate();
        if (lastUpdateDate == null || lastUpdateDate.before(dateObject)) {
          lastUpdateDate = dateObject;
        }
      }

      if (lastUpdateDate != null) {
        statusText.setText("last update: " + ContentAdapter.formatDate(lastUpdateDate));
      }
    }

    if (!(R.id.main_app_list == mainViewSwitcher.getCurrentView().getId())) {
      mainViewSwitcher.showNext();
    }
  }