Ejemplo n.º 1
0
    public void run() {
      final FragmentActivity context = getActivity();
      if (context == null) {
        return;
      }

      if (mSeasonId != null) {
        // update one season
        DBUtils.updateUnwatchedCount(context, mSeasonId);
      } else {
        // update all seasons of this show, start with the most recent
        // one
        final Cursor seasons =
            context
                .getContentResolver()
                .query(
                    Seasons.buildSeasonsOfShowUri(mShowId),
                    new String[] {Seasons._ID},
                    null,
                    null,
                    Seasons.COMBINED + " DESC");
        if (seasons == null) {
          return;
        }
        while (seasons.moveToNext()) {
          String seasonId = seasons.getString(0);
          DBUtils.updateUnwatchedCount(context, seasonId);

          notifyContentProvider(context);
        }
        seasons.close();
      }

      notifyContentProvider(context);
    }
Ejemplo n.º 2
0
 public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
   return new CursorLoader(
       getActivity(),
       Seasons.buildSeasonsOfShowUri(String.valueOf(getShowId())),
       SeasonsQuery.PROJECTION,
       SeasonsQuery.SELECTION,
       null,
       mSorting.query());
 }
Ejemplo n.º 3
0
 private void notifyContentProvider(final FragmentActivity context) {
   context.getContentResolver().notifyChange(Seasons.buildSeasonsOfShowUri(mShowId), null);
 }