From 308b28dd23dded4ab1e09536e56f44cc8ceb5f44 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 24 Apr 2013 08:01:17 -0700 Subject: [PATCH] Use query conditions for the name lookup :D --- .../org/wikimedia/commons/CategorizationFragment.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/commons/src/main/java/org/wikimedia/commons/CategorizationFragment.java b/commons/src/main/java/org/wikimedia/commons/CategorizationFragment.java index 5caf75d95..2f915d0b8 100644 --- a/commons/src/main/java/org/wikimedia/commons/CategorizationFragment.java +++ b/commons/src/main/java/org/wikimedia/commons/CategorizationFragment.java @@ -238,15 +238,12 @@ public class CategorizationFragment extends SherlockFragment{ Cursor cursor = getActivity().getContentResolver().query( CategoryContentProvider.BASE_URI, Category.Table.ALL_FIELDS, - null, - new String[] {}, + Category.Table.COLUMN_NAME + "=?", + new String[] {name}, null); - // fixme move to conditions - while (cursor.moveToNext()) { + if (cursor.moveToNext()) { Category cat = Category.fromCursor(cursor); - if (cat.getName().equals(name)) { - return cat; - } + return cat; } // Newly used category...