Lines Matching refs:Cursor
35 import android.database.Cursor;
90 private Cursor mTrackCursor;
206 null, // cursor
218 // a cursor yet (because the initial query that sets its cursor
221 // first case, simply retry the query when the cursor is null.
277 // close its cursor, which we do by assigning a null cursor to it. Doing this
278 // instead of closing the cursor directly keeps the framework from accessing
279 // the closed cursor later.
342 // if the query results in a null cursor, onQueryComplete() will
361 public void init(Cursor newCursor, boolean isLimited) {
383 // for the 2nd (non-limited) cursor
459 Cursor cursor = MusicUtils.query(this, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
461 if (cursor != null) {
462 if (cursor.getCount() != numresults) {
466 cursor.deactivate();
487 Cursor cursor = MusicUtils.query(this,
490 if (cursor != null) {
491 if (cursor.getCount() != 0) {
492 cursor.moveToFirst();
493 fancyName = cursor.getString(0);
495 cursor.deactivate();
502 Cursor cursor = MusicUtils.query(this,
505 if (cursor != null) {
506 if (cursor.getCount() != 0) {
507 cursor.moveToFirst();
508 fancyName = cursor.getString(0);
510 cursor.deactivate();
609 Cursor c = new NowPlayingCursor(MusicUtils.sService, mCursorCols);
620 // Cursor should be positioned on the entry to be checked
623 private boolean isMusic(Cursor c) {
936 Cursor cursor;
949 cursor = MusicUtils.query(this, MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
953 if (cursor != null) {
954 MusicUtils.shuffleAll(this, cursor);
955 cursor.close();
1007 private Cursor getTrackCursor(TrackListAdapter.TrackQueryHandler queryhandler, String filter,
1014 Cursor ret = null;
1086 // This special case is for the "nowplaying" cursor, which cannot be handled
1188 // The cursor doesn't have any duplicates in it, and is not ordered
1189 // in queue-order, so we need to figure out where in the cursor we
1222 onMove(-1, mCurPos); // update the underlying cursor
1322 private Cursor mCurrentPlaylistCursor; // updated in onMove
1373 public Cursor doQuery(Uri uri, String[] projection,
1395 protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
1396 //Log.i("@@@", "query complete: " + cursor.getCount() + " " + mActivity);
1397 mActivity.init(cursor, cookie != null);
1398 if (token == 0 && cookie != null && cursor != null &&
1399 !cursor.isClosed() && cursor.getCount() >= 100) {
1408 int layout, Cursor cursor, String[] from, int[] to,
1410 super(context, layout, cursor, from, to);
1412 getColumnIndices(cursor);
1429 private void getColumnIndices(Cursor cursor) {
1430 if (cursor != null) {
1431 mTitleIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.TITLE);
1432 mArtistIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.ARTIST);
1433 mDurationIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media.DURATION);
1435 mAudioIdIdx = cursor.getColumnIndexOrThrow(
1438 mAudioIdIdx = cursor.getColumnIndexOrThrow(MediaStore.Audio.Media._ID);
1442 mIndexer.setCursor(cursor);
1446 mIndexer = new MusicAlphabetIndexer(cursor, mTitleIdx, alpha);
1452 public View newView(Context context, Cursor cursor, ViewGroup parent) {
1453 View v = super.newView(context, cursor, parent);
1469 public void bindView(View view, Context context, Cursor cursor) {
1473 cursor.copyStringToBuffer(mTitleIdx, vh.buffer1);
1476 int secs = cursor.getInt(mDurationIdx) / 1000;
1486 String name = cursor.getString(mArtistIdx);
1524 if ( (mIsNowPlaying && cursor.getPosition() == id) ||
1525 (!mIsNowPlaying && !mDisableNowPlayingIndicator && cursor.getLong(mAudioIdIdx) == id)) {
1534 public void changeCursor(Cursor cursor) {
1535 if (mActivity.isFinishing() && cursor != null) {
1536 cursor.close();
1537 cursor = null;
1539 if (cursor != mActivity.mTrackCursor) {
1540 mActivity.mTrackCursor = cursor;
1541 super.changeCursor(cursor);
1542 getColumnIndices(cursor);
1547 public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
1554 Cursor c = mActivity.getTrackCursor(mQueryHandler, s, false);