Ejemplo n.º 1
0
  @Override
  public ArrayList<MediaItem> getMediaItem(int start, int count) {
    DataManager dataManager = mApplication.getDataManager();
    Uri uri = mBaseUri.buildUpon().appendQueryParameter("limit", start + "," + count).build();
    ArrayList<MediaItem> list = new ArrayList<MediaItem>();
    GalleryUtils.assertNotInRenderThread();
    Cursor cursor =
        mResolver.query(
            uri, mProjection, mWhereClause, new String[] {String.valueOf(mBucketId)}, mOrderClause);
    if (cursor == null) {
      Log.w(TAG, "query fail: " + uri);
      return list;
    }

    try {
      while (cursor.moveToNext()) {
        int id = cursor.getInt(0); // _id must be in the first column
        Path childPath = mItemPath.getChild(id);
        MediaItem item = loadOrUpdateItem(childPath, cursor, dataManager, mApplication, mIsImage);
        list.add(item);
      }
    } finally {
      cursor.close();
    }
    return list;
  }
Ejemplo n.º 2
0
 @Override
 public void delete() {
   GalleryUtils.assertNotInRenderThread();
   mResolver.delete(mBaseUri, mWhereClause, new String[] {String.valueOf(mBucketId)});
 }