diff --git a/app/src/main/java/io/legado/app/api/ReaderProvider.kt b/app/src/main/java/io/legado/app/api/ReaderProvider.kt index fcf50aa9c..3ae8c7963 100644 --- a/app/src/main/java/io/legado/app/api/ReaderProvider.kt +++ b/app/src/main/java/io/legado/app/api/ReaderProvider.kt @@ -7,10 +7,7 @@ import android.content.ContentProvider import android.content.ContentResolver import android.content.ContentValues import android.content.UriMatcher -import android.database.CharArrayBuffer -import android.database.ContentObserver -import android.database.Cursor -import android.database.DataSetObserver +import android.database.* import android.net.Uri import android.os.Bundle import com.google.gson.Gson @@ -109,40 +106,22 @@ class ReaderProvider : ContentProvider() { uri: Uri, values: ContentValues?, selection: String?, selectionArgs: Array? ) = throw UnsupportedOperationException("Not yet implemented") - + /** * Simple inner class to deliver json callback data. * * Only getString() makes sense. */ - private class SimpleCursor(data: ReturnData?) : Cursor { + private class SimpleCursor(data: ReturnData?) : MatrixCursor(arrayOf("result"), 1) { private val mData: String = Gson().toJson(data) - override fun getCount() = 1 - - override fun getPosition() = 0 - - override fun move(i: Int) = true - - override fun moveToPosition(i: Int) = true - - override fun moveToFirst() = true - - override fun moveToLast() = true - - override fun moveToNext() = true - - override fun moveToPrevious() = true - - override fun isFirst() = true - - override fun isLast() = true - - override fun isBeforeFirst() = true + init { + addRow(arrayOf(mData)) + } - override fun isAfterLast() = true + override fun getCount() = 1 override fun getColumnIndex(s: String) = 0