package org.ccci.gto.android.common.support.v4.fragment;

import android.database.Cursor;
import android.os.Build;
import android.widget.CursorAdapter;
import android.widget.ListAdapter;

import org.ccci.gto.android.common.support.v4.util.FragmentUtils;

import androidx.fragment.app.ListFragment;

public class AbstractListFragment extends ListFragment {
    protected final <T> T findView(final Class<T> clazz, final int id) {
        return FragmentUtils.findView(this, clazz, id);
    }

    protected final <T> T getListener(final Class<T> clazz) {
        return FragmentUtils.getListener(this, clazz);
    }

    protected void changeCursor(final Cursor cursor) {
        final Cursor old = this.swapCursor(cursor);
        if (old != null) {
            old.close();
        }
    }

    protected Cursor swapCursor(final Cursor cursor) {
        final ListAdapter adapter = getListAdapter();
        if (adapter instanceof CursorAdapter) {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
                return ((CursorAdapter) adapter).swapCursor(cursor);
            } else {
                ((CursorAdapter) adapter).changeCursor(cursor);
            }
        } else if (adapter instanceof androidx.cursoradapter.widget.CursorAdapter) {
            return ((androidx.cursoradapter.widget.CursorAdapter) adapter).swapCursor(cursor);
        }

        return null;
    }
}

@@ -87,33 +87,8 @@
 or;%0A
-import android.os.Build;%0A
 impo
@@ -933,237 +933,60 @@
     
-if (Build.VERSION.SDK_INT %3E= Build.VERSION_CODES.HONEYCOMB) %7B%0A                return ((CursorAdapter) adapter).swapCursor(cursor);%0A            %7D else %7B%0A                ((CursorAdapter) adapter).changeCursor(cursor);%0A            %7D
+return ((CursorAdapter) adapter).swapCursor(cursor);
 %0A   

remove some more pre-Honeycomb logic