Beispiel #1
0
 public void selectCategory(int category_id, boolean forceUpdate) {
   if (mCategoryId != category_id || forceUpdate) {
     mCategoryId = category_id;
     if ((mAdapter = getAdapter(mCategoryId)) == null) {
       mAdapter =
           new MainListAdapter(
               getActivity(),
               AccountManager.getInstance().getAccountsByCategory(mCategoryId),
               Application.getThemedIcons(),
               R.drawable.pb_unknown);
       mListView.postDelayed(
           new Runnable() {
             @Override
             public void run() {
               mAdapter.enableAnimation(false);
             }
           },
           100);
       cacheAdapter(mCategoryId, mAdapter);
     }
     mAdapter.setListener(this);
     mListView.setAdapter(mAdapter);
     mAdapter.notifyDataSetChanged();
     mToBeRemoved = new int[mAdapter.getCount()];
     ((TextView) mListView.getEmptyView()).setText(R.string.no_accounts);
     mCategoryIcon = -1;
     mCategoryName = null;
   }
 }
Beispiel #2
0
 public void setSearch(ArrayList<AccountManager.Account> result) {
   mAdapter =
       new MainListAdapter(
           getActivity(), result, Application.getThemedIcons(), R.drawable.pb_unknown);
   mAdapter.enableAnimation(false);
   mAdapter.setListener(this);
   mListView.setAdapter(mAdapter);
   mAdapter.notifyDataSetChanged();
   mToBeRemoved = new int[mAdapter.getCount()];
   ((TextView) mListView.getEmptyView()).setText(R.string.empty_search);
 }
Beispiel #3
0
 private void updateListForEditing() {
   if (mCategoryId != AccountManager.DEFAULT_CATEGORY_ID) {
     ArrayList<AccountManager.Account> accounts =
         AccountManager.getInstance().getAccountsByCategory(AccountManager.DEFAULT_CATEGORY_ID);
     if (mCategoryId == AccountManager.ALL_CATEGORY_ID) {
       mAdapter.addList(accounts, true);
     } else {
       mAdapter.markAll(mListView);
       mAdapter.addList(accounts, false);
       mAdapter.notifyDataSetChanged();
     }
   }
 }
Beispiel #4
0
  private void updateStatsMode() {
    switch (currentStatsMode) {
      case PERCENT:
        statsModeText.setText(this.getString(R.string.daily));
        statsModeIcon.setImageDrawable(getResources().getDrawable(R.drawable.icon_plusminus));
        break;

      case DAY_CHANGES:
        statsModeText.setText(this.getString(R.string.percentage));
        statsModeIcon.setImageDrawable(getResources().getDrawable(R.drawable.icon_percent));
        break;

      default:
        break;
    }

    adapter.setStatsMode(currentStatsMode);
    adapter.notifyDataSetChanged();
    Preferences.saveStatsMode(currentStatsMode, Main.this);
  }
Beispiel #5
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();
    }
  }