Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad2cf220 authored by Jean Chalard's avatar Jean Chalard Committed by Android (Google) Code Review
Browse files

Merge "Remove a call to a deprecated method"

parents 251ed3b3 c44b7312
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -89,8 +89,6 @@ public class ContactsBinaryDictionary extends ExpandableBinaryDictionary {
    }

    private synchronized void registerObserver(final Context context) {
        // Perform a managed query. The Activity will handle closing and requerying the cursor
        // when needed.
        if (mObserver != null) return;
        ContentResolver cres = context.getContentResolver();
        cres.registerContentObserver(Contacts.CONTENT_URI, true, mObserver =
+0 −2
Original line number Diff line number Diff line
@@ -97,8 +97,6 @@ public class UserBinaryDictionary extends ExpandableBinaryDictionary {
            mLocale = localeStr;
        }
        mAlsoUseMoreRestrictiveLocales = alsoUseMoreRestrictiveLocales;
        // Perform a managed query. The Activity will handle closing and re-querying the cursor
        // when needed.
        ContentResolver cres = context.getContentResolver();

        mObserver = new ContentObserver(null) {
+1 −2
Original line number Diff line number Diff line
@@ -53,8 +53,7 @@ public class UserDictionaryList extends PreferenceFragment {
    }

    public static TreeSet<String> getUserDictionaryLocalesSet(Activity activity) {
        @SuppressWarnings("deprecation")
        final Cursor cursor = activity.managedQuery(UserDictionary.Words.CONTENT_URI,
        final Cursor cursor = activity.getContentResolver().query(UserDictionary.Words.CONTENT_URI,
                new String[] { UserDictionary.Words.LOCALE },
                null, null, null);
        final TreeSet<String> localeSet = new TreeSet<String>();
+4 −1
Original line number Diff line number Diff line
@@ -141,7 +141,10 @@ public class UserDictionarySettings extends ListFragment {

        mLocale = locale;
        // WARNING: The following cursor is never closed! TODO: don't put that in a member, and
        // make sure all cursors are correctly closed.
        // make sure all cursors are correctly closed. Also, this comes from a call to
        // Activity#managedQuery, which has been deprecated for a long time (and which FORBIDS
        // closing the cursor, so take care when resolving this TODO). We should either use a
        // regular query and close the cursor, or switch to a LoaderManager and a CursorLoader.
        mCursor = createCursor(locale);
        TextView emptyView = (TextView) getView().findViewById(android.R.id.empty);
        emptyView.setText(R.string.user_dict_settings_empty_text);